Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Recent Update for recalculateStats() #5854

Closed
3 tasks done
FFXILevelDown opened this issue May 30, 2024 · 4 comments
Closed
3 tasks done

🐛 Recent Update for recalculateStats() #5854

FFXILevelDown opened this issue May 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@FFXILevelDown
Copy link

FFXILevelDown commented May 30, 2024

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my issue will be ignored.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated.

OS / platform the server is running (if known)

Windows 10

Branch affected by issue

base

Steps to reproduce

In a recent update player:recalculateStats() functionality was added to gear_set. Lua. Due to the positioning of the function, there are no checks as to when to activate this function so in turn it performs the recalculation on every piece of gear swapped out. The effect we are seeing is phantom crash's in the map.exe with no errors, lag when performing gear swaps via Ashitacast, received will spike between 1500-3000, phantom crashing on simple aspects as warping or home point due to movement gear swapping. This is just what we have seen from testing over the last week.

Expected behavior

Removed the player:recalculateStats() from within Scripts>Globals>Gear_sets to resolve Received spike between 1500-3000 due to gear swapping via ashitacast. After removing the function our spike holds around 300-400 based on zone and surroundings.

@FFXILevelDown FFXILevelDown added the bug Something isn't working label May 30, 2024
@zach2good
Copy link
Contributor

The PR in question: #5744

@zach2good
Copy link
Contributor

recalculateStats()

/************************************************************************
 *  Function: recalculateStats()
 *  Purpose : Recalculate the total Stats for a PC (force update)
 *  Example : target:recalculateStats()
 *  Notes   : See scripts/effects/obliviscence.lua
 ************************************************************************/

void CLuaBaseEntity::recalculateStats()
{
    if (m_PBaseEntity->objtype == TYPE_PC)
    {
        auto* PChar{ static_cast<CCharEntity*>(m_PBaseEntity) };

        jobpointutils::RefreshGiftMods(PChar);
        charutils::BuildingCharSkillsTable(PChar);
        charutils::CalculateStats(PChar);
        charutils::BuildingCharTraitsTable(PChar);
        charutils::CheckValidEquipment(PChar);
        charutils::BuildingCharAbilityTable(PChar);

        PChar->UpdateHealth();

        PChar->pushPacket(new CCharJobsPacket(PChar));
        PChar->pushPacket(new CCharStatsPacket(PChar));
        PChar->pushPacket(new CCharSkillsPacket(PChar));
        PChar->pushPacket(new CCharRecastPacket(PChar));
        PChar->pushPacket(new CCharAbilitiesPacket(PChar));
        PChar->pushPacket(new CCharUpdatePacket(PChar));
        PChar->pushPacket(new CMenuMeritPacket(PChar));
        PChar->pushPacket(new CMonipulatorPacket1(PChar));
        PChar->pushPacket(new CMonipulatorPacket2(PChar));
        PChar->pushPacket(new CCharSyncPacket(PChar));
        
    }
}

Called by xi.gear_sets.checkForGearSet

@claywar
Copy link
Contributor

claywar commented May 30, 2024

That's a very expensive function

@zach2good
Copy link
Contributor

I rolled back the PR in question so this will no longer happen 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants