Jump to content

Recommended Posts

Posted (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 by guytis
Posted
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

  • 10 months later...
Posted (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+27Br
.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_628E83r
.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 :thumbs-up:

 

Now I am wondering if the function changed in Gracia Final L2Server.exe :)

Edited by ptitlaby

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code. 
    • Hello, well obviously i dont have access to the server side, and neither have those guys in the picture, i thought it was something client side since they manage to have that...    Here is another example, Its essence server btw  
    • So according to you, you found a bug so hidden that nobody can discover it — not even by analyzing the source code with modern tools.   Is that really what you're trying to say?   Because what you're basically claiming is that: The files contain an error But nobody can find it Nobody can fix it Not even by analyzing the code with tools like ChatGPT So… a magical invisible bug that only you can see.   Do you realize how absurd that sounds?   If there was actually a real problem, it would be very easy to demonstrate: Open the server. Show the error. Point to the exact place in the code where it happens.   But instead of doing that, the only thing you've done so far is write vague messages and say “I'll make a video.” Perfect. Go ahead and make the video. Show the error. Show the code.   Because up to this point, all we have here are accusations without a single piece of technical evidence. And in a development forum, that has absolutely no value.   Regards.   ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code.  ------------------------------------------------------------------------------------------------------   I would like to ask if a moderator or administrator could please review the thread and consider closing it.   The user involved keeps posting misleading statements and accusations without providing any technical proof. The discussion has stopped being a constructive technical conversation and has turned into repeated attempts to spread misinformation about the files.   Despite being asked multiple times to provide evidence (such as a reproducible error, logs, or code analysis), none has been presented. Instead, the thread continues with vague claims that only generate confusion within the community.   From my perspective, the purpose seems to be discouraging users from using the freely available files while promoting alternative products.   Since no technical evidence has been provided and the thread is no longer productive, I believe it would be better for the community if the discussion were closed.   Thank you for your time and attention.   Best regards. --------------------------------------------------------------------------------------------------------   ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code.   
    • What ChatGPT? Dont think ChatGPT will fix your problem :d You will never figure out where the problem actually is. Don’t try to twist things. Just open the server and write here.. i will make a video for you showing how everything goes to hell with “your files”
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..