void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<int>& value) { static const char *ids[] = { "AttribVal1", "AttribVal2", "AttribVal3", "AttribVal4", "AttribVal5", "AttribVal6", "AttribVal7", "AttribVal8", 0 }; for (int i=0; ids[i]; ++i) if (ids[i]==id) { std::ostringstream valueString; valueString << value.getModified(); setText (id, valueString.str()); if (value.getModified()>value.getBase()) setTextColor (id, 0, 1, 0); else if (value.getModified()<value.getBase()) setTextColor (id, 1, 0, 0); else setTextColor (id, 1, 1, 1); break; } }
void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<int>& value) { static const char *ids[] = { "AttribVal1", "AttribVal2", "AttribVal3", "AttribVal4", "AttribVal5", "AttribVal6", "AttribVal7", "AttribVal8", 0 }; for (int i=0; ids[i]; ++i) if (ids[i]==id) { std::ostringstream valueString; valueString << value.getModified(); setText (id, valueString.str()); MyGUI::TextBox* box; getWidget(box, id); if (value.getModified()>value.getBase()) box->_setWidgetState("increased"); else if (value.getModified()<value.getBase()) box->_setWidgetState("decreased"); else box->_setWidgetState("normal"); break; } }
void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<float>& value) { static struct {const char *id; ESM::Skill::SkillEnum skillId; } skillMap[] = { {"SkillBlock", ESM::Skill::Block}, {"SkillArmorer", ESM::Skill::Armorer}, {"SkillMediumArmor", ESM::Skill::MediumArmor}, {"SkillHeavyArmor", ESM::Skill::HeavyArmor}, {"SkillBluntWeapon", ESM::Skill::BluntWeapon}, {"SkillLongBlade", ESM::Skill::LongBlade}, {"SkillAxe", ESM::Skill::Axe}, {"SkillSpear", ESM::Skill::Spear}, {"SkillAthletics", ESM::Skill::Athletics}, {"SkillEnchant", ESM::Skill::Armorer}, {"SkillDestruction", ESM::Skill::Destruction}, {"SkillAlteration", ESM::Skill::Alteration}, {"SkillIllusion", ESM::Skill::Illusion}, {"SkillConjuration", ESM::Skill::Conjuration}, {"SkillMysticism", ESM::Skill::Mysticism}, {"SkillRestoration", ESM::Skill::Restoration}, {"SkillAlchemy", ESM::Skill::Alchemy}, {"SkillUnarmored", ESM::Skill::Unarmored}, {"SkillSecurity", ESM::Skill::Security}, {"SkillSneak", ESM::Skill::Sneak}, {"SkillAcrobatics", ESM::Skill::Acrobatics}, {"SkillLightArmor", ESM::Skill::LightArmor}, {"SkillShortBlade", ESM::Skill::ShortBlade}, {"SkillMarksman", ESM::Skill::Marksman}, {"SkillMercantile", ESM::Skill::Mercantile}, {"SkillSpeechcraft", ESM::Skill::Speechcraft}, {"SkillHandToHand", ESM::Skill::HandToHand}, }; for (size_t i = 0; i < sizeof(skillMap)/sizeof(skillMap[0]); ++i) { if (skillMap[i].id == id) { int skillId = skillMap[i].skillId; skillValues[skillId] = value; MyGUI::StaticTextPtr widget = skillWidgetMap[skillId]; if (widget) { float modified = value.getModified(), base = value.getBase(); std::string text = boost::lexical_cast<std::string>(std::floor(modified)); ColorStyle style = CS_Normal; if (modified > base) style = CS_Super; else if (modified < base) style = CS_Sub; setStyledText(widget, style, text); } break; } } }
void ReviewDialog::setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value) { skillValues[skillId] = value; MyGUI::StaticTextPtr widget = skillWidgetMap[skillId]; if (widget) { float modified = value.getModified(), base = value.getBase(); std::string text = boost::lexical_cast<std::string>(std::floor(modified)); ColorStyle style = CS_Normal; if (modified > base) style = CS_Super; else if (modified < base) style = CS_Sub; setStyledText(widget, style, text); } }
void StatsWindow::setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value) { skillValues[parSkill] = value; MyGUI::TextBox* widget = skillWidgetMap[(int)parSkill]; if (widget) { float modified = value.getModified(), base = value.getBase(); std::string text = boost::lexical_cast<std::string>(std::floor(modified)); std::string state = "normal"; if (modified > base) state = "increased"; else if (modified < base) state = "decreased"; widget->setCaption(text); widget->_setWidgetState(state); } }
void ReviewDialog::setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value) { mSkillValues[skillId] = value; MyGUI::TextBox* widget = mSkillWidgetMap[skillId]; if (widget) { float modified = value.getModified(), base = value.getBase(); std::string text = boost::lexical_cast<std::string>(std::floor(modified)); std::string state = "normal"; if (modified > base) state = "increased"; else if (modified < base) state = "decreased"; widget->setCaption(text); widget->_setWidgetState(state); } }