Skip to content

[C++] [lua] [sql] Migrate Experience Points Calculations to Lua#10865

Open
Skold177 wants to merge 1 commit into
LandSandBoat:basefrom
Skold177:Experience-Points.lua
Open

[C++] [lua] [sql] Migrate Experience Points Calculations to Lua#10865
Skold177 wants to merge 1 commit into
LandSandBoat:basefrom
Skold177:Experience-Points.lua

Conversation

@Skold177

@Skold177 Skold177 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

  • Migrates all experience points calculations into LUA (Referenced the JP Wiki and carefully copied over every function from core)
  • Moves base experience points table into LUA
  • Retires several experience points based settings, as this can all be easily changed now in modules.
  • Implements Sanction and leaves a TODO about its potency.

Testing Schedule - Complete! Tested and made sure everything was working on my local with debug prints using multiple clients.

[x] Party Share & Alliance Penalty
[x] Experience Points Chains (Brackets & Timers)
[x] Dedication Effects (EXP Rings)
[x] Corsairs Roll
[x] Signet Bonuses
[x] Sanction Bonuses
[x] RoV Bonuses

Steps to test these changes

Same as above!

@github-actions

Copy link
Copy Markdown

✨ Hello and thanks for the PR! ✨

🤖: This is a friendly automated reminder that the maintainers won't look at your PR until you've properly completed all of the checkboxes in the pre-filled template.

@Skold177
Skold177 force-pushed the Experience-Points.lua branch from 78ef5ad to b958b8d Compare July 23, 2026 02:19
@Skold177
Skold177 marked this pull request as ready for review July 23, 2026 03:22
@Skold177
Skold177 force-pushed the Experience-Points.lua branch 4 times, most recently from 1f4a34a to a2d6ae3 Compare July 23, 2026 15:42
@WinterSolstice8

Copy link
Copy Markdown
Contributor

This needs a rebase now

Comment thread src/map/utils/charutils.cpp Outdated
Comment on lines +5006 to +5012
const sol::object resultObj = result;
if (resultObj.get_type() != sol::type::table)
{
return;
}

exp = charutils::AddExpBonus(PMember, exp);
const sol::table calcResult = resultObj;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it actually necessary to redefine result as resultObj?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it actually necessary to redefine result as resultObj?

no, you're right, we can just use it directly here , rebasing now as well

Migrates Experience Points Calculations to LUA and retires many experience points settings. Adds support for Sanction.
@Skold177
Skold177 force-pushed the Experience-Points.lua branch from a2d6ae3 to 60120e7 Compare July 26, 2026 01:59
uint32 x = 0;
FOR_DB_MULTIPLE_RESULTS(rset)
// Base experience by level difference, from scripts/globals/experience_points.lua.
sol::table baseExpTable = lua["xi"]["experiencePoints"]["baseExpTable"];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bindings probably belong in in luautils, so we aren't reaching directly into the Lua state from far-flung areas of the code that don't need to be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bindings probably belong in in luautils, so we aren't reaching directly into the Lua state from far-flung areas of the code that don't need to be.

oh i see what you're saying, i'll move them over

"chainNumber", PMember->expChain.chainNumber,
"chainActive", chainActive);

const auto result = calculate(CLuaBaseEntity(PMember), CLuaBaseEntity(PMob), data);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a couple of outliers, the overwhelming majority of bindings like this belong in luautils.

The outliers:

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The not outliers:
image

@zach2good zach2good changed the title [C++] [lua] [sql] Migrate Experience Points Calculations to LUA [C++] [lua] [sql] Migrate Experience Points Calculations to Lua Jul 26, 2026
@Skold177
Skold177 force-pushed the Experience-Points.lua branch from 8b072be to 60120e7 Compare July 26, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants