Jump to content
  • 0

L2OFF Exp loss formula


Question

Posted

Anyone can tips me the formula for calculate death Exp loss for players? Or decompiled functions, or place where it calculates in L2OFF (L2Server.exe, CacheD.exe)?

 

Thanks in advance.

Recommended Posts

  • 1
Posted (edited)
double __cdecl GetExpDiePenalty(int level)
{
  double levelFactor; // st7@1

  levelFactor = 10.0 - (double)(level - 1) * 0.125;
  if ( levelFactor <= 4.0 )
  {
    levelFactor = 4.0;
  }
  return -((double)(g_expPenalty[level + 1] - g_expPenalty[level]) * (levelFactor * 0.01));
}
int g_expPenalty = {
0, // 0
0, // 1
68, // 2
363, // 3
1168, // 4
2884, // 5
6038, // 6
11287, // 7
19423, // 8
31378, // 9
48229, // 10
71202, // 11
101677, // 12
141193, // 13
191454, // 14
254330, // 15
331867, // 16
426288, // 17
540000, // 18
675596, // 19
835862, // 20
1023784, // 21
1242546, // 22
1495543, // 23
1786379, // 24
2118876, // 25
2497077, // 26
2925250, // 27
3407897, // 28
3949754, // 29
4555796, // 30
5231246, // 31
5981576, // 32
6812513, // 33
7730044, // 34
8740422, // 35
9850166, // 36
11066072, // 37
12395215, // 38
13844951, // 39
15422929, // 40
17137087, // 41
18995665, // 42
21007203, // 43
23180550, // 44
25524868, // 45
28049635, // 46
30764654, // 47
33680052, // 48
36806289, // 49
40154162, // 50
45525133, // 51
51262490, // 52
57383988, // 53
63907911, // 54
70853089, // 55
80700831, // 56
91162654, // 57
102265881, // 58
114038596, // 59
126509653, // 60
146308200, // 61
167244337, // 62
189364894, // 63
212717908, // 64
237352644, // 65
271975263, // 66
308443198, // 67
346827154, // 68
387199547, // 69
429634523, // 70
474207979, // 71
532694979, // 72
606322775, // 73
696381369, // 74
804225364, // 75
931275828, // 76
1108571463, // 77
1309482881, // 78
1535687304, // 79
1788937098, // 80
2071061777, // 81
0, // 82
};

C1 code right from IDA, for PvE. For PvP/PK/Sieges it's 1/4 of calculated value

Edited by MasterToma
  • 0
Posted

Hello, i try to help you

 

You can put it on a player action or creature action like "on die" and play with mathematics for the value of nExpDec

int User::ExpDown(int nExpDec)
{
	typedef int (*f)(User*, int);
	return f(0x8040F0L)(this, nExpDec);
}

void User::SetExpDown(int nExpDec)
{
	try
	{
		expDrop = nExpDec;
	}
	catch(...)
	{
		return;
	}
}

 

Dont let L2 OFF/PTS die!

  • 0
Posted
6 hours ago, Rootware said:

@Nevermind25 me need an formula, like baseLevelLossExp +levelLossModifier - skillLuckyExpPenaltyModifier .... Bla_Bla_BLa.

hmm if you think, the loss of experience is about a 4%. Then the calc must be down = 0.96 * Exp_of_the_current_level ? 

in the extenders, lin2panel and in other places you can find the exp table for each level. 

  • 0
Posted
7 hours ago, pada said:

i think Function User::GetDefaultExpDownValue Is what you are looking for

 

Where locates this function? L2Server.exe, CacheD.exe?

 

3 hours ago, Nevermind25 said:

hmm if you think, the loss of experience is about a 4%. Then the calc must be down = 0.96 * Exp_of_the_current_level ? 

in the extenders, lin2panel and in other places you can find the exp table for each level. 

 

At this moment, after L2OFF tests, i know what loss experience not static value and calculates from many conditions. I asked about formula for calculate this. I know what for exp loss also affected from clan wars, sieges, level loss %, clan skills, etc.

  • 0
Posted

L2Server.exe -> User::Die -> look for call to User::ExpDown and work your way back from there, you'd need to know asm pretty well and have a spare few days to figure it out, I don't have the time for academic endeavors such as that these days or I'd attempt it

 

If you're friendly with the advext guys you can bet they've already rewrote the whole User::Die func in a few of their exts (never been a fan of that style of working, porting whole func to C++ just for a small fix but hey to each their own), if they feeling nice maybe they'll give some info to you

  • 0
Posted

In C4 exe....


0x545280

double __fastcall GetExpDiePenalty(int level)
{
  double levelFactor; // xmm2_8

  levelFactor = 10.0 - (double)(level - 1) * 0.125;
  if ( levelFactor <= 4.0 )
    levelFactor = 4.0;
  return 0.0 - (double)(g_expPenalty[level] - g_expPenalty[level - 1]) * (levelFactor / 100.0);
}

 

  • 0
Posted (edited)

