mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 04:06:40 +00:00
Replace sSkillNameIds with ESM::Skill::mName
This commit is contained in:
parent
df57f8004b
commit
9c60a6fa4d
18 changed files with 107 additions and 91 deletions
|
@ -165,8 +165,8 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
text += "\n#{sType} ";
|
text += "\n#{sType} ";
|
||||||
|
|
||||||
int skill = MWMechanics::getWeaponType(ref->mBase->mData.mType)->mSkill;
|
const ESM::Skill* skill
|
||||||
const std::string& type = ESM::Skill::sSkillNameIds[skill];
|
= store.get<ESM::Skill>().find(MWMechanics::getWeaponType(ref->mBase->mData.mType)->mSkill);
|
||||||
std::string_view oneOrTwoHanded;
|
std::string_view oneOrTwoHanded;
|
||||||
if (weaponType->mWeaponClass == ESM::WeaponType::Melee)
|
if (weaponType->mWeaponClass == ESM::WeaponType::Melee)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ namespace MWClass
|
||||||
oneOrTwoHanded = "sOneHanded";
|
oneOrTwoHanded = "sOneHanded";
|
||||||
}
|
}
|
||||||
|
|
||||||
text += store.get<ESM::GameSetting>().find(type)->mValue.getString();
|
text += skill->mName;
|
||||||
if (!oneOrTwoHanded.empty())
|
if (!oneOrTwoHanded.empty())
|
||||||
text += ", " + store.get<ESM::GameSetting>().find(oneOrTwoHanded)->mValue.getString();
|
text += ", " + store.get<ESM::GameSetting>().find(oneOrTwoHanded)->mValue.getString();
|
||||||
|
|
||||||
|
|
|
@ -88,15 +88,16 @@ namespace MWGui
|
||||||
// We should not worsen corprus when in prison
|
// We should not worsen corprus when in prison
|
||||||
player.getClass().getCreatureStats(player).getActiveSpells().skipWorsenings(mDays * 24);
|
player.getClass().getCreatureStats(player).getActiveSpells().skipWorsenings(mDays * 24);
|
||||||
|
|
||||||
std::set<int> skills;
|
const auto& skillStore = MWBase::Environment::get().getESMStore()->get<ESM::Skill>();
|
||||||
|
std::set<const ESM::Skill*> skills;
|
||||||
for (int day = 0; day < mDays; ++day)
|
for (int day = 0; day < mDays; ++day)
|
||||||
{
|
{
|
||||||
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
||||||
int skill = Misc::Rng::rollDice(ESM::Skill::Length, prng);
|
const ESM::Skill* skill = skillStore.find(Misc::Rng::rollDice(ESM::Skill::Length, prng));
|
||||||
skills.insert(skill);
|
skills.insert(skill);
|
||||||
|
|
||||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
|
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill->mIndex);
|
||||||
if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak)
|
if (skill->mIndex == ESM::Skill::Security || skill->mIndex == ESM::Skill::Sneak)
|
||||||
value.setBase(std::min(100.f, value.getBase() + 1));
|
value.setBase(std::min(100.f, value.getBase() + 1));
|
||||||
else
|
else
|
||||||
value.setBase(std::max(0.f, value.getBase() - 1));
|
value.setBase(std::max(0.f, value.getBase() - 1));
|
||||||
|
@ -113,15 +114,14 @@ namespace MWGui
|
||||||
|
|
||||||
message = Misc::StringUtils::format(message, mDays);
|
message = Misc::StringUtils::format(message, mDays);
|
||||||
|
|
||||||
for (const int& skill : skills)
|
for (const ESM::Skill* skill : skills)
|
||||||
{
|
{
|
||||||
const std::string& skillName = gmst.find(ESM::Skill::sSkillNameIds[skill])->mValue.getString();
|
int skillValue = player.getClass().getNpcStats(player).getSkill(skill->mIndex).getBase();
|
||||||
int skillValue = player.getClass().getNpcStats(player).getSkill(skill).getBase();
|
|
||||||
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
||||||
if (skill == ESM::Skill::Sneak || skill == ESM::Skill::Security)
|
if (skill->mIndex == ESM::Skill::Sneak || skill->mIndex == ESM::Skill::Security)
|
||||||
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
|
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
|
||||||
|
|
||||||
skillMsg = Misc::StringUtils::format(skillMsg, skillName, skillValue);
|
skillMsg = Misc::StringUtils::format(skillMsg, skill->mName, skillValue);
|
||||||
message += "\n" + skillMsg;
|
message += "\n" + skillMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,10 +341,9 @@ namespace MWGui
|
||||||
|
|
||||||
for (const int& skillId : skills)
|
for (const int& skillId : skills)
|
||||||
{
|
{
|
||||||
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
|
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().search(skillId);
|
||||||
|
if (!skill) // Skip unknown skill indexes
|
||||||
continue;
|
continue;
|
||||||
assert(skillId >= 0 && skillId < ESM::Skill::Length);
|
|
||||||
const std::string& skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
|
||||||
const MWMechanics::SkillValue& stat = mSkillValues.find(skillId)->second;
|
const MWMechanics::SkillValue& stat = mSkillValues.find(skillId)->second;
|
||||||
int base = stat.getBase();
|
int base = stat.getBase();
|
||||||
int modified = stat.getModified();
|
int modified = stat.getModified();
|
||||||
|
@ -355,8 +354,7 @@ namespace MWGui
|
||||||
else if (modified < base)
|
else if (modified < base)
|
||||||
state = "decreased";
|
state = "decreased";
|
||||||
MyGUI::TextBox* widget = addValueItem(
|
MyGUI::TextBox* widget = addValueItem(
|
||||||
MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId),
|
skill->mName, MyGUI::utility::toString(static_cast<int>(modified)), state, coord1, coord2);
|
||||||
MyGUI::utility::toString(static_cast<int>(modified)), state, coord1, coord2);
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,10 +83,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (effect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
{
|
{
|
||||||
sourcesDescription += " (";
|
const ESM::Skill* skill = store->get<ESM::Skill>().find(effectInfo.mKey.mArg);
|
||||||
sourcesDescription += MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
sourcesDescription += " (" + skill->mName + ')';
|
||||||
ESM::Skill::sSkillNameIds[effectInfo.mKey.mArg], {});
|
|
||||||
sourcesDescription += ')';
|
|
||||||
}
|
}
|
||||||
if (effect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,8 +55,9 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect* magicEffect = store.get<ESM::MagicEffect>().find(effectId);
|
const ESM::MagicEffect* magicEffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||||
const ESM::Attribute* attribute = store.get<ESM::Attribute>().search(effect.mAttribute);
|
const ESM::Attribute* attribute = store.get<ESM::Attribute>().search(effect.mAttribute);
|
||||||
|
const ESM::Skill* skill = store.get<ESM::Skill>().search(effect.mSkill);
|
||||||
|
|
||||||
std::string fullEffectName = MWMechanics::getMagicEffectString(*magicEffect, attribute, effect.mSkill);
|
std::string fullEffectName = MWMechanics::getMagicEffectString(*magicEffect, attribute, skill);
|
||||||
std::string convert = Utf8Stream::lowerCaseUtf8(fullEffectName);
|
std::string convert = Utf8Stream::lowerCaseUtf8(fullEffectName);
|
||||||
if (convert.find(filter) != std::string::npos)
|
if (convert.find(filter) != std::string::npos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -510,8 +510,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
|
if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
|
||||||
continue;
|
continue;
|
||||||
const std::string& skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
|
||||||
|
|
||||||
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
|
||||||
|
|
||||||
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);
|
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);
|
||||||
|
@ -520,9 +518,8 @@ namespace MWGui
|
||||||
|
|
||||||
const ESM::Attribute* attr = esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
const ESM::Attribute* attr = esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
||||||
|
|
||||||
std::pair<MyGUI::TextBox*, MyGUI::TextBox*> widgets = addValueItem(
|
std::pair<MyGUI::TextBox*, MyGUI::TextBox*> widgets
|
||||||
MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId), {},
|
= addValueItem(skill->mName, {}, "normal", coord1, coord2);
|
||||||
"normal", coord1, coord2);
|
|
||||||
mSkillWidgetMap[skillId] = widgets;
|
mSkillWidgetMap[skillId] = widgets;
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
|
@ -530,7 +527,7 @@ namespace MWGui
|
||||||
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString("ToolTipType", "Layout");
|
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString("ToolTipType", "Layout");
|
||||||
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString("ToolTipLayout", "SkillToolTip");
|
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString("ToolTipLayout", "SkillToolTip");
|
||||||
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
||||||
"Caption_SkillName", "#{" + skillNameId + "}");
|
"Caption_SkillName", MyGUI::TextIterator::toTagsString(skill->mName));
|
||||||
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
||||||
"Caption_SkillDescription", skill->mDescription);
|
"Caption_SkillDescription", skill->mDescription);
|
||||||
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
mSkillWidgets[mSkillWidgets.size() - 1 - i]->setUserString(
|
||||||
|
@ -652,8 +649,8 @@ namespace MWGui
|
||||||
text += ", ";
|
text += ", ";
|
||||||
|
|
||||||
firstSkill = false;
|
firstSkill = false;
|
||||||
|
const ESM::Skill* skill = store.get<ESM::Skill>().find(faction->mData.mSkills[i]);
|
||||||
text += "#{" + ESM::Skill::sSkillNameIds[faction->mData.mSkills[i]] + "}";
|
text += MyGUI::TextIterator::toTagsString(skill->mName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
#include <MyGUI_InputManager.h>
|
#include <MyGUI_InputManager.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
#include <MyGUI_TextIterator.h>
|
||||||
|
|
||||||
#include <components/esm/records.hpp>
|
#include <components/esm/records.hpp>
|
||||||
#include <components/l10n/manager.hpp>
|
#include <components/l10n/manager.hpp>
|
||||||
|
@ -810,18 +811,14 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
||||||
|
|
||||||
const std::string& skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
|
||||||
const ESM::Skill* skill = store.get<ESM::Skill>().find(skillId);
|
const ESM::Skill* skill = store.get<ESM::Skill>().find(skillId);
|
||||||
assert(skill);
|
|
||||||
|
|
||||||
const ESM::Attribute* attr = store.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
const ESM::Attribute* attr = store.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
||||||
assert(attr);
|
|
||||||
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
||||||
|
|
||||||
widget->setUserString("ToolTipType", "Layout");
|
widget->setUserString("ToolTipType", "Layout");
|
||||||
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
|
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
|
||||||
widget->setUserString("Caption_SkillNoProgressName", "#{" + skillNameId + "}");
|
widget->setUserString("Caption_SkillNoProgressName", MyGUI::TextIterator::toTagsString(skill->mName));
|
||||||
widget->setUserString("Caption_SkillNoProgressDescription", skill->mDescription);
|
widget->setUserString("Caption_SkillNoProgressDescription", skill->mDescription);
|
||||||
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
|
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
|
||||||
widget->setUserString("ImageTexture_SkillNoProgressImage", icon);
|
widget->setUserString("ImageTexture_SkillNoProgressImage", icon);
|
||||||
|
@ -853,16 +850,16 @@ namespace MWGui
|
||||||
const MWWorld::Store<ESM::Skill>& skills = MWBase::Environment::get().getESMStore()->get<ESM::Skill>();
|
const MWWorld::Store<ESM::Skill>& skills = MWBase::Environment::get().getESMStore()->get<ESM::Skill>();
|
||||||
|
|
||||||
bool isFirst = true;
|
bool isFirst = true;
|
||||||
for (auto& skillPair : skills)
|
for (const auto& [_, skill] : skills)
|
||||||
{
|
{
|
||||||
if (skillPair.second.mData.mSpecialization == specId)
|
if (skill.mData.mSpecialization == specId)
|
||||||
{
|
{
|
||||||
if (isFirst)
|
if (isFirst)
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
else
|
else
|
||||||
specText += "\n";
|
specText += "\n";
|
||||||
|
|
||||||
specText += std::string("#{") + ESM::Skill::sSkillNameIds[skillPair.first] + "}";
|
specText += MyGUI::TextIterator::toTagsString(skill.mName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
widget->setUserString("Caption_ColumnText", specText);
|
widget->setUserString("Caption_ColumnText", specText);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_TextIterator.h>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -97,8 +98,9 @@ namespace MWGui
|
||||||
|
|
||||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
||||||
|
|
||||||
const MWWorld::Store<ESM::GameSetting>& gmst
|
const auto& store = MWBase::Environment::get().getESMStore();
|
||||||
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting>& gmst = store->get<ESM::GameSetting>();
|
||||||
|
const MWWorld::Store<ESM::Skill>& skillStore = store->get<ESM::Skill>();
|
||||||
|
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
||||||
|
|
||||||
|
@ -118,8 +120,9 @@ namespace MWGui
|
||||||
button->setUserData(skills[i].first);
|
button->setUserData(skills[i].first);
|
||||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
||||||
|
|
||||||
|
const ESM::Skill* skill = skillStore.find(skills[i].first);
|
||||||
button->setCaptionWithReplacing(
|
button->setCaptionWithReplacing(
|
||||||
"#{" + ESM::Skill::sSkillNameIds[skills[i].first] + "} - " + MyGUI::utility::toString(price));
|
MyGUI::TextIterator::toTagsString(skill->mName) + " - " + MyGUI::utility::toString(price));
|
||||||
|
|
||||||
button->setSize(button->getTextSize().width + 12, button->getSize().height);
|
button->setSize(button->getTextSize().width + 12, button->getSize().height);
|
||||||
|
|
||||||
|
|
|
@ -60,16 +60,11 @@ namespace MWGui::Widgets
|
||||||
{
|
{
|
||||||
if (mSkillNameWidget)
|
if (mSkillNameWidget)
|
||||||
{
|
{
|
||||||
if (mSkillId == ESM::Skill::Length)
|
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().search(mSkillId);
|
||||||
{
|
if (skill == nullptr)
|
||||||
mSkillNameWidget->setCaption({});
|
mSkillNameWidget->setCaption({});
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
mSkillNameWidget->setCaption(skill->mName);
|
||||||
MyGUI::UString name = toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
||||||
ESM::Skill::sSkillNameIds[mSkillId], {}));
|
|
||||||
mSkillNameWidget->setCaption(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mSkillValueWidget)
|
if (mSkillValueWidget)
|
||||||
{
|
{
|
||||||
|
@ -379,6 +374,7 @@ namespace MWGui::Widgets
|
||||||
|
|
||||||
const ESM::MagicEffect* magicEffect = store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);
|
const ESM::MagicEffect* magicEffect = store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);
|
||||||
const ESM::Attribute* attribute = store.get<ESM::Attribute>().search(mEffectParams.mAttribute);
|
const ESM::Attribute* attribute = store.get<ESM::Attribute>().search(mEffectParams.mAttribute);
|
||||||
|
const ESM::Skill* skill = store.get<ESM::Skill>().search(mEffectParams.mSkill);
|
||||||
|
|
||||||
assert(magicEffect);
|
assert(magicEffect);
|
||||||
|
|
||||||
|
@ -394,7 +390,7 @@ namespace MWGui::Widgets
|
||||||
std::string sec = " " + std::string{ windowManager->getGameSettingString("ssecond", {}) };
|
std::string sec = " " + std::string{ windowManager->getGameSettingString("ssecond", {}) };
|
||||||
std::string secs = " " + std::string{ windowManager->getGameSettingString("sseconds", {}) };
|
std::string secs = " " + std::string{ windowManager->getGameSettingString("sseconds", {}) };
|
||||||
|
|
||||||
std::string spellLine = MWMechanics::getMagicEffectString(*magicEffect, attribute, mEffectParams.mSkill);
|
std::string spellLine = MWMechanics::getMagicEffectString(*magicEffect, attribute, skill);
|
||||||
|
|
||||||
if (mEffectParams.mMagnMin || mEffectParams.mMagnMax)
|
if (mEffectParams.mMagnMin || mEffectParams.mMagnMax)
|
||||||
{
|
{
|
||||||
|
|
|
@ -569,7 +569,6 @@ std::vector<std::string> MWMechanics::Alchemy::effectsDescription(const MWWorld:
|
||||||
for (auto i = 0; i < 4; ++i)
|
for (auto i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
const auto effectID = data.mEffectID[i];
|
const auto effectID = data.mEffectID[i];
|
||||||
const auto skillID = data.mSkills[i];
|
|
||||||
|
|
||||||
if (alchemySkill < fWortChanceValue * (i + 1))
|
if (alchemySkill < fWortChanceValue * (i + 1))
|
||||||
break;
|
break;
|
||||||
|
@ -577,7 +576,8 @@ std::vector<std::string> MWMechanics::Alchemy::effectsDescription(const MWWorld:
|
||||||
if (effectID != -1)
|
if (effectID != -1)
|
||||||
{
|
{
|
||||||
const ESM::Attribute* attribute = store->get<ESM::Attribute>().search(data.mAttributes[i]);
|
const ESM::Attribute* attribute = store->get<ESM::Attribute>().search(data.mAttributes[i]);
|
||||||
std::string effect = getMagicEffectString(*mgef.find(effectID), attribute, skillID);
|
const ESM::Skill* skill = store->get<ESM::Skill>().search(data.mAttributes[i]);
|
||||||
|
std::string effect = getMagicEffectString(*mgef.find(effectID), attribute, skill);
|
||||||
|
|
||||||
effects.push_back(effect);
|
effects.push_back(effect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
const auto& store = MWBase::Environment::get().getESMStore();
|
const auto& store = MWBase::Environment::get().getESMStore();
|
||||||
const ESM::MagicEffect* magicEffect = store->get<ESM::MagicEffect>().search(mId);
|
const ESM::MagicEffect* magicEffect = store->get<ESM::MagicEffect>().search(mId);
|
||||||
return getMagicEffectString(*magicEffect, store->get<ESM::Attribute>().find(mArg), mArg);
|
return getMagicEffectString(
|
||||||
|
*magicEffect, store->get<ESM::Attribute>().search(mArg), store->get<ESM::Skill>().search(mArg));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const EffectKey& left, const EffectKey& right)
|
bool operator<(const EffectKey& left, const EffectKey& right)
|
||||||
|
@ -227,9 +228,10 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getMagicEffectString(const ESM::MagicEffect& effect, const ESM::Attribute* attribute, int skillArg)
|
std::string getMagicEffectString(
|
||||||
|
const ESM::MagicEffect& effect, const ESM::Attribute* attribute, const ESM::Skill* skill)
|
||||||
{
|
{
|
||||||
const bool targetsSkill = effect.mData.mFlags & ESM::MagicEffect::TargetSkill && skillArg != -1;
|
const bool targetsSkill = effect.mData.mFlags & ESM::MagicEffect::TargetSkill && skill;
|
||||||
const bool targetsAttribute = effect.mData.mFlags & ESM::MagicEffect::TargetAttribute && attribute;
|
const bool targetsAttribute = effect.mData.mFlags & ESM::MagicEffect::TargetAttribute && attribute;
|
||||||
|
|
||||||
std::string spellLine;
|
std::string spellLine;
|
||||||
|
@ -272,7 +274,7 @@ namespace MWMechanics
|
||||||
if (targetsSkill)
|
if (targetsSkill)
|
||||||
{
|
{
|
||||||
spellLine += ' ';
|
spellLine += ' ';
|
||||||
spellLine += windowManager->getGameSettingString(ESM::Skill::sSkillNameIds[skillArg], {});
|
spellLine += skill->mName;
|
||||||
}
|
}
|
||||||
else if (targetsAttribute)
|
else if (targetsAttribute)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace ESM
|
||||||
struct EffectList;
|
struct EffectList;
|
||||||
struct MagicEffect;
|
struct MagicEffect;
|
||||||
struct MagicEffects;
|
struct MagicEffects;
|
||||||
|
struct Skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
|
@ -114,7 +115,8 @@ namespace MWMechanics
|
||||||
///< Return changes from \a prev to \a now.
|
///< Return changes from \a prev to \a now.
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string getMagicEffectString(const ESM::MagicEffect& effect, const ESM::Attribute* attribute, int skillArg);
|
std::string getMagicEffectString(
|
||||||
|
const ESM::MagicEffect& effect, const ESM::Attribute* attribute, const ESM::Skill* skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include <components/misc/strings/format.hpp>
|
#include <components/misc/strings/format.hpp>
|
||||||
|
|
||||||
|
#include <MyGUI_TextIterator.h>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -259,8 +261,8 @@ void MWMechanics::NpcStats::increaseSkill(
|
||||||
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("skillraise"));
|
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("skillraise"));
|
||||||
|
|
||||||
std::string message{ MWBase::Environment::get().getWindowManager()->getGameSettingString("sNotifyMessage39", {}) };
|
std::string message{ MWBase::Environment::get().getWindowManager()->getGameSettingString("sNotifyMessage39", {}) };
|
||||||
message = Misc::StringUtils::format(
|
message
|
||||||
message, ("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}"), static_cast<int>(base));
|
= Misc::StringUtils::format(message, MyGUI::TextIterator::toTagsString(skill->mName), static_cast<int>(base));
|
||||||
|
|
||||||
if (readBook)
|
if (readBook)
|
||||||
message = "#{sBookSkillMessage}\n" + message;
|
message = "#{sBookSkillMessage}\n" + message;
|
||||||
|
|
|
@ -445,7 +445,7 @@ namespace MWWorld
|
||||||
for (const auto& [k, v] : mStoreImp->mIds)
|
for (const auto& [k, v] : mStoreImp->mIds)
|
||||||
mStoreImp->mStaticIds.emplace(k, v);
|
mStoreImp->mStaticIds.emplace(k, v);
|
||||||
|
|
||||||
getWritable<ESM::Skill>().setUp();
|
getWritable<ESM::Skill>().setUp(get<ESM::GameSetting>());
|
||||||
getWritable<ESM::MagicEffect>().setUp();
|
getWritable<ESM::MagicEffect>().setUp();
|
||||||
getWritable<ESM::Attribute>().setUp();
|
getWritable<ESM::Attribute>().setUp();
|
||||||
getWritable<ESM4::Land>().updateLandPositions(get<ESM4::Cell>());
|
getWritable<ESM4::Land>().updateLandPositions(get<ESM4::Cell>());
|
||||||
|
|
|
@ -901,6 +901,53 @@ namespace MWWorld
|
||||||
|
|
||||||
Store<ESM::Skill>::Store() {}
|
Store<ESM::Skill>::Store() {}
|
||||||
|
|
||||||
|
void Store<ESM::Skill>::setUp(const MWWorld::Store<ESM::GameSetting> settings)
|
||||||
|
{
|
||||||
|
constexpr std::string_view skillNameIds[ESM::Skill::Length] = {
|
||||||
|
"sSkillBlock",
|
||||||
|
"sSkillArmorer",
|
||||||
|
"sSkillMediumarmor",
|
||||||
|
"sSkillHeavyarmor",
|
||||||
|
"sSkillBluntweapon",
|
||||||
|
"sSkillLongblade",
|
||||||
|
"sSkillAxe",
|
||||||
|
"sSkillSpear",
|
||||||
|
"sSkillAthletics",
|
||||||
|
"sSkillEnchant",
|
||||||
|
"sSkillDestruction",
|
||||||
|
"sSkillAlteration",
|
||||||
|
"sSkillIllusion",
|
||||||
|
"sSkillConjuration",
|
||||||
|
"sSkillMysticism",
|
||||||
|
"sSkillRestoration",
|
||||||
|
"sSkillAlchemy",
|
||||||
|
"sSkillUnarmored",
|
||||||
|
"sSkillSecurity",
|
||||||
|
"sSkillSneak",
|
||||||
|
"sSkillAcrobatics",
|
||||||
|
"sSkillLightarmor",
|
||||||
|
"sSkillShortblade",
|
||||||
|
"sSkillMarksman",
|
||||||
|
"sSkillMercantile",
|
||||||
|
"sSkillSpeechcraft",
|
||||||
|
"sSkillHandtohand",
|
||||||
|
};
|
||||||
|
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||||
|
{
|
||||||
|
auto found = mStatic.find(i);
|
||||||
|
if (found != mStatic.end())
|
||||||
|
{
|
||||||
|
ESM::Skill& skill = found->second;
|
||||||
|
std::string_view id = skillNameIds[i];
|
||||||
|
const ESM::GameSetting* setting = settings.search(id);
|
||||||
|
if (setting && setting->mValue.getType() == ESM::VT_String)
|
||||||
|
skill.mName = setting->mValue.getString();
|
||||||
|
else
|
||||||
|
skill.mName = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Game Settings
|
// Game Settings
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,8 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Store();
|
Store();
|
||||||
|
|
||||||
|
void setUp(const MWWorld::Store<ESM::GameSetting> settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -36,35 +36,6 @@ namespace ESM
|
||||||
"Speechcraft",
|
"Speechcraft",
|
||||||
"Handtohand",
|
"Handtohand",
|
||||||
};
|
};
|
||||||
const std::string Skill::sSkillNameIds[Length] = {
|
|
||||||
"sSkillBlock",
|
|
||||||
"sSkillArmorer",
|
|
||||||
"sSkillMediumarmor",
|
|
||||||
"sSkillHeavyarmor",
|
|
||||||
"sSkillBluntweapon",
|
|
||||||
"sSkillLongblade",
|
|
||||||
"sSkillAxe",
|
|
||||||
"sSkillSpear",
|
|
||||||
"sSkillAthletics",
|
|
||||||
"sSkillEnchant",
|
|
||||||
"sSkillDestruction",
|
|
||||||
"sSkillAlteration",
|
|
||||||
"sSkillIllusion",
|
|
||||||
"sSkillConjuration",
|
|
||||||
"sSkillMysticism",
|
|
||||||
"sSkillRestoration",
|
|
||||||
"sSkillAlchemy",
|
|
||||||
"sSkillUnarmored",
|
|
||||||
"sSkillSecurity",
|
|
||||||
"sSkillSneak",
|
|
||||||
"sSkillAcrobatics",
|
|
||||||
"sSkillLightarmor",
|
|
||||||
"sSkillShortblade",
|
|
||||||
"sSkillMarksman",
|
|
||||||
"sSkillMercantile",
|
|
||||||
"sSkillSpeechcraft",
|
|
||||||
"sSkillHandtohand",
|
|
||||||
};
|
|
||||||
const std::string Skill::sIconNames[Length] = {
|
const std::string Skill::sIconNames[Length] = {
|
||||||
"combat_block.dds",
|
"combat_block.dds",
|
||||||
"combat_armor.dds",
|
"combat_armor.dds",
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace ESM
|
||||||
int mIndex;
|
int mIndex;
|
||||||
|
|
||||||
std::string mDescription;
|
std::string mDescription;
|
||||||
|
std::string mName;
|
||||||
|
|
||||||
enum SkillEnum
|
enum SkillEnum
|
||||||
{
|
{
|
||||||
|
@ -77,7 +78,6 @@ namespace ESM
|
||||||
Length
|
Length
|
||||||
};
|
};
|
||||||
static const std::string sSkillNames[Length];
|
static const std::string sSkillNames[Length];
|
||||||
static const std::string sSkillNameIds[Length];
|
|
||||||
static const std::string sIconNames[Length];
|
static const std::string sIconNames[Length];
|
||||||
|
|
||||||
static SkillEnum stringToSkillId(std::string_view skill);
|
static SkillEnum stringToSkillId(std::string_view skill);
|
||||||
|
|
Loading…
Reference in a new issue