Fix #161 fix craft success rate display on client

This commit is contained in:
nimetu 2014-09-10 15:40:32 +02:00
parent ca79af60c6
commit 1a4c2169c5
3 changed files with 13 additions and 9 deletions

View file

@ -1688,29 +1688,30 @@ void CActionPhraseFaber::updateItemResult()
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 );

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();
@ -1438,6 +1438,9 @@ sint CSPhraseManager::getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SK
// 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);
}

View file

@ -338,7 +338,7 @@ public:
// 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