So, as expected - raw penalty formula in C4 is the same as in C1. Trick is, that calculated by GetExpDiePenalty() value is modified later on, taking into account other factors (it's only pve/pvp factors in C1, in C4 might be more)

Edited by MasterToma
  • 0
Posted

I have this in case it helps you.

  pSD = this_->base.d.pSD;
  nRace = pSD->nRace;
  nSex = pSD->nSex;
  nClass = pSD->nClass;
  nLevel = pSD->nLevel;
  nExp = pSD->nExp;
  if ( LOBYTE(this_->base.d.f_height_damage) && !dword_C6B880 )
  {
    if ( BYTE5(this_->base.d.shieldDefenceRate)
      && (v70 = v80, v71 = v81, v72 = v82, (v28 = sub_424B90(&unk_C476F0, &v70, 11)) != 0) )
    {
      ExpP1 = GetExpDiePenalty(this_->base.d.pSD->nLevel) * *(v28 + 432);
      this_->base.d.unk_BA0 = ExpP1;
      nExp = User::ExpDown(this_, ExpP1);
      v66 = *(v28 + 440);
    }
    else if ( v14 )
    {
      if ( v16 )
      {
        this_->base.d.unk_BA0 = 0;
      }
      else
      {
        ExpP2 = GetExpDiePenalty(this_->base.d.pSD->nLevel) * 0.25;
        this_->base.d.unk_BA0 = ExpP2;
        nExp = User::ExpDown(this_, ExpP2);
        if ( pEnemy_ )
        {
          pEnemyUser = (pEnemy_->vtable->base.base.MemoryObject__CastUser)(pEnemy_);
          if ( pEnemyUser )
          {
            pledge = User::GetPledge(pEnemyUser);
            pledge2 = User::GetPledge(this_);
            if ( pledge || pledge2 )
              CPledge::UpdateSiegeKillDeathPoint(pledge, pledge2);
          }
        }
      }
    }
    else
    {
      v34 = GetExpDiePenalty(this_->base.d.pSD->nLevel);
      this_->base.d.unk_BA0 = v34;
      nExp = User::ExpDown(this_, v34);
    }
  }

 

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

    • https://jmp.sh/MaCC5Gqa Combat animation synchronization: Bow/Sword. Added arrow flight and sword-to-monster effects.
    • The holidays are over and we’re back to work (well… we never really stopped 🙂 ). The server has been online without a single restart since December 26, running smoothly and without issues. That’s because we care, and we’ll keep caring. Many of us remember the old days: helping new players, building clans from zero, catching up together, and having fun without rushing. With that spirit in mind, Newbie Bonuses are now live and we strongly encourage everyone to help newcomers catch up and enjoy the journey. L2Elixir was never about short-term hype. It’s about community, stability, and bringing back what made Lineage II special.   🎁 Newbie Bonuses Characters created since December 25 & all new players receive a Newbie Box (Return Hero) (Rune EXP/SP +50% for 5 days, Random 48-hour Costume) 2nd Class Transfer cost reduced from 3kk to 1kk — join Academies! 3rd Class Transfer enabled, available only for classes already in the Hall of Fame. 🛡️ Anti-Bot Implemented BOT-CHECKER v2, more checks, and general improvements. Added extra checks during PvP. New Auto-Check system for suspicious behavior (penalties apply if third-party software is detected). Fixed Bot Report Button not refreshing. ⚙️ General After critical errors or force disconnects, characters will remain No Carrier for a few minutes. Added Cursed Bone to Helvetia (QoL). Enabled on-screen Clan War kill notifications. Fixed buff store issues when entering characters. Fixed party drop owner calculation (please report any issues). 🧙 NPCs Harit Lizardman, Grunt, and Archer now level up SC up to stage 5. 🎉 Events Fixed trigger skills not working during Events. Fixed Health / Shield packs not disappearing in some cases. Fixed summon remaining time not refreshing after Events. Added a second Team vs Team map to reduce routine. Added another Save the King map. Christmas Event cleanup completed. Players in Observe Mode can no longer register for Events. 📜 Quests Fate’s Whisper Fixed and corrected messages. Enchanted B-grade weapons can now be exchanged as per retail. Added missing Social Victory animation on quest completion. 🗺️ Geodata Fixed falling issues in Castle zones.   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs
    • NEW SEASON START 23.01.2026 Get ready for the ultimate High Five adventure on L2Exoplanet.net!   • The last two previous Seasons are now merged into the Core Server. • The Core Server remains our main long-term world. • All future Seasonal Servers will be merged into Core after they end. • No characters or items will be lost – everything stays safe!     GRAND OPENING:  23.01.2026 at 20:00 GMT+1 BETA TEST:    16.01.2026    Client: High Five Rates: x10   Website: https://l2exoplanet.net Facebook: https://www.facebook.com/L2-Exoplanet-106811564103836 Discord: https://discord.gg/4fzhW7ZSPc         Game Rates    Experience: x10  Skill Points: x10  Adena: x5  Drop: x8  Spoil: x8  Quest: x5  Raid Boss Drop: x5  Fame: x2  Epaulette: x8  Manor: x8      Safe Enchant: +3  Maximum Enchant: +16  Normal Scroll Chance: 60%  Blessed Scroll Chance: 63%  Attribute Stone Chance: 50%  Attribute Crystal Chance: 30%      Game Settings    Multibox - 3 game clients per HWID  Autoloot  Autolearn Skills Auto Farm  NPC Buffer   Buff Slots (24+4/12)  Buff Duration (2h)  Olympiad Period 7days (new heroes appear every monday)  Seven Signs Period  Class Transfer for Adena  Max Sub-Class 3  Sub-Class Max Level 85  Essence Interface  Champions System  Vote Reward System  Dayli Reward System  PC Points Reward (500PC = 1 Donate Coin)      Epic Bosses Respawn Times     Queen Ant:  24 Hours +/- 4 Hours   Beleth: 3 Days +/- 8 Hours   Baium: 3 Days +/- 8 Hours   Antharas: 4 Days +/- 8 Hours   Valakas:  5 Days +/- 8 Hours     Instance Info     Normal Freya = 6 Players   Hard Freya = 12 Players   Frintezza = 6 Players   Zaken 83 Day = 6 Players   Zaken 60 Day = 6 Players   Zaken Nightly = 9 Players   Tiat = 6 Players   Beleth = 12 Players
  • 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..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock