server
server copied to clipboard
[sql+core] Move various exp table data into sql, add ENABLE_EXP_PET_PENALTY setting
I affirm:
- [x] I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
- [x] I have read and understood the Contributing Guide and the Code of Conduct.
- [x] 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?
Steps to test these changes
This will need testing in the following way:
- Extract the existing implementation into its own function.
- Alter the new implementation and the old one to take in just the player level, chain time, chain number, and before exp.
- It will return the new exp.
- Run the full list of levels, chain numbers, chain times etc. through it and make sure the before/afters match up exactly.
Then we know we're good to go
Same with the other functions/tables too I guess
Chain 3 for level 20 has an incorrect time value. It should be:
INSERT INTO `exp_chain_values` VALUES(20, 3, 1.30, 40000);
Since the table only goes up to pChainNumber 6, when the chainNumber is greater than 6 it is not defaulting to the base values as in the original switch statement.
You would have to break it up into two if statements if a match is found at 6 or before and one if its later.
This should return no errors in your Exp test harness. I did NOT test this manually in-game to see if the exp returns the same value but the values from the old and new return the same...therefore it should work.
void ApplyExpChainBonuses(uint8 mLvl, uint16& chainNumber, uint32& chainTime, float& exp, EMobDifficulty mobCheck, bool& chainactive)
{
if (mobCheck <= EMobDifficulty::DecentChallenge)
{
return;
}
if (chainTime > 0 || chainTime == 0)
{
chainactive = true;
}
else
{
chainNumber = 1;
}
auto mainLevel = mLvl;
auto applyExpMult = 1.00f;
// This will track if a match is found inside the table. If so, break.
bool foundMatch = false;
// Loop through the lookup and apply multipliers and times
for (auto& [upperLevel, pChainNumber, expMultiplier, pChainTime] : g_ExpChainValues)
{
if ((pChainNumber == chainNumber || pChainNumber == 6) && mainLevel <= upperLevel)
{
// Save this for later
applyExpMult = expMultiplier;
// Overwrite chainTime value as we find new valid ones
chainTime = 0 + pChainTime;
// Found a match!
foundMatch = true;
// If we've matched, we've matched at the soonest possible time.
// No point in iterating any more.
break;
}
}
// If no match was found and chainNumber is greater than 6, use chainNumber = 6 values
if (!foundMatch && chainNumber > 6)
{
for (auto& [upperLevel, pChainNumber, expMultiplier, pChainTime] : g_ExpChainValues)
{
if (pChainNumber == 6 && mainLevel <= upperLevel)
{
// Save this for later
applyExpMult = expMultiplier;
// Overwrite chainTime value as we find new valid ones
chainTime = 0 + pChainTime;
break;
}
}
}
// Only apply exp multiplier once
exp *= applyExpMult;
}
This code returns no warnings from thee test case.
I am not the greatest coder so there may be an easier way to do this. But that is the issue causing the values not to match.
Thanks @Frankie-hz! 👍
WTB Module to make these values era @Frankie-hz
This passed the test harness, needs actual in-game testing:
- General solo XP
- XP with a party member
- XP in a signet area
- XP in a signet area with a party member
- Some XP chains
- Testing out the setting multiplier I added
WTB Module to make these values era @Frankie-hz
I can probably do that next week, I’m away for the weekend.
Might be able to sneak it in this weekend.
I have the era-module done for the chaintime/exp - I can send it to you when I get home tonight.
If you feel like challenging yourself, you can try and PR it to the branch I'm currently working on: move_exp_sql
Ready for code review, still needs testing though
Almost a year later: @Frankie-hz, did you ever get a chance to test this a bit? I want to merge this and get it out from my pile of shame