Fix #161 fix craft success rate display on client

This commit is contained in:
nimetu 2014-09-10 15:40:32 +02:00
parent 0ac17f41ea
commit 5c5d798d00
3 changed files with 13 additions and 9 deletions

View file

@ -1688,29 +1688,30 @@ void CActionPhraseFaber::updateItemResult()
craftSuccessModifier = nodeCSM->getValue32(); craftSuccessModifier = nodeCSM->getValue32();
} }
// With the faber plan skill // 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; string successStr;
if( craftSuccessModifier == 0 ) if( bonus == 0 )
{ {
successStr = toString("@{FFFF}") + toString(success); successStr = toString("@{FFFF}") + toString(success);
} }
else else
if( craftSuccessModifier > 0 ) // bonus if( bonus > 0 ) // bonus
{ {
successStr = "@{0F0F}" + toString(success+craftSuccessModifier) successStr = "@{0F0F}" + toString(success + bonus)
+ "@{FFFF}(" + "@{FFFF}("
+ toString( success ) + toString( success )
+ "@{0F0F} + " + "@{0F0F} + "
+ toString( craftSuccessModifier ) + toString( bonus )
+ "@{FFFF})"; + "@{FFFF})";
} }
else else
{ {
successStr = "@{E42F}" + toString(success+craftSuccessModifier) successStr = "@{E42F}" + toString(success + bonus)
+ "@{FFFF}(" + "@{FFFF}("
+ toString( success ) + toString( success )
+ "@{E42F} - " + "@{E42F} - "
+ toString( craftSuccessModifier ) + toString( abs(bonus) )
+ "@{FFFF})"; + "@{FFFF})";
} }
strFindReplace(text, "%success", successStr ); strFindReplace(text, "%success", successStr );

View file

@ -1428,7 +1428,7 @@ sint CSPhraseManager::getPhraseSuccessRate(const CSPhraseCom &phrase)
} }
// *************************************************************************** // ***************************************************************************
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(); CSkillManager *pSM= CSkillManager::getInstance();
@ -1438,6 +1438,9 @@ sint CSPhraseManager::getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SK
// take skill value of the skill // take skill value of the skill
sint skillValue= pSM->getBestSkillValue(skill); sint skillValue= pSM->getBestSkillValue(skill);
// apply success rate modifier from server
skillValue += successModifier;
// return the sr according to this skill // return the sr according to this skill
return getPhraseSuccessRate(STCraft, phrase, skillValue, minMpLevel); return getPhraseSuccessRate(STCraft, phrase, skillValue, minMpLevel);
} }

View file

@ -338,7 +338,7 @@ public:
// Get the Phrase Success Rate % // Get the Phrase Success Rate %
sint getPhraseSuccessRate(const CSPhraseCom &phrase); sint getPhraseSuccessRate(const CSPhraseCom &phrase);
// Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for craft) // 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) // Get the Phrase Success Rate %. Manually gives the Skill to do the comparison (for Forage Extraction)
sint getForageExtractionPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill); sint getForageExtractionPhraseSuccessRate(const CSPhraseCom &phrase, SKILLS::ESkills skill);
// return the fmt according to forage terrain specializing // return the fmt according to forage terrain specializing