ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
330 stars 89 forks source link

fix craft success rate display on client #161

Closed ryzom-pipeline closed 9 years ago

ryzom-pipeline commented 10 years ago

Original report by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


Craft success rate modifier is modifying skill and not success % as client currently does.

#!c++
diff -r 673dd5483052 code/ryzom/client/src/interface_v3/action_phrase_faber.cpp
--- a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp        Sat Jun 21 22:32:49 2014 +0200
+++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp        Sat Jun 28 01:23:54 2014 +0300
@@ -1688,29 +1688,30 @@
                        craftSuccessModifier = nodeCSM->getValue32();
                }
                // With the faber plan skill
-               sint            success= pPM->getCraftPhraseSuccessRate(pPM->getPhrase(phraseSlot), _ExecuteFromItemPlanBrick->getSkill(), minLevel);
+               sint            success= pPM->getCraftPhraseSuccessRate(pPM->getPhrase(phraseSlot), _ExecuteFromItemPlanBrick->getSkill(), minLevel, 0);
+               sint            bonus = pPM->getCraftPhraseSuccessRate(pPM->getPhrase(phraseSlot), _ExecuteFromItemPlanBrick->getSkill(), minLevel, (sint) craftSuccessModifier) - success;
                string          successStr;
-               if( craftSuccessModifier == 0 )
+               if( bonus == 0 )
                {
                        successStr = toString("@{FFFF}") + toString(success);
                }
                else
-               if( craftSuccessModifier > 0 ) // bonus
+               if( bonus > 0 ) // bonus
                {
-                       successStr = "@{0F0F}" + toString(success+craftSuccessModifier)
+                       successStr = "@{0F0F}" + toString(success + bonus)
                                                        + "@{FFFF}("
                                                        + toString( success )
                                                        + "@{0F0F} + "
-                                                       + toString( craftSuccessModifier )
+                                                       + toString( bonus )
                                                        + "@{FFFF})";
                }
                else
                {
-                       successStr = "@{E42F}" + toString(success+craftSuccessModifier)
+                       successStr = "@{E42F}" + toString(success + bonus)
                                + "@{FFFF}("
                                + toString( success )
                                + "@{E42F} - "
-                               + toString( craftSuccessModifier )
+                               + toString( abs(bonus) )
                                + "@{FFFF})";
                }
                strFindReplace(text, "%success", successStr );
#!c++
diff -r 673dd5483052 code/ryzom/client/src/interface_v3/sphrase_manager.cpp
--- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp    Sat Jun 21 22:32:49 2014 +0200
+++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp    Sat Jun 28 01:23:54 2014 +0300
@@ -1428,7 +1428,7 @@
 }

 // ***************************************************************************
-sint                           CSPhraseManager::getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill, uint minMpLevel)
+sint                           CSPhraseManager::getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill, uint minMpLevel, sint successModifier)
 {
        CSkillManager   *pSM= CSkillManager::getInstance();

@@ -1438,6 +1438,9 @@
        // take skill value of the skill
        sint    skillValue= pSM->getBestSkillValue(skill);

+       // apply success rate modifier from server
+       skillValue += successModifier;
+
        // return the sr according to this skill
        return getPhraseSuccessRate(STCraft, phrase, skillValue, minMpLevel);
 }
diff -r 673dd5483052 code/ryzom/client/src/interface_v3/sphrase_manager.h
--- a/code/ryzom/client/src/interface_v3/sphrase_manager.h      Sat Jun 21 22:32:49 2014 +0200
+++ b/code/ryzom/client/src/interface_v3/sphrase_manager.h      Sat Jun 28 01:23:54 2014 +0300
@@ -338,7 +338,7 @@
        // Get the Phrase Success Rate %
        sint                            getPhraseSuccessRate(const CSPhraseCom &phrase);
        // Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for craft)
-       sint                            getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill, uint minMpLevel);
+       sint                            getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill, uint minMpLevel, sint successModifier);
        // Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for Forage Extraction)
        sint                            getForageExtractionPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill);
        // return the fmt according to forage terrain specializing
ryzom-pipeline commented 10 years ago

Original comment by Jan Boon (Bitbucket: [Jan Boon](https://bitbucket.org/Jan Boon), ).


Can you link the relevant server-side code to compare?

ryzom-pipeline commented 10 years ago

Original comment by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


https://bitbucket.org/ryzom/ryzomcore/src/673dd5483052b96d661855fb29db069ea68a5be9/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp?at=default#cl-95

ryzom-pipeline commented 10 years ago

Original comment by Jan Boon (Bitbucket: [Jan Boon](https://bitbucket.org/Jan Boon), ).


Looks ok. Might be good if someone else can do a double check, just to be sure?

ryzom-pipeline commented 9 years ago

Original comment by Jan Boon (Bitbucket: [Jan Boon](https://bitbucket.org/Jan Boon), ).


Can you attach the diffs as files? Bitbucket replaced tabs with spaces and it's not practical to apply this way. :)

ryzom-pipeline commented 9 years ago

Original comment by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


ryzom-pipeline commented 9 years ago

Original comment by Jan Boon (Bitbucket: [Jan Boon](https://bitbucket.org/Jan Boon), ).


Fix #161 fix craft success rate display on client