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

    • Hi everyone, Since I’m no longer interested in L2 servers, if anyone is willing to continue the project, let me know. I’m currently selling the entire project. DM me for more information if you’re genuinely interested. I can offer limited free support for the first couple of months. It is not cheap. The sale includes the domain, the recently fully redesigned website, the updater, the interface, server files with Lucera ext source, and the database (excluding account passwords, emails, and other private information; character data can remain).   Server for test: https://lineage2.gold/download Server Info: https://lineage2.gold/info Over 110 videos YouTube playlist: https://www.youtube.com/watch?v=HO7BZaxUv2U&list=PLD9WZ0Nj-zstZaYeWxAxTKbX7ia2M_DUu&index=113  
    • You invent yourself a life - bad for you, one of the inner core dev, fernandopm, which worked hard over aCis quests from 2011 to 2016 is argentinian. I teached him back in time to work and make proper quests. My dev team comes from 10+ countries and I'm myself french. "Racist/nationalist" card ? Not working bro.   Not sure why I should thank you to send me questions, and regarding bug reports, so far, I got none of yours in either discord, gitlab, or forums. I'm sorry if you feel "ignored", but that's more a psychanalyst you need to speak with if you put emotions towards someones' appreciation over a forum. I never ignore a bug report, and if so (like skills reports), it's because I got a bigger plan (skills refactor, in that case). In any case, I delivered cookies for the bug report/fix, even if it dated of months, with proper credits over changesets. "Victim card" ? Not really working, but ok, maybe you're "emotional".   I barely make money out of aCis, for the spent time - simply selling my services, or even coding/administrating a minecraft/L2J server would make far more money. Breaking intentionally things would be stupid. If you don't understand I'm not the only one working on that pack, I can't help you. Also, the scale of edits is sometimes extreme - AI L2OFF ? 1800 files added. How do you want everything works in a single shot ? "Exploiting noobz for money" card ? Still not working, or I'm a terrible businessman.   Meanwhile - you shadow advertise your project, L2JOne (since 2017 btw) - you should maybe start by the beginning saying you're a competitor and aCis is actually a spike in your foot. That also explains why you act like that. RusAcis got the exact same strategy, speaking bad of me, saying they got unique fixes (you speak about I break things, they break and recode things 4 times sometimes, btw), but successfully reselling latest revision with poorly executed stuff. "aCis is good, Tryskell is ok, but I solve all issues in extreme low time so I can piss over him" card ? Mmmmhhhh.   Our conversation ends here if you want, I don't force ppl to speak with me if they don't want - hopefully, people would understand I'm not the arrogant one and the one who doesn't want to talk, or even collaborate. :). I understand you got your own project and got no will to improve aCis.   NOTE : I'm extremely happy for your call of ExShowServerPrimitive with getValidGeoLocation, extremely impressive. Arrogant, no. Sarcastic ? Maybe.   Good night everyone.
    • Hi. @GX-Ext, svn does not work. is there anywhere else where we can get source code? Thank you so much.
  • 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