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

fix: preserve decimal precision for skill percentage calculation #3207

Merged

Conversation

jeansouzak
Copy link
Contributor

Description

This PR fixes an issue where skill progress percentages were being rounded to the nearest integer, resulting in a loss of precision. The newPercent variable in addSkillAdvance was changed from uint32_t to double_t to retain decimal values. This ensures accurate feedback for players regarding their skill progress.

Behaviour

Actual

When skill progress increases, the displayed percentage is rounded to the nearest integer (e.g., 93.24% was shown as 93%).

Expected

When skill progress increases, the displayed percentage should include decimal values (e.g., 93.24% is shown as 93.24%).

skill-percent-decimal-progress.mp4

Fixes #2430

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

This change was tested by simulating skill progress updates in the game. Logs were used to verify that the percentage now retains decimal values. The issue was resolved when the correct percentage (e.g., 93.24%) was displayed instead of a rounded integer.

  • Login and check skill progress is right
  • Skill progress update when increase skill tries attacking some monster with a weapon skill

Test Configuration:

  • Server Version: 13.40
  • Client: cipsoft client
  • Operating Server (docker ubuntu), Client (Windows):

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

- Changed `newPercent` in `addSkillAdvance` from `uint32_t` to `double_t` to prevent truncation of decimal values.
- Ensured that skill progress percentages are accurately calculated and displayed with decimals.

This fix resolves the issue where skill percentages were rounded to the nearest integer, improving feedback accuracy for players.
Copy link

sonarqubecloud bot commented Jan 2, 2025

@majestyotbr majestyotbr merged commit 8e6a4fd into opentibiabr:main Jan 2, 2025
24 checks passed
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.

SkillTries gain presents progression error
4 participants