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
  • 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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • L2 DEVS - HTML DESIGN (ALL NPC'S)    
    • I only share for free what they are reselling 🙂 You keep crying in all the publications, and if you are looking for h5 or gd wait for 5 or 6 years... cheers.... GENERAL Cached Extended to 8192kb IOBuffer Hair2SlotCache ItemBidAuctioner Clan Hall Current Olympiad Season Rank pages System (Shows Points/Games - Fully Configurable) Automatic Flag Around Raidboss System Offline Shop & Buffers Restore After Restart (Fixed location) Offline Buffer System PvP Auto Announce System Rebuilt with Extra Addons (Fully Configurable, Name, Zones, Rewards) Automatic Announce System Rebuilt with Extra Addons (Fully Configurable) ALT+B Augmentation House Shift+Click Droplist/Spoil List Epic Items Rank RB points Rank ChangeColorName ChangeColorTitle Change Skin (Race) Change Gender Custom Subclass (Acumulative) Achievements Item Delivery System  Augmentations/Enchants Automatic Announce System Auto Learn Skills PvP Reward Pk Reward War Reward Scheme buffer GlobalChatTrade Trade Augment Items Castle Announce Time Castle Standby Time Fix Spiritshots delay SpellbooksDrop Enable/Disable Drop custom Fully configurable, lvl min max allmobs, allrb, individual New cancel effect min,max BlessedarmorEnchantRate BlessedmagicWeaponEnchantRate BlessednormalWeaponEnchantRate MaxSlosChars MaxSlotsDwarfs Enable or disable all commands Fix fast loading npc OlympiadRestoreStatsOnFightStart OlympiadSystemSecondTimeEnabled OlympiadEnterLast10Minute OlympiadThirdClassSummons MinLevelTrade AnnounceSubClassMsg1 AnnounceSubClassMsg2 AnnounceSubClassMsg3 LimitedSubClassRace NoSellItems Change ID SealStones for AA NoPrivateBuyItems NoDropPlayerOnDie DisableSkillEnchantData Show Level Mobs Show npc clan flag DespawnSummonEnBattle SummonPetEnBattle RideSummonPetEnBattle DitanceToTargetMove EnterWorld_Undying EnterWorld_UnHide BlockWhispMessagePlayerToGM UseItemsWithHide CriticalSkillDamageBonusPer=4.0 Disable SSQSystem OnCastle Siege End Use any dyes Buy halls directly in auctioneer without waiting for the auction, configuration to change the item you consume MensajeEnterWorldServer Command .hero enable/disable hero aura Config vip global chat character, chat by systemsg Soulshots: NoSendSystemMessageUse Panel //admin Global vote reward Agathions system Anti Interface, control all patch files by md5 Command .menu configurable, last restart, name, maxusers, privatestores Spawn protection activate deactivate consume items to activate  Activate or deactivate autoloot for vip characters EVENTS Happy Hour Event reworked Configurable by announcements or systemsg Team VS Team Capture The Flag Death Match Last Man Standing Destroy The Base Korean Style Castle Siege Check if the player is inside the tvt event due to disconnection/critical error Top 1/5 killer reward/announce TimeAfk ResetReuseSkills ResetBuffsOnFinish Firework effect Reward win/lost Add Team Location Title custom Red/blue Open Door/Wall System BalanceBishops Show kills in title Invest positions Show Death To Top Delete Non-Subclass Skills     RELOADS Reload Enterworld Html Option Reload Faction System Reload Donate Shop Reload OfflineBuffer Reload Champion NPC Reload CliExt Reload AntiBot Reload Vip System Reload Auction Reload AutoLoot Reload CastleSiegeManager Reload CharacterLock Reload ClanPvPStatus Reload AutoLearn Reload ClanReputationRank Reload ClanSystem Reload CreatureAction Reload Customs.ini Reload L2server.ini Reload SkillData.txt Reload doordata.txt Reload decodata.txt Reload Multisell Reload DropList   Extender tested for more than 3 years. Assured stability. Possibility of adding MOD's upon request. (Not included, consult).
    • some peoples trash is another mans treasure, is that your treasure?   people might like the content but you are still the rat in the room     thats the community judging you.  
    • Keep reselling what I publish here for free!!! 🙂 GG  
  • Topics

×
×
  • Create New...