mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Revert use of string_view to std::string for effectIdTo* methods.
This commit is contained in:
parent
6cfc06d7d8
commit
4bf23f152b
@ -196,8 +196,7 @@ namespace MWGui
|
||||
mEffectImage->setImageTexture(Misc::ResourceHelpers::correctIconPath(
|
||||
effect->mIcon, MWBase::Environment::get().getResourceSystem()->getVFS()));
|
||||
|
||||
mEffectName->setCaptionWithReplacing(
|
||||
"#{" + std::string(ESM::MagicEffect::effectIdToGmstString(effect->mIndex)) + "}");
|
||||
mEffectName->setCaptionWithReplacing("#{" + ESM::MagicEffect::effectIdToGmstString(effect->mIndex) + "}");
|
||||
|
||||
mEffect.mEffectID = effect->mIndex;
|
||||
|
||||
|
@ -162,10 +162,10 @@ namespace MWGui
|
||||
image->setImageTexture(Misc::ResourceHelpers::correctIconPath(
|
||||
effect->mIcon, MWBase::Environment::get().getResourceSystem()->getVFS()));
|
||||
|
||||
std::string_view name = ESM::MagicEffect::effectIdToGmstString(effectId);
|
||||
const std::string& name = ESM::MagicEffect::effectIdToGmstString(effectId);
|
||||
|
||||
ToolTipInfo tooltipInfo;
|
||||
tooltipInfo.caption = "#{" + std::string(name) + "}";
|
||||
tooltipInfo.caption = "#{" + name + "}";
|
||||
tooltipInfo.icon = effect->mIcon;
|
||||
tooltipInfo.imageSize = 16;
|
||||
tooltipInfo.wordWrap = false;
|
||||
|
@ -954,7 +954,7 @@ namespace MWGui
|
||||
void ToolTips::createMagicEffectToolTip(MyGUI::Widget* widget, short id)
|
||||
{
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(id);
|
||||
std::string_view name = ESM::MagicEffect::effectIdToGmstString(id);
|
||||
const std::string& name = ESM::MagicEffect::effectIdToGmstString(id);
|
||||
|
||||
std::string icon = effect->mIcon;
|
||||
int slashPos = icon.rfind('\\');
|
||||
@ -963,7 +963,7 @@ namespace MWGui
|
||||
|
||||
widget->setUserString("ToolTipType", "Layout");
|
||||
widget->setUserString("ToolTipLayout", "MagicEffectToolTip");
|
||||
widget->setUserString("Caption_MagicEffectName", "#{" + std::string(name) + "}");
|
||||
widget->setUserString("Caption_MagicEffectName", "#{" + name + "}");
|
||||
widget->setUserString("Caption_MagicEffectDescription", effect->mDescription);
|
||||
widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + sSchoolNames[effect->mData.mSchool]);
|
||||
widget->setUserString("ImageTexture_MagicEffectImage", icon);
|
||||
|
@ -191,9 +191,9 @@ namespace MWLua
|
||||
|
||||
sol::table effect(context.mLua->sol(), sol::create);
|
||||
magicApi["EFFECT_TYPE"] = LuaUtil::makeStrictReadOnly(effect);
|
||||
for (const auto& it : ESM::MagicEffect::sEffectNames)
|
||||
for (const auto& name : ESM::MagicEffect::sEffectNames)
|
||||
{
|
||||
effect[it.second] = Misc::StringUtils::lowerCase(it.second);
|
||||
effect[name] = Misc::StringUtils::lowerCase(name);
|
||||
}
|
||||
|
||||
// Spell store
|
||||
@ -263,7 +263,7 @@ namespace MWLua
|
||||
auto effectParamsT = lua.new_usertype<ESM::ENAMstruct>("ESM3_EffectParams");
|
||||
effectParamsT[sol::meta_function::to_string] = [magicEffectStore](const ESM::ENAMstruct& params) {
|
||||
const ESM::MagicEffect* const rec = magicEffectStore->find(params.mEffectID);
|
||||
return "ESM3_EffectParams[" + std::string(ESM::MagicEffect::effectIdToGmstString(rec->mIndex)) + "]";
|
||||
return "ESM3_EffectParams[" + ESM::MagicEffect::effectIdToGmstString(rec->mIndex) + "]";
|
||||
};
|
||||
effectParamsT["effect"]
|
||||
= sol::readonly_property([magicEffectStore](const ESM::ENAMstruct& params) -> const ESM::MagicEffect* {
|
||||
@ -296,7 +296,7 @@ namespace MWLua
|
||||
auto magicEffectT = context.mLua->sol().new_usertype<ESM::MagicEffect>("ESM3_MagicEffect");
|
||||
|
||||
magicEffectT[sol::meta_function::to_string] = [](const ESM::MagicEffect& rec) {
|
||||
return "ESM3_MagicEffect[" + std::string(ESM::MagicEffect::effectIdToGmstString(rec.mIndex)) + "]";
|
||||
return "ESM3_MagicEffect[" + ESM::MagicEffect::effectIdToGmstString(rec.mIndex) + "]";
|
||||
};
|
||||
magicEffectT["id"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> std::string {
|
||||
auto name = ESM::MagicEffect::effectIdToName(rec.mIndex);
|
||||
@ -327,7 +327,7 @@ namespace MWLua
|
||||
auto activeEffectT = context.mLua->sol().new_usertype<ActiveEffect>("ActiveEffect");
|
||||
|
||||
activeEffectT[sol::meta_function::to_string] = [](const ActiveEffect& effect) {
|
||||
return "ActiveEffect[" + std::string(ESM::MagicEffect::effectIdToGmstString(effect.key.mId)) + "]";
|
||||
return "ActiveEffect[" + ESM::MagicEffect::effectIdToGmstString(effect.key.mId) + "]";
|
||||
};
|
||||
activeEffectT["id"] = sol::readonly_property([](const ActiveEffect& effect) -> std::string {
|
||||
auto name = ESM::MagicEffect::effectIdToName(effect.key.mId);
|
||||
|
@ -268,7 +268,7 @@ namespace MWMechanics
|
||||
|
||||
if (spellLine.empty())
|
||||
{
|
||||
std::string_view effectIDStr = ESM::MagicEffect::effectIdToGmstString(effect.mIndex);
|
||||
auto& effectIDStr = ESM::MagicEffect::effectIdToGmstString(effect.mIndex);
|
||||
spellLine = windowManager->getGameSettingString(effectIDStr, {});
|
||||
}
|
||||
|
||||
|
@ -352,307 +352,324 @@ namespace ESM
|
||||
}
|
||||
|
||||
// Map effect ID to GMST name
|
||||
const std::map<int, std::string> MagicEffect::sGmstEffectIds = {
|
||||
{ MagicEffect::AbsorbAttribute, "sEffectAbsorbAttribute" },
|
||||
{ MagicEffect::AbsorbFatigue, "sEffectAbsorbFatigue" },
|
||||
{ MagicEffect::AbsorbHealth, "sEffectAbsorbHealth" },
|
||||
{ MagicEffect::AbsorbMagicka, "sEffectAbsorbSpellPoints" },
|
||||
{ MagicEffect::AbsorbSkill, "sEffectAbsorbSkill" },
|
||||
{ MagicEffect::AlmsiviIntervention, "sEffectAlmsiviIntervention" },
|
||||
{ MagicEffect::Blind, "sEffectBlind" },
|
||||
{ MagicEffect::BoundBattleAxe, "sEffectBoundBattleAxe" },
|
||||
{ MagicEffect::BoundBoots, "sEffectBoundBoots" },
|
||||
{ MagicEffect::BoundCuirass, "sEffectBoundCuirass" },
|
||||
{ MagicEffect::BoundDagger, "sEffectBoundDagger" },
|
||||
{ MagicEffect::BoundGloves, "sEffectBoundGloves" },
|
||||
{ MagicEffect::BoundHelm, "sEffectBoundHelm" },
|
||||
{ MagicEffect::BoundLongbow, "sEffectBoundLongbow" },
|
||||
{ MagicEffect::ExtraSpell, "sEffectExtraSpell" },
|
||||
{ MagicEffect::BoundLongsword, "sEffectBoundLongsword" },
|
||||
{ MagicEffect::BoundMace, "sEffectBoundMace" },
|
||||
{ MagicEffect::BoundShield, "sEffectBoundShield" },
|
||||
{ MagicEffect::BoundSpear, "sEffectBoundSpear" },
|
||||
{ MagicEffect::Burden, "sEffectBurden" },
|
||||
{ MagicEffect::CalmCreature, "sEffectCalmCreature" },
|
||||
{ MagicEffect::CalmHumanoid, "sEffectCalmHumanoid" },
|
||||
{ MagicEffect::Chameleon, "sEffectChameleon" },
|
||||
{ MagicEffect::Charm, "sEffectCharm" },
|
||||
{ MagicEffect::CommandCreature, "sEffectCommandCreatures" },
|
||||
{ MagicEffect::CommandHumanoid, "sEffectCommandHumanoids" },
|
||||
{ MagicEffect::Corprus, "sEffectCorpus" }, // NB this typo. (bethesda made it)
|
||||
{ MagicEffect::CureBlightDisease, "sEffectCureBlightDisease" },
|
||||
{ MagicEffect::CureCommonDisease, "sEffectCureCommonDisease" },
|
||||
{ MagicEffect::CureCorprusDisease, "sEffectCureCorprusDisease" },
|
||||
{ MagicEffect::CureParalyzation, "sEffectCureParalyzation" },
|
||||
{ MagicEffect::CurePoison, "sEffectCurePoison" },
|
||||
{ MagicEffect::DamageAttribute, "sEffectDamageAttribute" },
|
||||
{ MagicEffect::DamageFatigue, "sEffectDamageFatigue" },
|
||||
{ MagicEffect::DamageHealth, "sEffectDamageHealth" },
|
||||
{ MagicEffect::DamageMagicka, "sEffectDamageMagicka" },
|
||||
{ MagicEffect::DamageSkill, "sEffectDamageSkill" },
|
||||
{ MagicEffect::DemoralizeCreature, "sEffectDemoralizeCreature" },
|
||||
{ MagicEffect::DemoralizeHumanoid, "sEffectDemoralizeHumanoid" },
|
||||
{ MagicEffect::DetectAnimal, "sEffectDetectAnimal" },
|
||||
{ MagicEffect::DetectEnchantment, "sEffectDetectEnchantment" },
|
||||
{ MagicEffect::DetectKey, "sEffectDetectKey" },
|
||||
{ MagicEffect::DisintegrateArmor, "sEffectDisintegrateArmor" },
|
||||
{ MagicEffect::DisintegrateWeapon, "sEffectDisintegrateWeapon" },
|
||||
{ MagicEffect::Dispel, "sEffectDispel" },
|
||||
{ MagicEffect::DivineIntervention, "sEffectDivineIntervention" },
|
||||
{ MagicEffect::DrainAttribute, "sEffectDrainAttribute" },
|
||||
{ MagicEffect::DrainFatigue, "sEffectDrainFatigue" },
|
||||
{ MagicEffect::DrainHealth, "sEffectDrainHealth" },
|
||||
{ MagicEffect::DrainMagicka, "sEffectDrainSpellpoints" },
|
||||
{ MagicEffect::DrainSkill, "sEffectDrainSkill" },
|
||||
{ MagicEffect::Feather, "sEffectFeather" },
|
||||
{ MagicEffect::FireDamage, "sEffectFireDamage" },
|
||||
{ MagicEffect::FireShield, "sEffectFireShield" },
|
||||
{ MagicEffect::FortifyAttack, "sEffectFortifyAttackBonus" },
|
||||
{ MagicEffect::FortifyAttribute, "sEffectFortifyAttribute" },
|
||||
{ MagicEffect::FortifyFatigue, "sEffectFortifyFatigue" },
|
||||
{ MagicEffect::FortifyHealth, "sEffectFortifyHealth" },
|
||||
{ MagicEffect::FortifyMagicka, "sEffectFortifySpellpoints" },
|
||||
{ MagicEffect::FortifyMaximumMagicka, "sEffectFortifyMagickaMultiplier" },
|
||||
{ MagicEffect::FortifySkill, "sEffectFortifySkill" },
|
||||
{ MagicEffect::FrenzyCreature, "sEffectFrenzyCreature" },
|
||||
{ MagicEffect::FrenzyHumanoid, "sEffectFrenzyHumanoid" },
|
||||
{ MagicEffect::FrostDamage, "sEffectFrostDamage" },
|
||||
{ MagicEffect::FrostShield, "sEffectFrostShield" },
|
||||
{ MagicEffect::Invisibility, "sEffectInvisibility" },
|
||||
{ MagicEffect::Jump, "sEffectJump" },
|
||||
{ MagicEffect::Levitate, "sEffectLevitate" },
|
||||
{ MagicEffect::Light, "sEffectLight" },
|
||||
{ MagicEffect::LightningShield, "sEffectLightningShield" },
|
||||
{ MagicEffect::Lock, "sEffectLock" },
|
||||
{ MagicEffect::Mark, "sEffectMark" },
|
||||
{ MagicEffect::NightEye, "sEffectNightEye" },
|
||||
{ MagicEffect::Open, "sEffectOpen" },
|
||||
{ MagicEffect::Paralyze, "sEffectParalyze" },
|
||||
{ MagicEffect::Poison, "sEffectPoison" },
|
||||
{ MagicEffect::RallyCreature, "sEffectRallyCreature" },
|
||||
{ MagicEffect::RallyHumanoid, "sEffectRallyHumanoid" },
|
||||
{ MagicEffect::Recall, "sEffectRecall" },
|
||||
{ MagicEffect::Reflect, "sEffectReflect" },
|
||||
{ MagicEffect::RemoveCurse, "sEffectRemoveCurse" },
|
||||
{ MagicEffect::ResistBlightDisease, "sEffectResistBlightDisease" },
|
||||
{ MagicEffect::ResistCommonDisease, "sEffectResistCommonDisease" },
|
||||
{ MagicEffect::ResistCorprusDisease, "sEffectResistCorprusDisease" },
|
||||
{ MagicEffect::ResistFire, "sEffectResistFire" },
|
||||
{ MagicEffect::ResistFrost, "sEffectResistFrost" },
|
||||
{ MagicEffect::ResistMagicka, "sEffectResistMagicka" },
|
||||
{ MagicEffect::ResistNormalWeapons, "sEffectResistNormalWeapons" },
|
||||
{ MagicEffect::ResistParalysis, "sEffectResistParalysis" },
|
||||
{ MagicEffect::ResistPoison, "sEffectResistPoison" },
|
||||
{ MagicEffect::ResistShock, "sEffectResistShock" },
|
||||
{ MagicEffect::RestoreAttribute, "sEffectRestoreAttribute" },
|
||||
{ MagicEffect::RestoreFatigue, "sEffectRestoreFatigue" },
|
||||
{ MagicEffect::RestoreHealth, "sEffectRestoreHealth" },
|
||||
{ MagicEffect::RestoreMagicka, "sEffectRestoreSpellPoints" },
|
||||
{ MagicEffect::RestoreSkill, "sEffectRestoreSkill" },
|
||||
{ MagicEffect::Sanctuary, "sEffectSanctuary" },
|
||||
{ MagicEffect::Shield, "sEffectShield" },
|
||||
{ MagicEffect::ShockDamage, "sEffectShockDamage" },
|
||||
{ MagicEffect::Silence, "sEffectSilence" },
|
||||
{ MagicEffect::SlowFall, "sEffectSlowFall" },
|
||||
{ MagicEffect::Soultrap, "sEffectSoultrap" },
|
||||
{ MagicEffect::Sound, "sEffectSound" },
|
||||
{ MagicEffect::SpellAbsorption, "sEffectSpellAbsorption" },
|
||||
{ MagicEffect::StuntedMagicka, "sEffectStuntedMagicka" },
|
||||
{ MagicEffect::SummonAncestralGhost, "sEffectSummonAncestralGhost" },
|
||||
{ MagicEffect::SummonBonelord, "sEffectSummonBonelord" },
|
||||
{ MagicEffect::SummonBonewalker, "sEffectSummonLeastBonewalker" },
|
||||
{ MagicEffect::SummonCenturionSphere, "sEffectSummonCenturionSphere" },
|
||||
{ MagicEffect::SummonClannfear, "sEffectSummonClannfear" },
|
||||
{ MagicEffect::SummonDaedroth, "sEffectSummonDaedroth" },
|
||||
{ MagicEffect::SummonDremora, "sEffectSummonDremora" },
|
||||
{ MagicEffect::SummonFlameAtronach, "sEffectSummonFlameAtronach" },
|
||||
{ MagicEffect::SummonFrostAtronach, "sEffectSummonFrostAtronach" },
|
||||
{ MagicEffect::SummonGoldenSaint, "sEffectSummonGoldenSaint" },
|
||||
{ MagicEffect::SummonGreaterBonewalker, "sEffectSummonGreaterBonewalker" },
|
||||
{ MagicEffect::SummonHunger, "sEffectSummonHunger" },
|
||||
{ MagicEffect::SummonScamp, "sEffectSummonScamp" },
|
||||
{ MagicEffect::SummonSkeletalMinion, "sEffectSummonSkeletalMinion" },
|
||||
{ MagicEffect::SummonStormAtronach, "sEffectSummonStormAtronach" },
|
||||
{ MagicEffect::SummonWingedTwilight, "sEffectSummonWingedTwilight" },
|
||||
{ MagicEffect::SunDamage, "sEffectSunDamage" },
|
||||
{ MagicEffect::SwiftSwim, "sEffectSwiftSwim" },
|
||||
{ MagicEffect::Telekinesis, "sEffectTelekinesis" },
|
||||
{ MagicEffect::TurnUndead, "sEffectTurnUndead" },
|
||||
{ MagicEffect::Vampirism, "sEffectVampirism" },
|
||||
{ MagicEffect::WaterBreathing, "sEffectWaterBreathing" },
|
||||
{ MagicEffect::WaterWalking, "sEffectWaterWalking" },
|
||||
{ MagicEffect::WeaknessToBlightDisease, "sEffectWeaknesstoBlightDisease" },
|
||||
{ MagicEffect::WeaknessToCommonDisease, "sEffectWeaknesstoCommonDisease" },
|
||||
{ MagicEffect::WeaknessToCorprusDisease, "sEffectWeaknesstoCorprusDisease" },
|
||||
{ MagicEffect::WeaknessToFire, "sEffectWeaknesstoFire" },
|
||||
{ MagicEffect::WeaknessToFrost, "sEffectWeaknesstoFrost" },
|
||||
{ MagicEffect::WeaknessToMagicka, "sEffectWeaknesstoMagicka" },
|
||||
{ MagicEffect::WeaknessToNormalWeapons, "sEffectWeaknesstoNormalWeapons" },
|
||||
{ MagicEffect::WeaknessToPoison, "sEffectWeaknesstoPoison" },
|
||||
{ MagicEffect::WeaknessToShock, "sEffectWeaknesstoShock" },
|
||||
const std::array<std::string, MagicEffect::Length> MagicEffect::sGmstEffectIds = {
|
||||
|
||||
// bloodmoon
|
||||
{ MagicEffect::SummonWolf, "sEffectSummonCreature01" },
|
||||
{ MagicEffect::SummonBear, "sEffectSummonCreature02" },
|
||||
{ MagicEffect::SummonBonewolf, "sEffectSummonCreature03" },
|
||||
{ MagicEffect::SummonCreature04, "sEffectSummonCreature04" },
|
||||
{ MagicEffect::SummonCreature05, "sEffectSummonCreature05" },
|
||||
"sEffectWaterBreathing",
|
||||
"sEffectSwiftSwim",
|
||||
"sEffectWaterWalking",
|
||||
"sEffectShield",
|
||||
"sEffectFireShield",
|
||||
"sEffectLightningShield",
|
||||
"sEffectFrostShield",
|
||||
"sEffectBurden",
|
||||
"sEffectFeather",
|
||||
"sEffectJump",
|
||||
"sEffectLevitate",
|
||||
"sEffectSlowFall",
|
||||
"sEffectLock",
|
||||
"sEffectOpen",
|
||||
"sEffectFireDamage",
|
||||
"sEffectShockDamage",
|
||||
"sEffectFrostDamage",
|
||||
"sEffectDrainAttribute",
|
||||
"sEffectDrainHealth",
|
||||
"sEffectDrainSpellpoints",
|
||||
"sEffectDrainFatigue",
|
||||
"sEffectDrainSkill",
|
||||
"sEffectDamageAttribute",
|
||||
"sEffectDamageHealth",
|
||||
"sEffectDamageMagicka",
|
||||
"sEffectDamageFatigue",
|
||||
"sEffectDamageSkill",
|
||||
"sEffectPoison",
|
||||
"sEffectWeaknesstoFire",
|
||||
"sEffectWeaknesstoFrost",
|
||||
"sEffectWeaknesstoShock",
|
||||
"sEffectWeaknesstoMagicka",
|
||||
"sEffectWeaknesstoCommonDisease",
|
||||
"sEffectWeaknesstoBlightDisease",
|
||||
"sEffectWeaknesstoCorprusDisease",
|
||||
"sEffectWeaknesstoPoison",
|
||||
"sEffectWeaknesstoNormalWeapons",
|
||||
"sEffectDisintegrateWeapon",
|
||||
"sEffectDisintegrateArmor",
|
||||
"sEffectInvisibility",
|
||||
"sEffectChameleon",
|
||||
"sEffectLight",
|
||||
"sEffectSanctuary",
|
||||
"sEffectNightEye",
|
||||
"sEffectCharm",
|
||||
"sEffectParalyze",
|
||||
"sEffectSilence",
|
||||
"sEffectBlind",
|
||||
"sEffectSound",
|
||||
"sEffectCalmHumanoid",
|
||||
"sEffectCalmCreature",
|
||||
"sEffectFrenzyHumanoid",
|
||||
"sEffectFrenzyCreature",
|
||||
"sEffectDemoralizeHumanoid",
|
||||
"sEffectDemoralizeCreature",
|
||||
"sEffectRallyHumanoid",
|
||||
"sEffectRallyCreature",
|
||||
"sEffectDispel",
|
||||
"sEffectSoultrap",
|
||||
"sEffectTelekinesis",
|
||||
"sEffectMark",
|
||||
"sEffectRecall",
|
||||
"sEffectDivineIntervention",
|
||||
"sEffectAlmsiviIntervention",
|
||||
"sEffectDetectAnimal",
|
||||
"sEffectDetectEnchantment",
|
||||
"sEffectDetectKey",
|
||||
"sEffectSpellAbsorption",
|
||||
"sEffectReflect",
|
||||
"sEffectCureCommonDisease",
|
||||
"sEffectCureBlightDisease",
|
||||
"sEffectCureCorprusDisease",
|
||||
"sEffectCurePoison",
|
||||
"sEffectCureParalyzation",
|
||||
"sEffectRestoreAttribute",
|
||||
"sEffectRestoreHealth",
|
||||
"sEffectRestoreSpellPoints",
|
||||
"sEffectRestoreFatigue",
|
||||
"sEffectRestoreSkill",
|
||||
"sEffectFortifyAttribute",
|
||||
"sEffectFortifyHealth",
|
||||
"sEffectFortifySpellpoints",
|
||||
"sEffectFortifyFatigue",
|
||||
"sEffectFortifySkill",
|
||||
"sEffectFortifyMagickaMultiplier",
|
||||
"sEffectAbsorbAttribute",
|
||||
"sEffectAbsorbHealth",
|
||||
"sEffectAbsorbSpellPoints",
|
||||
"sEffectAbsorbFatigue",
|
||||
"sEffectAbsorbSkill",
|
||||
"sEffectResistFire",
|
||||
"sEffectResistFrost",
|
||||
"sEffectResistShock",
|
||||
"sEffectResistMagicka",
|
||||
"sEffectResistCommonDisease",
|
||||
"sEffectResistBlightDisease",
|
||||
"sEffectResistCorprusDisease",
|
||||
"sEffectResistPoison",
|
||||
"sEffectResistNormalWeapons",
|
||||
"sEffectResistParalysis",
|
||||
"sEffectRemoveCurse",
|
||||
"sEffectTurnUndead",
|
||||
"sEffectSummonScamp",
|
||||
"sEffectSummonClannfear",
|
||||
"sEffectSummonDaedroth",
|
||||
"sEffectSummonDremora",
|
||||
"sEffectSummonAncestralGhost",
|
||||
"sEffectSummonSkeletalMinion",
|
||||
"sEffectSummonLeastBonewalker",
|
||||
"sEffectSummonGreaterBonewalker",
|
||||
"sEffectSummonBonelord",
|
||||
"sEffectSummonWingedTwilight",
|
||||
"sEffectSummonHunger",
|
||||
"sEffectSummonGoldenSaint",
|
||||
"sEffectSummonFlameAtronach",
|
||||
"sEffectSummonFrostAtronach",
|
||||
"sEffectSummonStormAtronach",
|
||||
"sEffectFortifyAttackBonus",
|
||||
"sEffectCommandCreatures",
|
||||
"sEffectCommandHumanoids",
|
||||
"sEffectBoundDagger",
|
||||
"sEffectBoundLongsword",
|
||||
"sEffectBoundMace",
|
||||
"sEffectBoundBattleAxe",
|
||||
"sEffectBoundSpear",
|
||||
"sEffectBoundLongbow",
|
||||
"sEffectExtraSpell",
|
||||
"sEffectBoundCuirass",
|
||||
"sEffectBoundHelm",
|
||||
"sEffectBoundBoots",
|
||||
"sEffectBoundShield",
|
||||
"sEffectBoundGloves",
|
||||
"sEffectCorpus", // NB this typo. (bethesda made it)
|
||||
"sEffectVampirism",
|
||||
"sEffectSummonCenturionSphere",
|
||||
"sEffectSunDamage",
|
||||
"sEffectStuntedMagicka",
|
||||
|
||||
// tribunal
|
||||
{ MagicEffect::SummonFabricant, "sEffectSummonFabricant" },
|
||||
"sEffectSummonFabricant",
|
||||
|
||||
// bloodmoon
|
||||
"sEffectSummonCreature01",
|
||||
"sEffectSummonCreature02",
|
||||
"sEffectSummonCreature03",
|
||||
"sEffectSummonCreature04",
|
||||
"sEffectSummonCreature05",
|
||||
};
|
||||
|
||||
// Map effect ID to identifying name
|
||||
const std::map<int, std::string> MagicEffect::sEffectNames = {
|
||||
{ MagicEffect::AbsorbAttribute, "AbsorbAttribute" },
|
||||
{ MagicEffect::AbsorbFatigue, "AbsorbFatigue" },
|
||||
{ MagicEffect::AbsorbHealth, "AbsorbHealth" },
|
||||
{ MagicEffect::AbsorbMagicka, "AbsorbMagicka" },
|
||||
{ MagicEffect::AbsorbSkill, "AbsorbSkill" },
|
||||
{ MagicEffect::AlmsiviIntervention, "AlmsiviIntervention" },
|
||||
{ MagicEffect::Blind, "Blind" },
|
||||
{ MagicEffect::BoundBattleAxe, "BoundBattleAxe" },
|
||||
{ MagicEffect::BoundBoots, "BoundBoots" },
|
||||
{ MagicEffect::BoundCuirass, "BoundCuirass" },
|
||||
{ MagicEffect::BoundDagger, "BoundDagger" },
|
||||
{ MagicEffect::BoundGloves, "BoundGloves" },
|
||||
{ MagicEffect::BoundHelm, "BoundHelm" },
|
||||
{ MagicEffect::BoundLongbow, "BoundLongbow" },
|
||||
{ MagicEffect::ExtraSpell, "ExtraSpell" },
|
||||
{ MagicEffect::BoundLongsword, "BoundLongsword" },
|
||||
{ MagicEffect::BoundMace, "BoundMace" },
|
||||
{ MagicEffect::BoundShield, "BoundShield" },
|
||||
{ MagicEffect::BoundSpear, "BoundSpear" },
|
||||
{ MagicEffect::Burden, "Burden" },
|
||||
{ MagicEffect::CalmCreature, "CalmCreature" },
|
||||
{ MagicEffect::CalmHumanoid, "CalmHumanoid" },
|
||||
{ MagicEffect::Chameleon, "Chameleon" },
|
||||
{ MagicEffect::Charm, "Charm" },
|
||||
{ MagicEffect::CommandCreature, "CommandCreature" },
|
||||
{ MagicEffect::CommandHumanoid, "CommandHumanoid" },
|
||||
{ MagicEffect::Corprus, "Corprus" },
|
||||
{ MagicEffect::CureBlightDisease, "CureBlightDisease" },
|
||||
{ MagicEffect::CureCommonDisease, "CureCommonDisease" },
|
||||
{ MagicEffect::CureCorprusDisease, "CureCorprusDisease" },
|
||||
{ MagicEffect::CureParalyzation, "CureParalyzation" },
|
||||
{ MagicEffect::CurePoison, "CurePoison" },
|
||||
{ MagicEffect::DamageAttribute, "DamageAttribute" },
|
||||
{ MagicEffect::DamageFatigue, "DamageFatigue" },
|
||||
{ MagicEffect::DamageHealth, "DamageHealth" },
|
||||
{ MagicEffect::DamageMagicka, "DamageMagicka" },
|
||||
{ MagicEffect::DamageSkill, "DamageSkill" },
|
||||
{ MagicEffect::DemoralizeCreature, "DemoralizeCreature" },
|
||||
{ MagicEffect::DemoralizeHumanoid, "DemoralizeHumanoid" },
|
||||
{ MagicEffect::DetectAnimal, "DetectAnimal" },
|
||||
{ MagicEffect::DetectEnchantment, "DetectEnchantment" },
|
||||
{ MagicEffect::DetectKey, "DetectKey" },
|
||||
{ MagicEffect::DisintegrateArmor, "DisintegrateArmor" },
|
||||
{ MagicEffect::DisintegrateWeapon, "DisintegrateWeapon" },
|
||||
{ MagicEffect::Dispel, "Dispel" },
|
||||
{ MagicEffect::DivineIntervention, "DivineIntervention" },
|
||||
{ MagicEffect::DrainAttribute, "DrainAttribute" },
|
||||
{ MagicEffect::DrainFatigue, "DrainFatigue" },
|
||||
{ MagicEffect::DrainHealth, "DrainHealth" },
|
||||
{ MagicEffect::DrainMagicka, "DrainMagicka" },
|
||||
{ MagicEffect::DrainSkill, "DrainSkill" },
|
||||
{ MagicEffect::Feather, "Feather" },
|
||||
{ MagicEffect::FireDamage, "FireDamage" },
|
||||
{ MagicEffect::FireShield, "FireShield" },
|
||||
{ MagicEffect::FortifyAttack, "FortifyAttack" },
|
||||
{ MagicEffect::FortifyAttribute, "FortifyAttribute" },
|
||||
{ MagicEffect::FortifyFatigue, "FortifyFatigue" },
|
||||
{ MagicEffect::FortifyHealth, "FortifyHealth" },
|
||||
{ MagicEffect::FortifyMagicka, "FortifyMagicka" },
|
||||
{ MagicEffect::FortifyMaximumMagicka, "FortifyMaximumMagicka" },
|
||||
{ MagicEffect::FortifySkill, "FortifySkill" },
|
||||
{ MagicEffect::FrenzyCreature, "FrenzyCreature" },
|
||||
{ MagicEffect::FrenzyHumanoid, "FrenzyHumanoid" },
|
||||
{ MagicEffect::FrostDamage, "FrostDamage" },
|
||||
{ MagicEffect::FrostShield, "FrostShield" },
|
||||
{ MagicEffect::Invisibility, "Invisibility" },
|
||||
{ MagicEffect::Jump, "Jump" },
|
||||
{ MagicEffect::Levitate, "Levitate" },
|
||||
{ MagicEffect::Light, "Light" },
|
||||
{ MagicEffect::LightningShield, "LightningShield" },
|
||||
{ MagicEffect::Lock, "Lock" },
|
||||
{ MagicEffect::Mark, "Mark" },
|
||||
{ MagicEffect::NightEye, "NightEye" },
|
||||
{ MagicEffect::Open, "Open" },
|
||||
{ MagicEffect::Paralyze, "Paralyze" },
|
||||
{ MagicEffect::Poison, "Poison" },
|
||||
{ MagicEffect::RallyCreature, "RallyCreature" },
|
||||
{ MagicEffect::RallyHumanoid, "RallyHumanoid" },
|
||||
{ MagicEffect::Recall, "Recall" },
|
||||
{ MagicEffect::Reflect, "Reflect" },
|
||||
{ MagicEffect::RemoveCurse, "RemoveCurse" },
|
||||
{ MagicEffect::ResistBlightDisease, "ResistBlightDisease" },
|
||||
{ MagicEffect::ResistCommonDisease, "ResistCommonDisease" },
|
||||
{ MagicEffect::ResistCorprusDisease, "ResistCorprusDisease" },
|
||||
{ MagicEffect::ResistFire, "ResistFire" },
|
||||
{ MagicEffect::ResistFrost, "ResistFrost" },
|
||||
{ MagicEffect::ResistMagicka, "ResistMagicka" },
|
||||
{ MagicEffect::ResistNormalWeapons, "ResistNormalWeapons" },
|
||||
{ MagicEffect::ResistParalysis, "ResistParalysis" },
|
||||
{ MagicEffect::ResistPoison, "ResistPoison" },
|
||||
{ MagicEffect::ResistShock, "ResistShock" },
|
||||
{ MagicEffect::RestoreAttribute, "RestoreAttribute" },
|
||||
{ MagicEffect::RestoreFatigue, "RestoreFatigue" },
|
||||
{ MagicEffect::RestoreHealth, "RestoreHealth" },
|
||||
{ MagicEffect::RestoreMagicka, "RestoreMagicka" },
|
||||
{ MagicEffect::RestoreSkill, "RestoreSkill" },
|
||||
{ MagicEffect::Sanctuary, "Sanctuary" },
|
||||
{ MagicEffect::Shield, "Shield" },
|
||||
{ MagicEffect::ShockDamage, "ShockDamage" },
|
||||
{ MagicEffect::Silence, "Silence" },
|
||||
{ MagicEffect::SlowFall, "SlowFall" },
|
||||
{ MagicEffect::Soultrap, "Soultrap" },
|
||||
{ MagicEffect::Sound, "Sound" },
|
||||
{ MagicEffect::SpellAbsorption, "SpellAbsorption" },
|
||||
{ MagicEffect::StuntedMagicka, "StuntedMagicka" },
|
||||
{ MagicEffect::SummonAncestralGhost, "SummonAncestralGhost" },
|
||||
{ MagicEffect::SummonBonelord, "SummonBonelord" },
|
||||
{ MagicEffect::SummonBonewalker, "SummonBonewalker" },
|
||||
{ MagicEffect::SummonCenturionSphere, "SummonCenturionSphere" },
|
||||
{ MagicEffect::SummonClannfear, "SummonClannfear" },
|
||||
{ MagicEffect::SummonDaedroth, "SummonDaedroth" },
|
||||
{ MagicEffect::SummonDremora, "SummonDremora" },
|
||||
{ MagicEffect::SummonFlameAtronach, "SummonFlameAtronach" },
|
||||
{ MagicEffect::SummonFrostAtronach, "SummonFrostAtronach" },
|
||||
{ MagicEffect::SummonGoldenSaint, "SummonGoldenSaint" },
|
||||
{ MagicEffect::SummonGreaterBonewalker, "SummonGreaterBonewalker" },
|
||||
{ MagicEffect::SummonHunger, "SummonHunger" },
|
||||
{ MagicEffect::SummonScamp, "SummonScamp" },
|
||||
{ MagicEffect::SummonSkeletalMinion, "SummonSkeletalMinion" },
|
||||
{ MagicEffect::SummonStormAtronach, "SummonStormAtronach" },
|
||||
{ MagicEffect::SummonWingedTwilight, "SummonWingedTwilight" },
|
||||
{ MagicEffect::SunDamage, "SunDamage" },
|
||||
{ MagicEffect::SwiftSwim, "SwiftSwim" },
|
||||
{ MagicEffect::Telekinesis, "Telekinesis" },
|
||||
{ MagicEffect::TurnUndead, "TurnUndead" },
|
||||
{ MagicEffect::Vampirism, "Vampirism" },
|
||||
{ MagicEffect::WaterBreathing, "WaterBreathing" },
|
||||
{ MagicEffect::WaterWalking, "WaterWalking" },
|
||||
{ MagicEffect::WeaknessToBlightDisease, "WeaknessToBlightDisease" },
|
||||
{ MagicEffect::WeaknessToCommonDisease, "WeaknessToCommonDisease" },
|
||||
{ MagicEffect::WeaknessToCorprusDisease, "WeaknessToCorprusDisease" },
|
||||
{ MagicEffect::WeaknessToFire, "WeaknessToFire" },
|
||||
{ MagicEffect::WeaknessToFrost, "WeaknessToFrost" },
|
||||
{ MagicEffect::WeaknessToMagicka, "WeaknessToMagicka" },
|
||||
{ MagicEffect::WeaknessToNormalWeapons, "WeaknessToNormalWeapons" },
|
||||
{ MagicEffect::WeaknessToPoison, "WeaknessToPoison" },
|
||||
{ MagicEffect::WeaknessToShock, "WeaknessToShock" },
|
||||
|
||||
// bloodmoon
|
||||
{ MagicEffect::SummonWolf, "SummonWolf" },
|
||||
{ MagicEffect::SummonBear, "SummonBear" },
|
||||
{ MagicEffect::SummonBonewolf, "SummonBonewolf" },
|
||||
{ MagicEffect::SummonCreature04, "SummonCreature04" },
|
||||
{ MagicEffect::SummonCreature05, "SummonCreature05" },
|
||||
const std::array<std::string, MagicEffect::Length> MagicEffect::sEffectNames = {
|
||||
"WaterBreathing",
|
||||
"SwiftSwim",
|
||||
"WaterWalking",
|
||||
"Shield",
|
||||
"FireShield",
|
||||
"LightningShield",
|
||||
"FrostShield",
|
||||
"Burden",
|
||||
"Feather",
|
||||
"Jump",
|
||||
"Levitate",
|
||||
"SlowFall",
|
||||
"Lock",
|
||||
"Open",
|
||||
"FireDamage",
|
||||
"ShockDamage",
|
||||
"FrostDamage",
|
||||
"DrainAttribute",
|
||||
"DrainHealth",
|
||||
"DrainMagicka",
|
||||
"DrainFatigue",
|
||||
"DrainSkill",
|
||||
"DamageAttribute",
|
||||
"DamageHealth",
|
||||
"DamageMagicka",
|
||||
"DamageFatigue",
|
||||
"DamageSkill",
|
||||
"Poison",
|
||||
"WeaknessToFire",
|
||||
"WeaknessToFrost",
|
||||
"WeaknessToShock",
|
||||
"WeaknessToMagicka",
|
||||
"WeaknessToCommonDisease",
|
||||
"WeaknessToBlightDisease",
|
||||
"WeaknessToCorprusDisease",
|
||||
"WeaknessToPoison",
|
||||
"WeaknessToNormalWeapons",
|
||||
"DisintegrateWeapon",
|
||||
"DisintegrateArmor",
|
||||
"Invisibility",
|
||||
"Chameleon",
|
||||
"Light",
|
||||
"Sanctuary",
|
||||
"NightEye",
|
||||
"Charm",
|
||||
"Paralyze",
|
||||
"Silence",
|
||||
"Blind",
|
||||
"Sound",
|
||||
"CalmHumanoid",
|
||||
"CalmCreature",
|
||||
"FrenzyHumanoid",
|
||||
"FrenzyCreature",
|
||||
"DemoralizeHumanoid",
|
||||
"DemoralizeCreature",
|
||||
"RallyHumanoid",
|
||||
"RallyCreature",
|
||||
"Dispel",
|
||||
"Soultrap",
|
||||
"Telekinesis",
|
||||
"Mark",
|
||||
"Recall",
|
||||
"DivineIntervention",
|
||||
"AlmsiviIntervention",
|
||||
"DetectAnimal",
|
||||
"DetectEnchantment",
|
||||
"DetectKey",
|
||||
"SpellAbsorption",
|
||||
"Reflect",
|
||||
"CureCommonDisease",
|
||||
"CureBlightDisease",
|
||||
"CureCorprusDisease",
|
||||
"CurePoison",
|
||||
"CureParalyzation",
|
||||
"RestoreAttribute",
|
||||
"RestoreHealth",
|
||||
"RestoreMagicka",
|
||||
"RestoreFatigue",
|
||||
"RestoreSkill",
|
||||
"FortifyAttribute",
|
||||
"FortifyHealth",
|
||||
"FortifyMagicka",
|
||||
"FortifyFatigue",
|
||||
"FortifySkill",
|
||||
"FortifyMaximumMagicka",
|
||||
"AbsorbAttribute",
|
||||
"AbsorbHealth",
|
||||
"AbsorbMagicka",
|
||||
"AbsorbFatigue",
|
||||
"AbsorbSkill",
|
||||
"ResistFire",
|
||||
"ResistFrost",
|
||||
"ResistShock",
|
||||
"ResistMagicka",
|
||||
"ResistCommonDisease",
|
||||
"ResistBlightDisease",
|
||||
"ResistCorprusDisease",
|
||||
"ResistPoison",
|
||||
"ResistNormalWeapons",
|
||||
"ResistParalysis",
|
||||
"RemoveCurse",
|
||||
"TurnUndead",
|
||||
"SummonScamp",
|
||||
"SummonClannfear",
|
||||
"SummonDaedroth",
|
||||
"SummonDremora",
|
||||
"SummonAncestralGhost",
|
||||
"SummonSkeletalMinion",
|
||||
"SummonBonewalker",
|
||||
"SummonGreaterBonewalker",
|
||||
"SummonBonelord",
|
||||
"SummonWingedTwilight",
|
||||
"SummonHunger",
|
||||
"SummonGoldenSaint",
|
||||
"SummonFlameAtronach",
|
||||
"SummonFrostAtronach",
|
||||
"SummonStormAtronach",
|
||||
"FortifyAttack",
|
||||
"CommandCreature",
|
||||
"CommandHumanoid",
|
||||
"BoundDagger",
|
||||
"BoundLongsword",
|
||||
"BoundMace",
|
||||
"BoundBattleAxe",
|
||||
"BoundSpear",
|
||||
"BoundLongbow",
|
||||
"ExtraSpell",
|
||||
"BoundCuirass",
|
||||
"BoundHelm",
|
||||
"BoundBoots",
|
||||
"BoundShield",
|
||||
"BoundGloves",
|
||||
"Corprus",
|
||||
"Vampirism",
|
||||
"SummonCenturionSphere",
|
||||
"SunDamage",
|
||||
"StuntedMagicka",
|
||||
|
||||
// tribunal
|
||||
{ MagicEffect::SummonFabricant, "SummonFabricant" },
|
||||
"SummonFabricant",
|
||||
|
||||
// bloodmoon
|
||||
"SummonWolf",
|
||||
"SummonBear",
|
||||
"SummonBonewolf",
|
||||
"SummonCreature04",
|
||||
"SummonCreature05",
|
||||
};
|
||||
|
||||
static std::map<std::string_view, int, Misc::StringUtils::CiComp> initStringToIntMap(
|
||||
const std::array<std::string, MagicEffect::Length>& strings)
|
||||
{
|
||||
std::map<std::string_view, int, Misc::StringUtils::CiComp> map;
|
||||
for (int i = 0; i < strings.size(); i++)
|
||||
map[strings[i]] = i;
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
const std::map<std::string_view, int, Misc::StringUtils::CiComp> MagicEffect::sGmstEffectIdToEffectIdMap
|
||||
= initStringToIntMap(MagicEffect::sGmstEffectIds);
|
||||
|
||||
const std::map<std::string_view, int, Misc::StringUtils::CiComp> MagicEffect::sEffectNameToEffectIdMap
|
||||
= initStringToIntMap(MagicEffect::sEffectNames);
|
||||
|
||||
class FindSecond
|
||||
{
|
||||
std::string_view mName;
|
||||
@ -712,40 +729,38 @@ namespace ESM
|
||||
mDescription.clear();
|
||||
}
|
||||
|
||||
std::string_view MagicEffect::effectIdToGmstString(int effectID)
|
||||
const std::string& MagicEffect::effectIdToGmstString(int effectID)
|
||||
{
|
||||
auto name = sGmstEffectIds.find(effectID);
|
||||
if (name == sGmstEffectIds.end())
|
||||
if (effectID >= sGmstEffectIds.size() || effectID < 0)
|
||||
throw std::runtime_error(std::string("Unimplemented effect ID ") + std::to_string(effectID));
|
||||
|
||||
return name->second;
|
||||
return sGmstEffectIds[effectID];
|
||||
}
|
||||
|
||||
std::string_view MagicEffect::effectIdToName(int effectID)
|
||||
const std::string& MagicEffect::effectIdToName(int effectID)
|
||||
{
|
||||
auto name = sEffectNames.find(effectID);
|
||||
if (name == sEffectNames.end())
|
||||
if (effectID >= sEffectNames.size() || effectID < 0)
|
||||
throw std::runtime_error(std::string("Unimplemented effect ID ") + std::to_string(effectID));
|
||||
|
||||
return name->second;
|
||||
return sEffectNames[effectID];
|
||||
}
|
||||
|
||||
int MagicEffect::effectNameToId(std::string_view effect)
|
||||
{
|
||||
auto name = std::find_if(sEffectNames.begin(), sEffectNames.end(), FindSecond(effect));
|
||||
if (name == sEffectNames.end())
|
||||
auto name = sEffectNameToEffectIdMap.find(effect);
|
||||
if (name == sEffectNameToEffectIdMap.end())
|
||||
throw std::runtime_error("Unimplemented effect " + std::string(effect));
|
||||
|
||||
return name->first;
|
||||
return name->second;
|
||||
}
|
||||
|
||||
int MagicEffect::effectGmstIdToId(std::string_view gmstId)
|
||||
{
|
||||
auto name = std::find_if(sGmstEffectIds.begin(), sGmstEffectIds.end(), FindSecond(gmstId));
|
||||
if (name == sGmstEffectIds.end())
|
||||
auto name = sGmstEffectIdToEffectIdMap.find(gmstId);
|
||||
if (name == sGmstEffectIdToEffectIdMap.end())
|
||||
throw std::runtime_error("Unimplemented effect " + std::string(gmstId));
|
||||
|
||||
return name->first;
|
||||
return name->second;
|
||||
}
|
||||
|
||||
RefId MagicEffect::indexToRefId(int index)
|
||||
|
@ -2,11 +2,13 @@
|
||||
#define OPENMW_ESM_MGEF_H
|
||||
|
||||
#include <map>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "components/esm/defs.hpp"
|
||||
#include "components/esm/refid.hpp"
|
||||
#include "components/misc/strings/algorithm.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
@ -264,10 +266,13 @@ namespace ESM
|
||||
Length
|
||||
};
|
||||
|
||||
static const std::map<int, std::string> sGmstEffectIds;
|
||||
static const std::map<int, std::string> sEffectNames;
|
||||
static std::string_view effectIdToGmstString(int effectID);
|
||||
static std::string_view effectIdToName(int effectID);
|
||||
static const std::array<std::string, Length> sGmstEffectIds;
|
||||
static const std::array<std::string, Length> sEffectNames;
|
||||
static const std::map<std::string_view, int, Misc::StringUtils::CiComp> sGmstEffectIdToEffectIdMap;
|
||||
static const std::map<std::string_view, int, Misc::StringUtils::CiComp> sEffectNameToEffectIdMap;
|
||||
|
||||
static const std::string& effectIdToGmstString(int effectID);
|
||||
static const std::string& effectIdToName(int effectID);
|
||||
static int effectNameToId(std::string_view effect);
|
||||
static int effectGmstIdToId(std::string_view gmstId);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user