Jump to content
  • 0

L2OFF Exp loss formula


Rootware

Question

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.

Link to comment
Share on other sites

Recommended Posts

  • 1
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
Link to comment
Share on other sites

  • 0

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 0

I don’t think you can find the original formula unless you dig enough with IDA, or get an idea from C1 since @MasterToma has already his own c1 sources

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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);
}

 

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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);
    }
  }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   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

    • hi, how did you solved the problem with nonpcname? Because i encountered the same problem
    • Dear Dexters of lineage2dex.com   Registration open, you can login on web panel, choose NEW-Interlude [x30] server and create game account 🚀 Server start - April 20 19:00 (UTC +3) 🕒 Beta start - April 16 ➡️ Server announce - https://forum.lineage2dex.com/threads/16624/ ➡️ Basic server description - https://forum.lineage2dex.com/threads/16520/ ➡️ Patchnotes (all changes from Union server) - https://forum.lineage2dex.com/threads/16630/ ➡️ Roadmap for Spring season - https://forum.lineage2dex.com/threads/16631/ 📢 April 16 - 19:00 (UTC +3) we start Beta on New season server!  ➡️ During beta test will be available OBT Manager (NPC Eva) in Giran with all necessary items for test. ➡️ We run 7signs in 1h cycle and Oly 24/7 ➡️ Server setup on Beta same, like will be on server start ➡️ On Beta will be restrictions for skill enchant lvl: 20 max for 2nd profession, 10 for 3rd profession ➡️ We strongly recommend visiting beta. Check the concept of the server before it start. View the NPC Buffer, Shop, Services. Files you can find here: https://lineage2dex.com/files Register Master Account (if you dont have it) - https://lineage2dex.com/reg You need download game client, run updater, choose NEW server and click repair. If you already have our game client, just make update in updater.  Or you can download updater unzip it on empty folder, run it, choose NEW server click repair - updater will download all necessary files to play. For NEW server, you need create new game account on WEB panel.
    • +27655767261 AUTHORISED DEALER OF HAGER WERKEN EMBALMING POWDER. in Johannesburg, Zimbabwe, South Africa, Zambia, Namibia, Angola. Hager weaken embalming powder is Used for preserving human remains by treating them (in its modern form with chemicals)to forestall decomposition. The intention is to keep them suitable for public display at a funeral, for religious reasons, or for medical and scientific purposes such as their use as anatomical specimens.[1] The three goals of embalming are sanitization, presentation and preservation (or restoration).Embalming has a very long and cross-cultural history, with many cultures giving the embalming processes a greater religious meaning. Specific uses are: sanitization, presentation and preservation (or restoration). Types of embalming powder are dependent on the purity and colour. PURITY ON   COLOR.  Pink 98%. White 100%, hot compound 100%. Radioactive and compound at more affordable prices. Call the Quality merchants at +27655767261. Hager weaken embalming powder price with discounts depending on the quantity and refine, Starting from one kilogram upwards. Originally made in Germany, Branded as Hager Weaken Brands Ltd. Only serious buyers should contact  customer service distributor on CALL +27655767261
    • +27655767261 AUTHORISED DEALER OF HAGER WERKEN EMBALMING POWDER. in Johannesburg, Zimbabwe, South Africa, Zambia, Namibia, Angola. Hager weaken embalming powder is Used for preserving human remains by treating them (in its modern form with chemicals)to forestall decomposition. The intention is to keep them suitable for public display at a funeral, for religious reasons, or for medical and scientific purposes such as their use as anatomical specimens.[1] The three goals of embalming are sanitization, presentation and preservation (or restoration).Embalming has a very long and cross-cultural history, with many cultures giving the embalming processes a greater religious meaning. Specific uses are: sanitization, presentation and preservation (or restoration). Types of embalming powder are dependent on the purity and colour. PURITY ON   COLOR.  Pink 98%. White 100%, hot compound 100%. Radioactive and compound at more affordable prices. Call the Quality merchants at +27655767261. Hager weaken embalming powder price with discounts depending on the quantity and refine, Starting from one kilogram upwards. Originally made in Germany, Branded as Hager Weaken Brands Ltd. Only serious buyers should contact  customer service distributor on CALL +27655767261
    • +27655767261 AUTHORISED DEALER OF HAGER WERKEN EMBALMING POWDER. in Johannesburg, Zimbabwe, South Africa, Zambia, Namibia, Angola. Hager weaken embalming powder is Used for preserving human remains by treating them (in its modern form with chemicals)to forestall decomposition. The intention is to keep them suitable for public display at a funeral, for religious reasons, or for medical and scientific purposes such as their use as anatomical specimens.[1] The three goals of embalming are sanitization, presentation and preservation (or restoration).Embalming has a very long and cross-cultural history, with many cultures giving the embalming processes a greater religious meaning. Specific uses are: sanitization, presentation and preservation (or restoration). Types of embalming powder are dependent on the purity and colour. PURITY ON   COLOR.  Pink 98%. White 100%, hot compound 100%. Radioactive and compound at more affordable prices. Call the Quality merchants at +27655767261. Hager weaken embalming powder price with discounts depending on the quantity and refine, Starting from one kilogram upwards. Originally made in Germany, Branded as Hager Weaken Brands Ltd. Only serious buyers should contact  customer service distributor on CALL +27655767261
  • Topics

×
×
  • Create New...