Nevermind25 Posted January 1, 2020 Posted January 1, 2020 stop sticking elbows, you guys are good together :D :D @guytis can you explain me why there is 5 ? parameter nWriteForm of the WriteRelativeAdress Quote
guytis Posted January 2, 2020 Author Posted January 2, 2020 (edited) 57 minutes ago, Nevermind25 said: stop sticking elbows, you guys are good together :D :D @guytis can you explain me why there is 5 ? parameter nWriteForm of the WriteRelativeAdress 7A882A movlpd xmm13, cs:dbl_9CCFB0 Hex dump = 66 44 0F 12 2D 7D 47 22 00 (9 bytes) fisrt 5 bytes 66 44 0F 12 2D 4 bytes 7D 47 22 00 (dbl_9CCFB0) WriteForm 5 = writememory in 7A882A+5 Edited January 2, 2020 by guytis Quote
Nevermind25 Posted January 2, 2020 Posted January 2, 2020 Some book where i can learn about? i'm felling like a donkey, really thanks Quote
guytis Posted January 2, 2020 Author Posted January 2, 2020 7 hours ago, Nevermind25 said: Some book where i can learn about? i'm felling like a donkey, really thanks I did not read any. just google haha Quote
Nevermind25 Posted January 2, 2020 Posted January 2, 2020 hahaa okey okey, then im in good track Quote
ptitlaby Posted November 18, 2020 Posted November 18, 2020 (edited) On 12/27/2019 at 4:20 PM, guytis said: Hi, here is the 100% decompiled CItem::EnchantItem function Config::ExceptionMailing: it is never false L2Server.exe C4 In case anyone needs it. bool CItem::EnchantItem(CItem *scroll, CItem *pItem, User* pUser) { pUser_ = pUser; pItem_ = pItem; scroll_ = scroll; if ( !pItem_ ) { return false; } pSID = pItem_->d.pSID; nEnchantLevel = pSID->nEnchantLevel; SlotType = (pSID->nSlotType >> 15) & 1; if ( !(pItem_->vtable->base.Config::ExceptionMailing)) { if ( nEnchantLevel < 3 ) goto SUCCESS; if ( nEnchantLevel >= 20 ) { prob = 0.0; } else { if ( SlotType ) chance = WeaponEnchantTable[nEnchantLevel] * 100.0; else chance = ArmorEnchantTable[nEnchantLevel] * 100.0; prob = 100.0 - chance; } if ( nEnchantLevel >= 15 ) prob = prob * 0.5; random = rand(); dice = 100.0 - 0.0; if ( nEnchantLevel < 20 && prob >= random / 32767.0 * (100.0 - 0.0) + 0.0 ) { CLog::Add(&g_winlog, LOG_REQUEST, L"armor enchant success, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random / 32767.0 * dice + 0.0, prob); goto SUCCESS; } CLog::Add(&g_winlog, LOG_REQUEST, L"armor enchant fail, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random / 32767.0 * dice + 0.0, prob); goto FAIL; } pII = pItem_->d.pII; if ( pII->nCrystalType < CrystalC || !LOBYTE(pII->magicWeapon) ) { prob_1 = 70.0; if ( nEnchantLevel < 3 ) goto SUCCESS; if ( nEnchantLevel >= 15 ) prob_1 = 35.0; random_1 = rand(); if ( prob_1 >= random_1 / 32767.0 * (100.0 - 0.0) + 0.0 ) { CLog::Add(&g_winlog, LOG_REQUEST, L"weapon enchant success, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random_1 / 32767.0 * (100.0 - 0.0) + 0.0, prob_1); goto SUCCESS; } CLog::Add(&g_winlog, LOG_REQUEST, L"weapon enchant fail, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random_1 / 32767.0 * (100.0 - 0.0) + 0.0, prob_1); goto FAIL; } prob_2 = 40.0; if ( nEnchantLevel >= 3 ) { if ( nEnchantLevel >= 15 ) prob_2 = 20.0; random_2 = rand(); if ( prob_2 >= random_2 / 32767.0 * (100.0 - 0.0) + 0.0 ) { CLog::Add(&g_winlog, LOG_REQUEST, L"magic weapon enchant success, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random_2 / 32767.0 * (100.0 - 0.0) + 0.0, prob_2); goto SUCCESS; } CLog::Add(&g_winlog, LOG_REQUEST, L"magic weapon enchant fail, prev enchanted[%d], dice[%f], prob[%f]", nEnchantLevel, random_2 / 32767.0 * (100.0 - 0.0) + 0.0, prob_2); FAIL: etcType = scroll_->d.pII->etcType; if ( etcType == EtcItemBlessedScrollEnchantWeapon || etcType == EtcItemBlessedScrollEnchantArmor ) { User::SendSystemMessage(pUser_->socket, id_1517__Fallo_en_el_encantamiento_blessed_El_valor_del_encantamiento_del_item_se_convirtio_a_0); CDB::RequestEnchantItem(&g_CDB, scroll_, pItem_, 0, pUser_); } else { CSocket::Send(pUser_->socket, "cdddddd", 100i64); CDB::RequestEnchantItemFail(&g_CDB, scroll_, pItem_, pUser_); } goto END; } SUCCESS: if ( nEnchantLevel ) { CSocket::Send(pUser_->socket, "cdddddd", 100i64); } else { v25 = 3; v24 = 1; CSocket::Send(pUser_->socket, "cdddd", 100i64, 62i64, v24, v25, pItem_->d.pSID->nItemID); } CDB::RequestEnchantItem(&g_CDB, scroll_, pItem_, nEnchantLevel + 1, pUser_); END: return false; } WeaponEnchantTable dq 0 ; DATA XREF: CItem__EnchantItem+27B↑r .rdata:0000000000A06B88 align 20h .rdata:0000000000A06BA0 dq 0.3333333333333333 .rdata:0000000000A06BA8 dq 0.6666666666666666 .rdata:0000000000A06BB0 dq 0.75 .rdata:0000000000A06BB8 dq 0.8 .rdata:0000000000A06BC0 dq 0.8333333333333334 .rdata:0000000000A06BC8 dq 0.8571428571428571 .rdata:0000000000A06BD0 dq 0.875 .rdata:0000000000A06BD8 dq 0.8888888888888888 .rdata:0000000000A06BE0 dq 0.9 .rdata:0000000000A06BE8 dq 0.9090909090909091 .rdata:0000000000A06BF0 dq 0.9166666666666666 .rdata:0000000000A06BF8 dq 0.9230769230769231 .rdata:0000000000A06C00 dq 0.9285714285714286 .rdata:0000000000A06C08 dq 0.9333333333333333 .rdata:0000000000A06C10 dq 0.9375 .rdata:0000000000A06C18 dq 0.9411764705882353 .rdata:0000000000A06AE0 ArmorEnchantTable dq 0 ; DATA XREF: CItem__EnchantItem:loc_628E83↑r .rdata:0000000000A06AE8 dq 0 .rdata:0000000000A06AF0 dq 0 .rdata:0000000000A06AF8 dq 0.3333333333333333 .rdata:0000000000A06B00 dq 0.6666666666666666 .rdata:0000000000A06B08 dq 0.75 .rdata:0000000000A06B10 dq 0.8 .rdata:0000000000A06B18 dq 0.8333333333333334 .rdata:0000000000A06B20 dq 0.8571428571428571 .rdata:0000000000A06B28 dq 0.875 .rdata:0000000000A06B30 dq 0.8888888888888888 .rdata:0000000000A06B38 dq 0.9 .rdata:0000000000A06B40 dq 0.9090909090909091 .rdata:0000000000A06B48 dq 0.9166666666666666 .rdata:0000000000A06B50 dq 0.9230769230769231 .rdata:0000000000A06B58 dq 0.9285714285714286 .rdata:0000000000A06B60 dq 0.9333333333333333 .rdata:0000000000A06B68 dq 0.9375 .rdata:0000000000A06B70 dq 0.9411764705882353 .rdata:0000000000A06B78 dq 0.9444444444444444 Hey, thanks for the share. One question after reading the decompiled code, wouldn't WeaponEnchantTable better called FullBodyEnchantTable ? Since SlotType == 32768 for one piece armor, ( 32768 >> 15 & 1) evals to 1, which makes use of this table. It would also makes sense with the align 20h which makes the first value of this table be at the location used for the enchant level at 4 Other findings / value are otherwise in line with what was guessed regarding retail OE behavior, which seems fair Now I am wondering if the function changed in Gracia Final L2Server.exe :) Edited November 18, 2020 by ptitlaby Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.