mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 10:13:06 +00:00
Remove SkillEnum
This commit is contained in:
parent
72f8f9d1ad
commit
65b22975c9
41 changed files with 185 additions and 209 deletions
|
|
@ -43,20 +43,13 @@ namespace MWClass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
switch (shield->getClass().getEquipmentSkill(*shield))
|
ESM::RefId skill = shield->getClass().getEquipmentSkill(*shield);
|
||||||
{
|
if (skill == ESM::Skill::LightArmor)
|
||||||
case ESM::Skill::LightArmor:
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Light Armor Hit"), 1.0f, 1.0f);
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Light Armor Hit"), 1.0f, 1.0f);
|
else if (skill == ESM::Skill::MediumArmor)
|
||||||
break;
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Medium Armor Hit"), 1.0f, 1.0f);
|
||||||
case ESM::Skill::MediumArmor:
|
else if (skill == ESM::Skill::HeavyArmor)
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Medium Armor Hit"), 1.0f, 1.0f);
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Heavy Armor Hit"), 1.0f, 1.0f);
|
||||||
break;
|
|
||||||
case ESM::Skill::HeavyArmor:
|
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Heavy Armor Hit"), 1.0f, 1.0f);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec3f Actor::getRotationVector(const MWWorld::Ptr& ptr) const
|
osg::Vec3f Actor::getRotationVector(const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ namespace MWClass
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Armor::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
ESM::RefId Armor::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeGmst.empty())
|
if (typeGmst.empty())
|
||||||
return -1;
|
return {};
|
||||||
|
|
||||||
const MWWorld::Store<ESM::GameSetting>& gmst
|
const MWWorld::Store<ESM::GameSetting>& gmst
|
||||||
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
|
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
|
||||||
|
|
@ -178,7 +178,7 @@ namespace MWClass
|
||||||
|
|
||||||
const ESM::RefId& Armor::getUpSoundId(const MWWorld::ConstPtr& ptr) const
|
const ESM::RefId& Armor::getUpSoundId(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
int es = getEquipmentSkill(ptr);
|
ESM::RefId es = getEquipmentSkill(ptr);
|
||||||
static const ESM::RefId lightUp = ESM::RefId::stringRefId("Item Armor Light Up");
|
static const ESM::RefId lightUp = ESM::RefId::stringRefId("Item Armor Light Up");
|
||||||
static const ESM::RefId mediumUp = ESM::RefId::stringRefId("Item Armor Medium Up");
|
static const ESM::RefId mediumUp = ESM::RefId::stringRefId("Item Armor Medium Up");
|
||||||
static const ESM::RefId heavyUp = ESM::RefId::stringRefId("Item Armor Heavy Up");
|
static const ESM::RefId heavyUp = ESM::RefId::stringRefId("Item Armor Heavy Up");
|
||||||
|
|
@ -193,7 +193,7 @@ namespace MWClass
|
||||||
|
|
||||||
const ESM::RefId& Armor::getDownSoundId(const MWWorld::ConstPtr& ptr) const
|
const ESM::RefId& Armor::getDownSoundId(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
int es = getEquipmentSkill(ptr);
|
ESM::RefId es = getEquipmentSkill(ptr);
|
||||||
static const ESM::RefId lightDown = ESM::RefId::stringRefId("Item Armor Light Down");
|
static const ESM::RefId lightDown = ESM::RefId::stringRefId("Item Armor Light Down");
|
||||||
static const ESM::RefId mediumDown = ESM::RefId::stringRefId("Item Armor Medium Down");
|
static const ESM::RefId mediumDown = ESM::RefId::stringRefId("Item Armor Medium Down");
|
||||||
static const ESM::RefId heavyDown = ESM::RefId::stringRefId("Item Armor Heavy Down");
|
static const ESM::RefId heavyDown = ESM::RefId::stringRefId("Item Armor Heavy Down");
|
||||||
|
|
@ -232,7 +232,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int armorType = getEquipmentSkill(ptr);
|
ESM::RefId armorType = getEquipmentSkill(ptr);
|
||||||
if (armorType == ESM::Skill::LightArmor)
|
if (armorType == ESM::Skill::LightArmor)
|
||||||
typeText = "#{sLight}";
|
typeText = "#{sLight}";
|
||||||
else if (armorType == ESM::Skill::MediumArmor)
|
else if (armorType == ESM::Skill::MediumArmor)
|
||||||
|
|
@ -297,8 +297,8 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
int armorSkillType = getEquipmentSkill(ptr);
|
ESM::RefId armorSkillType = getEquipmentSkill(ptr);
|
||||||
float armorSkill = actor.getClass().getSkill(actor, ESM::Skill::indexToRefId(armorSkillType));
|
float armorSkill = actor.getClass().getSkill(actor, armorSkillType);
|
||||||
|
|
||||||
int iBaseArmorSkill = MWBase::Environment::get()
|
int iBaseArmorSkill = MWBase::Environment::get()
|
||||||
.getESMStore()
|
.getESMStore()
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,7 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
int getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
ESM::RefId getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
||||||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
|
||||||
/// no such skill.
|
|
||||||
|
|
||||||
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
|
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
|
||||||
|
|
@ -101,14 +101,14 @@ namespace MWClass
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clothing::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
ESM::RefId Clothing::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();
|
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
if (ref->mBase->mData.mType == ESM::Clothing::Shoes)
|
if (ref->mBase->mData.mType == ESM::Clothing::Shoes)
|
||||||
return ESM::Skill::Unarmored;
|
return ESM::Skill::Unarmored;
|
||||||
|
|
||||||
return -1;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clothing::getValue(const MWWorld::ConstPtr& ptr) const
|
int Clothing::getValue(const MWWorld::ConstPtr& ptr) const
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,7 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
int getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
ESM::RefId getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
||||||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
|
||||||
/// no such skill.
|
|
||||||
|
|
||||||
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
|
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
|
||||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||||
|
|
|
||||||
|
|
@ -582,11 +582,11 @@ namespace MWClass
|
||||||
victim = result.first;
|
victim = result.first;
|
||||||
hitPosition = result.second;
|
hitPosition = result.second;
|
||||||
|
|
||||||
int weapskill = ESM::Skill::HandToHand;
|
ESM::RefId weapskill = ESM::Skill::HandToHand;
|
||||||
if (!weapon.isEmpty())
|
if (!weapon.isEmpty())
|
||||||
weapskill = weapon.getClass().getEquipmentSkill(weapon);
|
weapskill = weapon.getClass().getEquipmentSkill(weapon);
|
||||||
|
|
||||||
float hitchance = MWMechanics::getHitChance(ptr, victim, getSkill(ptr, ESM::Skill::indexToRefId(weapskill)));
|
float hitchance = MWMechanics::getHitChance(ptr, victim, getSkill(ptr, weapskill));
|
||||||
|
|
||||||
return Misc::Rng::roll0to99(world->getPrng()) < hitchance;
|
return Misc::Rng::roll0to99(world->getPrng()) < hitchance;
|
||||||
}
|
}
|
||||||
|
|
@ -651,10 +651,10 @@ namespace MWClass
|
||||||
|
|
||||||
if (ptr == MWMechanics::getPlayer())
|
if (ptr == MWMechanics::getPlayer())
|
||||||
{
|
{
|
||||||
int weapskill = ESM::Skill::HandToHand;
|
ESM::RefId weapskill = ESM::Skill::HandToHand;
|
||||||
if (!weapon.isEmpty())
|
if (!weapon.isEmpty())
|
||||||
weapskill = weapon.getClass().getEquipmentSkill(weapon);
|
weapskill = weapon.getClass().getEquipmentSkill(weapon);
|
||||||
skillUsageSucceeded(ptr, ESM::Skill::indexToRefId(weapskill), 0);
|
skillUsageSucceeded(ptr, weapskill, 0);
|
||||||
|
|
||||||
const MWMechanics::AiSequence& seq = victim.getClass().getCreatureStats(victim).getAiSequence();
|
const MWMechanics::AiSequence& seq = victim.getClass().getCreatureStats(victim).getAiSequence();
|
||||||
|
|
||||||
|
|
@ -842,25 +842,19 @@ namespace MWClass
|
||||||
armor = *inv.unequipItem(armor);
|
armor = *inv.unequipItem(armor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ESM::RefId skill = armor.getClass().getEquipmentSkill(armor);
|
||||||
if (ptr == MWMechanics::getPlayer())
|
if (ptr == MWMechanics::getPlayer())
|
||||||
skillUsageSucceeded(
|
skillUsageSucceeded(ptr, skill, 0);
|
||||||
ptr, ESM::Skill::indexToRefId(armor.getClass().getEquipmentSkill(armor)), 0);
|
|
||||||
|
|
||||||
switch (armor.getClass().getEquipmentSkill(armor))
|
if (skill == ESM::Skill::LightArmor)
|
||||||
{
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Light Armor Hit"), 1.0f, 1.0f);
|
||||||
case ESM::Skill::LightArmor:
|
else if (skill == ESM::Skill::MediumArmor)
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Light Armor Hit"), 1.0f, 1.0f);
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Medium Armor Hit"), 1.0f, 1.0f);
|
||||||
break;
|
else if (skill == ESM::Skill::HeavyArmor)
|
||||||
case ESM::Skill::MediumArmor:
|
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Heavy Armor Hit"), 1.0f, 1.0f);
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Medium Armor Hit"), 1.0f, 1.0f);
|
|
||||||
break;
|
|
||||||
case ESM::Skill::HeavyArmor:
|
|
||||||
sndMgr->playSound3D(ptr, ESM::RefId::stringRefId("Heavy Armor Hit"), 1.0f, 1.0f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (ptr == MWMechanics::getPlayer())
|
else if (ptr == MWMechanics::getPlayer())
|
||||||
Class::skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1046,7 +1040,7 @@ namespace MWClass
|
||||||
const float encumbranceTerm = gmst.fJumpEncumbranceBase->mValue.getFloat()
|
const float encumbranceTerm = gmst.fJumpEncumbranceBase->mValue.getFloat()
|
||||||
+ gmst.fJumpEncumbranceMultiplier->mValue.getFloat() * (1.0f - Npc::getNormalizedEncumbrance(ptr));
|
+ gmst.fJumpEncumbranceMultiplier->mValue.getFloat() * (1.0f - Npc::getNormalizedEncumbrance(ptr));
|
||||||
|
|
||||||
float a = Class::getSkill(ptr, ESM::Skill::Acrobatics);
|
float a = getSkill(ptr, ESM::Skill::Acrobatics);
|
||||||
float b = 0.0f;
|
float b = 0.0f;
|
||||||
if (a > 50.0f)
|
if (a > 50.0f)
|
||||||
{
|
{
|
||||||
|
|
@ -1179,7 +1173,7 @@ namespace MWClass
|
||||||
|
|
||||||
float fUnarmoredBase1 = store.find("fUnarmoredBase1")->mValue.getFloat();
|
float fUnarmoredBase1 = store.find("fUnarmoredBase1")->mValue.getFloat();
|
||||||
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->mValue.getFloat();
|
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->mValue.getFloat();
|
||||||
float unarmoredSkill = Class::getSkill(ptr, ESM::Skill::Unarmored);
|
float unarmoredSkill = getSkill(ptr, ESM::Skill::Unarmored);
|
||||||
|
|
||||||
float ratings[MWWorld::InventoryStore::Slots];
|
float ratings[MWWorld::InventoryStore::Slots];
|
||||||
for (int i = 0; i < MWWorld::InventoryStore::Slots; i++)
|
for (int i = 0; i < MWWorld::InventoryStore::Slots; i++)
|
||||||
|
|
@ -1305,18 +1299,13 @@ namespace MWClass
|
||||||
if (boots == inv.end() || boots->getType() != ESM::Armor::sRecordId)
|
if (boots == inv.end() || boots->getType() != ESM::Armor::sRecordId)
|
||||||
return (name == "left") ? footBareLeft : footBareRight;
|
return (name == "left") ? footBareLeft : footBareRight;
|
||||||
|
|
||||||
switch (boots->getClass().getEquipmentSkill(*boots))
|
ESM::RefId skill = boots->getClass().getEquipmentSkill(*boots);
|
||||||
{
|
if (skill == ESM::Skill::LightArmor)
|
||||||
case ESM::Skill::LightArmor:
|
return (name == "left") ? footLightLeft : footLightRight;
|
||||||
return (name == "left") ? footLightLeft : footLightRight;
|
else if (skill == ESM::Skill::MediumArmor)
|
||||||
break;
|
return (name == "left") ? footMediumLeft : footMediumRight;
|
||||||
case ESM::Skill::MediumArmor:
|
else if (skill == ESM::Skill::HeavyArmor)
|
||||||
return (name == "left") ? footMediumLeft : footMediumRight;
|
return (name == "left") ? footHeavyLeft : footHeavyRight;
|
||||||
break;
|
|
||||||
case ESM::Skill::HeavyArmor:
|
|
||||||
return (name == "left") ? footHeavyLeft : footHeavyRight;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ESM::RefId();
|
return ESM::RefId();
|
||||||
}
|
}
|
||||||
|
|
@ -1544,7 +1533,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const GMST& gmst = getGmst();
|
const GMST& gmst = getGmst();
|
||||||
return getWalkSpeed(ptr)
|
return getWalkSpeed(ptr)
|
||||||
* (0.01f * Class::getSkill(ptr, ESM::Skill::Athletics) * gmst.fAthleticsRunBonus->mValue.getFloat()
|
* (0.01f * getSkill(ptr, ESM::Skill::Athletics) * gmst.fAthleticsRunBonus->mValue.getFloat()
|
||||||
+ gmst.fBaseRunMultiplier->mValue.getFloat());
|
+ gmst.fBaseRunMultiplier->mValue.getFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ namespace MWClass
|
||||||
return std::make_pair(slots_, stack);
|
return std::make_pair(slots_, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Weapon::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
ESM::RefId Weapon::getEquipmentSkill(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();
|
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();
|
||||||
int type = ref->mBase->mData.mType;
|
int type = ref->mBase->mData.mType;
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,7 @@ namespace MWClass
|
||||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||||
/// stay stacked when equipped?
|
/// stay stacked when equipped?
|
||||||
|
|
||||||
int getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
ESM::RefId getEquipmentSkill(const MWWorld::ConstPtr& ptr) const override;
|
||||||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
|
||||||
/// no such skill.
|
|
||||||
|
|
||||||
int getValue(const MWWorld::ConstPtr& ptr) const override;
|
int getValue(const MWWorld::ConstPtr& ptr) const override;
|
||||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||||
|
|
|
||||||
|
|
@ -475,14 +475,14 @@ namespace MWGui
|
||||||
assert(attributes.size() == klass.mData.mAttribute.size());
|
assert(attributes.size() == klass.mData.mAttribute.size());
|
||||||
std::copy(attributes.begin(), attributes.end(), klass.mData.mAttribute.begin());
|
std::copy(attributes.begin(), attributes.end(), klass.mData.mAttribute.begin());
|
||||||
|
|
||||||
std::vector<ESM::Skill::SkillEnum> majorSkills = mCreateClassDialog->getMajorSkills();
|
std::vector<ESM::RefId> majorSkills = mCreateClassDialog->getMajorSkills();
|
||||||
std::vector<ESM::Skill::SkillEnum> minorSkills = mCreateClassDialog->getMinorSkills();
|
std::vector<ESM::RefId> minorSkills = mCreateClassDialog->getMinorSkills();
|
||||||
assert(majorSkills.size() >= klass.mData.mSkills.size());
|
assert(majorSkills.size() >= klass.mData.mSkills.size());
|
||||||
assert(minorSkills.size() >= klass.mData.mSkills.size());
|
assert(minorSkills.size() >= klass.mData.mSkills.size());
|
||||||
for (size_t i = 0; i < klass.mData.mSkills.size(); ++i)
|
for (size_t i = 0; i < klass.mData.mSkills.size(); ++i)
|
||||||
{
|
{
|
||||||
klass.mData.mSkills[i][1] = majorSkills[i];
|
klass.mData.mSkills[i][1] = majorSkills[i].getIf<ESM::IndexRefId>()->getValue();
|
||||||
klass.mData.mSkills[i][0] = minorSkills[i];
|
klass.mData.mSkills[i][0] = minorSkills[i].getIf<ESM::IndexRefId>()->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
||||||
|
|
|
||||||
|
|
@ -266,10 +266,12 @@ namespace MWGui
|
||||||
|
|
||||||
for (size_t i = 0; i < klass->mData.mSkills.size(); ++i)
|
for (size_t i = 0; i < klass->mData.mSkills.size(); ++i)
|
||||||
{
|
{
|
||||||
mMinorSkill[i]->setSkillNumber(klass->mData.mSkills[i][0]);
|
ESM::RefId minor = ESM::Skill::indexToRefId(klass->mData.mSkills[i][0]);
|
||||||
mMajorSkill[i]->setSkillNumber(klass->mData.mSkills[i][1]);
|
ESM::RefId major = ESM::Skill::indexToRefId(klass->mData.mSkills[i][1]);
|
||||||
ToolTips::createSkillToolTip(mMinorSkill[i], klass->mData.mSkills[i][0]);
|
mMinorSkill[i]->setSkillId(minor);
|
||||||
ToolTips::createSkillToolTip(mMajorSkill[i], klass->mData.mSkills[i][1]);
|
mMajorSkill[i]->setSkillId(major);
|
||||||
|
ToolTips::createSkillToolTip(mMinorSkill[i], minor);
|
||||||
|
ToolTips::createSkillToolTip(mMajorSkill[i], major);
|
||||||
}
|
}
|
||||||
|
|
||||||
setClassImage(mClassImage, mCurrentClassId);
|
setClassImage(mClassImage, mCurrentClassId);
|
||||||
|
|
@ -514,24 +516,24 @@ namespace MWGui
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMajorSkills() const
|
std::vector<ESM::RefId> CreateClassDialog::getMajorSkills() const
|
||||||
{
|
{
|
||||||
std::vector<ESM::Skill::SkillEnum> v;
|
std::vector<ESM::RefId> v;
|
||||||
v.reserve(5);
|
v.reserve(mMajorSkill.size());
|
||||||
for (int i = 0; i < 5; i++)
|
for (const auto& widget : mMajorSkill)
|
||||||
{
|
{
|
||||||
v.push_back(mMajorSkill[i]->getSkillId());
|
v.push_back(widget->getSkillId());
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
std::vector<ESM::RefId> CreateClassDialog::getMinorSkills() const
|
||||||
{
|
{
|
||||||
std::vector<ESM::Skill::SkillEnum> v;
|
std::vector<ESM::RefId> v;
|
||||||
v.reserve(5);
|
v.reserve(mMinorSkill.size());
|
||||||
for (int i = 0; i < 5; i++)
|
for (const auto& widget : mMinorSkill)
|
||||||
{
|
{
|
||||||
v.push_back(mMinorSkill[i]->getSkillId());
|
v.push_back(widget->getSkillId());
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
@ -624,7 +626,7 @@ namespace MWGui
|
||||||
|
|
||||||
void CreateClassDialog::onSkillSelected()
|
void CreateClassDialog::onSkillSelected()
|
||||||
{
|
{
|
||||||
ESM::Skill::SkillEnum id = mSkillDialog->getSkillId();
|
ESM::RefId id = mSkillDialog->getSkillId();
|
||||||
|
|
||||||
// Avoid duplicate skills by swapping any skill field that matches the selected one
|
// Avoid duplicate skills by swapping any skill field that matches the selected one
|
||||||
for (Widgets::MWSkillPtr& skill : mSkills)
|
for (Widgets::MWSkillPtr& skill : mSkills)
|
||||||
|
|
@ -804,7 +806,7 @@ namespace MWGui
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Widgets::MWSkillPtr widget;
|
Widgets::MWSkillPtr widget;
|
||||||
ESM::Skill::SkillEnum skillId;
|
ESM::RefId skillId;
|
||||||
} mSkills[3][9]
|
} mSkills[3][9]
|
||||||
= { { { mCombatSkill[0], ESM::Skill::Block }, { mCombatSkill[1], ESM::Skill::Armorer },
|
= { { { mCombatSkill[0], ESM::Skill::Block }, { mCombatSkill[1], ESM::Skill::Armorer },
|
||||||
{ mCombatSkill[2], ESM::Skill::MediumArmor }, { mCombatSkill[3], ESM::Skill::HeavyArmor },
|
{ mCombatSkill[2], ESM::Skill::MediumArmor }, { mCombatSkill[3], ESM::Skill::HeavyArmor },
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef MWGUI_CLASS_H
|
#ifndef MWGUI_CLASS_H
|
||||||
#define MWGUI_CLASS_H
|
#define MWGUI_CLASS_H
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <MyGUI_EditBox.h>
|
#include <MyGUI_EditBox.h>
|
||||||
|
|
@ -218,7 +219,7 @@ namespace MWGui
|
||||||
|
|
||||||
bool exit() override;
|
bool exit() override;
|
||||||
|
|
||||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
ESM::RefId getSkillId() const { return mSkillId; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
@ -242,7 +243,7 @@ namespace MWGui
|
||||||
Widgets::MWSkillPtr mMagicSkill[9];
|
Widgets::MWSkillPtr mMagicSkill[9];
|
||||||
Widgets::MWSkillPtr mStealthSkill[9];
|
Widgets::MWSkillPtr mStealthSkill[9];
|
||||||
|
|
||||||
ESM::Skill::SkillEnum mSkillId;
|
ESM::RefId mSkillId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DescriptionDialog : public WindowModal
|
class DescriptionDialog : public WindowModal
|
||||||
|
|
@ -278,8 +279,8 @@ namespace MWGui
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
ESM::Class::Specialization getSpecializationId() const;
|
ESM::Class::Specialization getSpecializationId() const;
|
||||||
std::vector<int> getFavoriteAttributes() const;
|
std::vector<int> getFavoriteAttributes() const;
|
||||||
std::vector<ESM::Skill::SkillEnum> getMajorSkills() const;
|
std::vector<ESM::RefId> getMajorSkills() const;
|
||||||
std::vector<ESM::Skill::SkillEnum> getMinorSkills() const;
|
std::vector<ESM::RefId> getMinorSkills() const;
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
|
|
||||||
|
|
@ -318,8 +319,8 @@ namespace MWGui
|
||||||
MyGUI::EditBox* mEditName;
|
MyGUI::EditBox* mEditName;
|
||||||
MyGUI::TextBox* mSpecializationName;
|
MyGUI::TextBox* mSpecializationName;
|
||||||
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
||||||
Widgets::MWSkillPtr mMajorSkill[5];
|
std::array<Widgets::MWSkillPtr, 5> mMajorSkill;
|
||||||
Widgets::MWSkillPtr mMinorSkill[5];
|
std::array<Widgets::MWSkillPtr, 5> mMinorSkill;
|
||||||
std::vector<Widgets::MWSkillPtr> mSkills;
|
std::vector<Widgets::MWSkillPtr> mSkills;
|
||||||
std::string mDescription;
|
std::string mDescription;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ namespace MWGui
|
||||||
skills.insert(skill);
|
skills.insert(skill);
|
||||||
|
|
||||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill->mId);
|
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill->mId);
|
||||||
if (skill->mIndex == ESM::Skill::Security || skill->mIndex == ESM::Skill::Sneak)
|
if (skill->mId == ESM::Skill::Security || skill->mId == 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));
|
||||||
|
|
@ -118,7 +118,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
int skillValue = player.getClass().getNpcStats(player).getSkill(skill->mId).getBase();
|
int skillValue = player.getClass().getNpcStats(player).getSkill(skill->mId).getBase();
|
||||||
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
||||||
if (skill->mIndex == ESM::Skill::Sneak || skill->mIndex == ESM::Skill::Security)
|
if (skill->mId == ESM::Skill::Sneak || skill->mId == ESM::Skill::Security)
|
||||||
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
|
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
|
||||||
|
|
||||||
skillMsg = Misc::StringUtils::format(skillMsg, skill->mName, skillValue);
|
skillMsg = Misc::StringUtils::format(skillMsg, skill->mName, skillValue);
|
||||||
|
|
|
||||||
|
|
@ -414,13 +414,14 @@ namespace MWGui
|
||||||
const ESM::Race* race = store.get<ESM::Race>().find(mCurrentRaceId);
|
const ESM::Race* race = store.get<ESM::Race>().find(mCurrentRaceId);
|
||||||
for (const auto& bonus : race->mData.mBonus)
|
for (const auto& bonus : race->mData.mBonus)
|
||||||
{
|
{
|
||||||
if (bonus.mSkill < 0 || bonus.mSkill >= ESM::Skill::Length) // Skip unknown skill indexes
|
ESM::RefId skill = ESM::Skill::indexToRefId(bonus.mSkill);
|
||||||
|
if (skill.empty()) // Skip unknown skill indexes
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default);
|
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default);
|
||||||
skillWidget->setSkillId(ESM::Skill::SkillEnum(bonus.mSkill));
|
skillWidget->setSkillId(skill);
|
||||||
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(static_cast<float>(bonus.mBonus), 0.f));
|
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(static_cast<float>(bonus.mBonus), 0.f));
|
||||||
ToolTips::createSkillToolTip(skillWidget, bonus.mSkill);
|
ToolTips::createSkillToolTip(skillWidget, skill);
|
||||||
|
|
||||||
mSkillItems.push_back(skillWidget);
|
mSkillItems.push_back(skillWidget);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@ namespace MWGui
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
ToolTips::createSkillToolTip(mSkillWidgets[mSkillWidgets.size() - 1 - i], skill->mIndex);
|
ToolTips::createSkillToolTip(mSkillWidgets[mSkillWidgets.size() - 1 - i], skill->mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
mSkillWidgetMap[skill->mId] = widget;
|
mSkillWidgetMap[skill->mId] = widget;
|
||||||
|
|
|
||||||
|
|
@ -286,9 +286,9 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::setSkill(int skill)
|
void EditEffectDialog::setSkill(ESM::RefId skill)
|
||||||
{
|
{
|
||||||
mEffect.mSkill = skill;
|
mEffect.mSkill = skill.getIf<ESM::IndexRefId>()->getValue();
|
||||||
eventEffectModified(mEffect);
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace MWGui
|
||||||
|
|
||||||
void setConstantEffect(bool constant);
|
void setConstantEffect(bool constant);
|
||||||
|
|
||||||
void setSkill(int skill);
|
void setSkill(ESM::RefId skill);
|
||||||
void setAttribute(int attribute);
|
void setAttribute(int attribute);
|
||||||
|
|
||||||
void newEffect(const ESM::MagicEffect* effect);
|
void newEffect(const ESM::MagicEffect* effect);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (effect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
{
|
{
|
||||||
const ESM::Skill* skill = store->get<ESM::Skill>().find(effectInfo.mKey.mArg);
|
const ESM::Skill* skill
|
||||||
|
= store->get<ESM::Skill>().find(ESM::Skill::indexToRefId(effectInfo.mKey.mArg));
|
||||||
sourcesDescription += " (" + skill->mName + ')';
|
sourcesDescription += " (" + skill->mName + ')';
|
||||||
}
|
}
|
||||||
if (effect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
|
|
|
||||||
|
|
@ -805,9 +805,9 @@ namespace MWGui
|
||||||
mFocusToolTipY = min_y;
|
mFocusToolTipY = min_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
|
void ToolTips::createSkillToolTip(MyGUI::Widget* widget, ESM::RefId skillId)
|
||||||
{
|
{
|
||||||
if (skillId == -1)
|
if (skillId.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace MWGui
|
||||||
|
|
||||||
// these do not create an actual tooltip, but they fill in the data that is required so the tooltip
|
// these do not create an actual tooltip, but they fill in the data that is required so the tooltip
|
||||||
// system knows what to show in case this widget is hovered
|
// system knows what to show in case this widget is hovered
|
||||||
static void createSkillToolTip(MyGUI::Widget* widget, int skillId);
|
static void createSkillToolTip(MyGUI::Widget* widget, ESM::RefId skillId);
|
||||||
static void createAttributeToolTip(MyGUI::Widget* widget, int attributeId);
|
static void createAttributeToolTip(MyGUI::Widget* widget, int attributeId);
|
||||||
static void createSpecializationToolTip(MyGUI::Widget* widget, const std::string& name, int specId);
|
static void createSpecializationToolTip(MyGUI::Widget* widget, const std::string& name, int specId);
|
||||||
static void createBirthsignToolTip(MyGUI::Widget* widget, const ESM::RefId& birthsignId);
|
static void createBirthsignToolTip(MyGUI::Widget* widget, const ESM::RefId& birthsignId);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ namespace MWGui
|
||||||
|
|
||||||
button->setSize(button->getTextSize().width + 12, button->getSize().height);
|
button->setSize(button->getTextSize().width + 12, button->getSize().height);
|
||||||
|
|
||||||
ToolTips::createSkillToolTip(button, skill->mIndex);
|
ToolTips::createSkillToolTip(button, skill->mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
center();
|
center();
|
||||||
|
|
|
||||||
|
|
@ -28,28 +28,17 @@ namespace MWGui::Widgets
|
||||||
/* MWSkill */
|
/* MWSkill */
|
||||||
|
|
||||||
MWSkill::MWSkill()
|
MWSkill::MWSkill()
|
||||||
: mSkillId(ESM::Skill::Length)
|
: mSkillNameWidget(nullptr)
|
||||||
, mSkillNameWidget(nullptr)
|
|
||||||
, mSkillValueWidget(nullptr)
|
, mSkillValueWidget(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWSkill::setSkillId(ESM::Skill::SkillEnum skill)
|
void MWSkill::setSkillId(ESM::RefId skill)
|
||||||
{
|
{
|
||||||
mSkillId = skill;
|
mSkillId = skill;
|
||||||
updateWidgets();
|
updateWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWSkill::setSkillNumber(int skill)
|
|
||||||
{
|
|
||||||
if (skill < 0)
|
|
||||||
setSkillId(ESM::Skill::Length);
|
|
||||||
else if (skill < ESM::Skill::Length)
|
|
||||||
setSkillId(static_cast<ESM::Skill::SkillEnum>(skill));
|
|
||||||
else
|
|
||||||
throw std::runtime_error("Skill number out of range");
|
|
||||||
}
|
|
||||||
|
|
||||||
void MWSkill::setSkillValue(const SkillValue& value)
|
void MWSkill::setSkillValue(const SkillValue& value)
|
||||||
{
|
{
|
||||||
mValue = value;
|
mValue = value;
|
||||||
|
|
@ -60,8 +49,7 @@ namespace MWGui::Widgets
|
||||||
{
|
{
|
||||||
if (mSkillNameWidget)
|
if (mSkillNameWidget)
|
||||||
{
|
{
|
||||||
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().search(
|
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().search(mSkillId);
|
||||||
ESM::Skill::indexToRefId(mSkillId));
|
|
||||||
if (skill == nullptr)
|
if (skill == nullptr)
|
||||||
mSkillNameWidget->setCaption({});
|
mSkillNameWidget->setCaption({});
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,10 @@ namespace MWGui
|
||||||
|
|
||||||
typedef MWMechanics::Stat<float> SkillValue;
|
typedef MWMechanics::Stat<float> SkillValue;
|
||||||
|
|
||||||
void setSkillId(ESM::Skill::SkillEnum skillId);
|
void setSkillId(ESM::RefId skillId);
|
||||||
void setSkillNumber(int skillId);
|
|
||||||
void setSkillValue(const SkillValue& value);
|
void setSkillValue(const SkillValue& value);
|
||||||
|
|
||||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
ESM::RefId getSkillId() const { return mSkillId; }
|
||||||
const SkillValue& getSkillValue() const { return mValue; }
|
const SkillValue& getSkillValue() const { return mValue; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
@ -125,7 +124,7 @@ namespace MWGui
|
||||||
private:
|
private:
|
||||||
void updateWidgets();
|
void updateWidgets();
|
||||||
|
|
||||||
ESM::Skill::SkillEnum mSkillId;
|
ESM::RefId mSkillId;
|
||||||
SkillValue mValue;
|
SkillValue mValue;
|
||||||
MyGUI::TextBox* mSkillNameWidget;
|
MyGUI::TextBox* mSkillNameWidget;
|
||||||
MyGUI::TextBox* mSkillValueWidget;
|
MyGUI::TextBox* mSkillValueWidget;
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ namespace MWLua
|
||||||
sol::table skill(context.mLua->sol(), sol::create);
|
sol::table skill(context.mLua->sol(), sol::create);
|
||||||
book["SKILL"] = LuaUtil::makeStrictReadOnly(skill);
|
book["SKILL"] = LuaUtil::makeStrictReadOnly(skill);
|
||||||
book["createRecordDraft"] = tableToBook;
|
book["createRecordDraft"] = tableToBook;
|
||||||
for (int id = ESM::Skill::Block; id < ESM::Skill::Length; ++id)
|
for (int id = 0; id < ESM::Skill::Length; ++id)
|
||||||
{
|
{
|
||||||
std::string skillName = Misc::StringUtils::lowerCase(ESM::Skill::sSkillNames[id]);
|
std::string skillName = Misc::StringUtils::lowerCase(ESM::Skill::sSkillNames[id]);
|
||||||
skill[skillName] = skillName;
|
skill[skillName] = skillName;
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ namespace MWMechanics
|
||||||
x *= 1.5f;
|
x *= 1.5f;
|
||||||
|
|
||||||
float s = 0.f;
|
float s = 0.f;
|
||||||
ESM::RefId skill = ESM::Skill::indexToRefId(spellSchoolToSkill(magicEffect->mData.mSchool));
|
ESM::RefId skill = spellSchoolToSkill(magicEffect->mData.mSchool);
|
||||||
auto found = actorSkills.find(skill);
|
auto found = actorSkills.find(skill);
|
||||||
if (found != actorSkills.end())
|
if (found != actorSkills.end())
|
||||||
s = 2.f * found->second.getBase();
|
s = 2.f * found->second.getBase();
|
||||||
|
|
@ -322,10 +322,13 @@ namespace MWMechanics
|
||||||
return 100.f;
|
return 100.f;
|
||||||
|
|
||||||
float skillTerm = 0;
|
float skillTerm = 0;
|
||||||
ESM::RefId skill = ESM::Skill::indexToRefId(spellSchoolToSkill(effectiveSchool));
|
if (effectiveSchool != -1)
|
||||||
auto found = actorSkills.find(skill);
|
{
|
||||||
if (found != actorSkills.end())
|
ESM::RefId skill = spellSchoolToSkill(effectiveSchool);
|
||||||
skillTerm = 2.f * found->second.getBase();
|
auto found = actorSkills.find(skill);
|
||||||
|
if (found != actorSkills.end())
|
||||||
|
skillTerm = 2.f * found->second.getBase();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
calcWeakestSchool(
|
calcWeakestSchool(
|
||||||
spell, actorSkills, effectiveSchool, skillTerm); // Note effectiveSchool is unused after this
|
spell, actorSkills, effectiveSchool, skillTerm); // Note effectiveSchool is unused after this
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,7 @@ namespace MWMechanics
|
||||||
if (weapon.isEmpty())
|
if (weapon.isEmpty())
|
||||||
attackerSkill = attacker.getClass().getSkill(attacker, ESM::Skill::HandToHand);
|
attackerSkill = attacker.getClass().getSkill(attacker, ESM::Skill::HandToHand);
|
||||||
else
|
else
|
||||||
attackerSkill = attacker.getClass().getSkill(
|
attackerSkill = attacker.getClass().getSkill(attacker, weapon.getClass().getEquipmentSkill(weapon));
|
||||||
attacker, ESM::Skill::indexToRefId(weapon.getClass().getEquipmentSkill(weapon)));
|
|
||||||
float attackerTerm = attackerSkill + 0.2f * attackerStats.getAttribute(ESM::Attribute::Agility).getModified()
|
float attackerTerm = attackerSkill + 0.2f * attackerStats.getAttribute(ESM::Attribute::Agility).getModified()
|
||||||
+ 0.1f * attackerStats.getAttribute(ESM::Attribute::Luck).getModified();
|
+ 0.1f * attackerStats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||||
attackerTerm *= attackerStats.getFatigueTerm();
|
attackerTerm *= attackerStats.getFatigueTerm();
|
||||||
|
|
@ -218,7 +217,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool validVictim = !victim.isEmpty() && victim.getClass().isActor();
|
bool validVictim = !victim.isEmpty() && victim.getClass().isActor();
|
||||||
|
|
||||||
int weaponSkill = ESM::Skill::Marksman;
|
ESM::RefId weaponSkill = ESM::Skill::Marksman;
|
||||||
if (!weapon.isEmpty())
|
if (!weapon.isEmpty())
|
||||||
weaponSkill = weapon.getClass().getEquipmentSkill(weapon);
|
weaponSkill = weapon.getClass().getEquipmentSkill(weapon);
|
||||||
|
|
||||||
|
|
@ -228,7 +227,7 @@ namespace MWMechanics
|
||||||
if (attacker == getPlayer())
|
if (attacker == getPlayer())
|
||||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||||
|
|
||||||
int skillValue = attacker.getClass().getSkill(attacker, ESM::Skill::indexToRefId(weaponSkill));
|
int skillValue = attacker.getClass().getSkill(attacker, weaponSkill);
|
||||||
|
|
||||||
if (Misc::Rng::roll0to99(world->getPrng()) >= getHitChance(attacker, victim, skillValue))
|
if (Misc::Rng::roll0to99(world->getPrng()) >= getHitChance(attacker, victim, skillValue))
|
||||||
{
|
{
|
||||||
|
|
@ -259,7 +258,7 @@ namespace MWMechanics
|
||||||
applyWerewolfDamageMult(victim, projectile, damage);
|
applyWerewolfDamageMult(victim, projectile, damage);
|
||||||
|
|
||||||
if (attacker == getPlayer())
|
if (attacker == getPlayer())
|
||||||
attacker.getClass().skillUsageSucceeded(attacker, ESM::Skill::indexToRefId(weaponSkill), 0);
|
attacker.getClass().skillUsageSucceeded(attacker, weaponSkill, 0);
|
||||||
|
|
||||||
const MWMechanics::AiSequence& sequence = victim.getClass().getCreatureStats(victim).getAiSequence();
|
const MWMechanics::AiSequence& sequence = victim.getClass().getCreatureStats(victim).getAiSequence();
|
||||||
bool unaware = attacker == getPlayer() && !sequence.isInCombat()
|
bool unaware = attacker == getPlayer() && !sequence.isInCombat()
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,6 @@ namespace MWMechanics
|
||||||
void setCrimeId(int id);
|
void setCrimeId(int id);
|
||||||
|
|
||||||
const SkillValue& getSkill(ESM::RefId id) const;
|
const SkillValue& getSkill(ESM::RefId id) const;
|
||||||
const SkillValue& getSkill(ESM::Skill::SkillEnum index) const
|
|
||||||
{
|
|
||||||
return getSkill(ESM::Skill::indexToRefId(index));
|
|
||||||
}
|
|
||||||
SkillValue& getSkill(ESM::RefId id);
|
SkillValue& getSkill(ESM::RefId id);
|
||||||
void setSkill(ESM::RefId id, const SkillValue& value);
|
void setSkill(ESM::RefId id, const SkillValue& value);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ namespace MWMechanics
|
||||||
&& (e != ESM::MagicEffect::BoundLongbow || effect.mEffectID == e
|
&& (e != ESM::MagicEffect::BoundLongbow || effect.mEffectID == e
|
||||||
|| rateAmmo(actor, enemy, getWeaponType(ESM::Weapon::MarksmanBow)->mAmmoType) <= 0.f))
|
|| rateAmmo(actor, enemy, getWeaponType(ESM::Weapon::MarksmanBow)->mAmmoType) <= 0.f))
|
||||||
return 0.f;
|
return 0.f;
|
||||||
ESM::Skill::SkillEnum skill = ESM::Skill::ShortBlade;
|
ESM::RefId skill = ESM::Skill::ShortBlade;
|
||||||
if (effect.mEffectID == ESM::MagicEffect::BoundLongsword)
|
if (effect.mEffectID == ESM::MagicEffect::BoundLongsword)
|
||||||
skill = ESM::Skill::LongBlade;
|
skill = ESM::Skill::LongBlade;
|
||||||
else if (effect.mEffectID == ESM::MagicEffect::BoundMace)
|
else if (effect.mEffectID == ESM::MagicEffect::BoundMace)
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
ESM::Skill::SkillEnum spellSchoolToSkill(int school)
|
ESM::RefId spellSchoolToSkill(int school)
|
||||||
{
|
{
|
||||||
static const std::array<ESM::Skill::SkillEnum, 6> schoolSkillArray{
|
static const std::array<ESM::RefId, 6> schoolSkillArray{
|
||||||
ESM::Skill::Alteration,
|
ESM::Skill::Alteration,
|
||||||
ESM::Skill::Conjuration,
|
ESM::Skill::Conjuration,
|
||||||
ESM::Skill::Destruction,
|
ESM::Skill::Destruction,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace MWWorld
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
ESM::Skill::SkillEnum spellSchoolToSkill(int school);
|
ESM::RefId spellSchoolToSkill(int school);
|
||||||
|
|
||||||
enum class EffectCostMethod
|
enum class EffectCostMethod
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ namespace MWMechanics
|
||||||
int value = 50.f;
|
int value = 50.f;
|
||||||
if (actor.getClass().isNpc())
|
if (actor.getClass().isNpc())
|
||||||
{
|
{
|
||||||
ESM::RefId skill = ESM::Skill::indexToRefId(item.getClass().getEquipmentSkill(item));
|
ESM::RefId skill = item.getClass().getEquipmentSkill(item);
|
||||||
if (!skill.empty())
|
if (!skill.empty())
|
||||||
value = actor.getClass().getSkill(actor, skill);
|
value = actor.getClass().getSkill(actor, skill);
|
||||||
}
|
}
|
||||||
|
|
@ -179,9 +179,7 @@ namespace MWMechanics
|
||||||
if (weapon.isEmpty())
|
if (weapon.isEmpty())
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
float skillMult
|
float skillMult = actor.getClass().getSkill(actor, weapon.getClass().getEquipmentSkill(weapon)) * 0.01f;
|
||||||
= actor.getClass().getSkill(actor, ESM::Skill::indexToRefId(weapon.getClass().getEquipmentSkill(weapon)))
|
|
||||||
* 0.01f;
|
|
||||||
float chopMult = fAIMeleeWeaponMult;
|
float chopMult = fAIMeleeWeaponMult;
|
||||||
float bonusDamage = 0.f;
|
float bonusDamage = 0.f;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ namespace MWScript
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skill = it->getClass().getEquipmentSkill(*it);
|
ESM::RefId skill = it->getClass().getEquipmentSkill(*it);
|
||||||
if (skill == ESM::Skill::HeavyArmor)
|
if (skill == ESM::Skill::HeavyArmor)
|
||||||
runtime.push(2);
|
runtime.push(2);
|
||||||
else if (skill == ESM::Skill::MediumArmor)
|
else if (skill == ESM::Skill::MediumArmor)
|
||||||
|
|
|
||||||
|
|
@ -209,9 +209,9 @@ namespace MWWorld
|
||||||
return std::make_pair(std::vector<int>(), false);
|
return std::make_pair(std::vector<int>(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::getEquipmentSkill(const ConstPtr& ptr) const
|
ESM::RefId Class::getEquipmentSkill(const ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
return -1;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::getValue(const ConstPtr& ptr) const
|
int Class::getValue(const ConstPtr& ptr) const
|
||||||
|
|
|
||||||
|
|
@ -209,10 +209,9 @@ namespace MWWorld
|
||||||
///
|
///
|
||||||
/// Default implementation: return (empty vector, false).
|
/// Default implementation: return (empty vector, false).
|
||||||
|
|
||||||
virtual int getEquipmentSkill(const ConstPtr& ptr) const;
|
virtual ESM::RefId getEquipmentSkill(const ConstPtr& ptr) const;
|
||||||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
/// Return the index of the skill this item corresponds to when equipped.
|
||||||
/// no such skill.
|
/// (default implementation: return empty ref id)
|
||||||
/// (default implementation: return -1)
|
|
||||||
|
|
||||||
virtual int getValue(const ConstPtr& ptr) const;
|
virtual int getValue(const ConstPtr& ptr) const;
|
||||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||||
|
|
@ -239,11 +238,6 @@ namespace MWWorld
|
||||||
///< Inform actor \a ptr that a skill use has succeeded.
|
///< Inform actor \a ptr that a skill use has succeeded.
|
||||||
///
|
///
|
||||||
/// (default implementations: throws an exception)
|
/// (default implementations: throws an exception)
|
||||||
void skillUsageSucceeded(
|
|
||||||
const MWWorld::Ptr& ptr, ESM::Skill::SkillEnum index, int usageType, float extraFactor = 1.f) const
|
|
||||||
{
|
|
||||||
return skillUsageSucceeded(ptr, ESM::Skill::indexToRefId(index), usageType, extraFactor);
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual bool isEssential(const MWWorld::ConstPtr& ptr) const;
|
virtual bool isEssential(const MWWorld::ConstPtr& ptr) const;
|
||||||
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
|
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
|
||||||
|
|
@ -347,10 +341,6 @@ namespace MWWorld
|
||||||
bool isMobile(const MWWorld::Ptr& ptr) const;
|
bool isMobile(const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual float getSkill(const MWWorld::Ptr& ptr, ESM::RefId id) const;
|
virtual float getSkill(const MWWorld::Ptr& ptr, ESM::RefId id) const;
|
||||||
float getSkill(const MWWorld::Ptr& ptr, ESM::Skill::SkillEnum index) const
|
|
||||||
{
|
|
||||||
return getSkill(ptr, ESM::Skill::indexToRefId(index));
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual void readAdditionalState(const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const;
|
virtual void readAdditionalState(const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const;
|
||||||
///< Read additional state from \a state into \a ptr.
|
///< Read additional state from \a state into \a ptr.
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots_)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ESM::Skill::SkillEnum weaponSkills[] = {
|
static const ESM::RefId weaponSkills[] = {
|
||||||
ESM::Skill::LongBlade,
|
ESM::Skill::LongBlade,
|
||||||
ESM::Skill::Axe,
|
ESM::Skill::Axe,
|
||||||
ESM::Skill::Spear,
|
ESM::Skill::Spear,
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ namespace MWWorld
|
||||||
for (const auto& skill : store->get<ESM::Skill>())
|
for (const auto& skill : store->get<ESM::Skill>())
|
||||||
{
|
{
|
||||||
// Acrobatics is set separately for some reason.
|
// Acrobatics is set separately for some reason.
|
||||||
if (skill.mIndex == ESM::Skill::Acrobatics)
|
if (skill.mId == ESM::Skill::Acrobatics)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MWMechanics::SkillValue& value = npcStats.getSkill(skill.mId);
|
MWMechanics::SkillValue& value = npcStats.getSkill(skill.mId);
|
||||||
|
|
|
||||||
|
|
@ -481,10 +481,6 @@ namespace MWWorld
|
||||||
public:
|
public:
|
||||||
Store() = default;
|
Store() = default;
|
||||||
|
|
||||||
using TypedDynamicStore<ESM::Skill>::find;
|
|
||||||
// TODO delete
|
|
||||||
const ESM::Skill* find(int index) const { return find(ESM::Skill::indexToRefId(index)); }
|
|
||||||
|
|
||||||
void setUp(const MWWorld::Store<ESM::GameSetting>& settings);
|
void setUp(const MWWorld::Store<ESM::GameSetting>& settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ namespace
|
||||||
const RecordType* result = nullptr;
|
const RecordType* result = nullptr;
|
||||||
if constexpr (std::is_same_v<RecordType, ESM::LandTexture>)
|
if constexpr (std::is_same_v<RecordType, ESM::LandTexture>)
|
||||||
result = esmStore.get<RecordType>().search(index, 0);
|
result = esmStore.get<RecordType>().search(index, 0);
|
||||||
else if constexpr (ESM::hasIndex<RecordType>)
|
else if constexpr (ESM::hasIndex<RecordType> && !std::is_same_v<RecordType, ESM::Skill>)
|
||||||
result = esmStore.get<RecordType>().search(index);
|
result = esmStore.get<RecordType>().search(index);
|
||||||
else
|
else
|
||||||
result = esmStore.get<RecordType>().search(refId);
|
result = esmStore.get<RecordType>().search(refId);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,34 @@
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
const RefId Skill::Block = Skill::indexToRefId(0);
|
||||||
|
const RefId Skill::Armorer = Skill::indexToRefId(1);
|
||||||
|
const RefId Skill::MediumArmor = Skill::indexToRefId(2);
|
||||||
|
const RefId Skill::HeavyArmor = Skill::indexToRefId(3);
|
||||||
|
const RefId Skill::BluntWeapon = Skill::indexToRefId(4);
|
||||||
|
const RefId Skill::LongBlade = Skill::indexToRefId(5);
|
||||||
|
const RefId Skill::Axe = Skill::indexToRefId(6);
|
||||||
|
const RefId Skill::Spear = Skill::indexToRefId(7);
|
||||||
|
const RefId Skill::Athletics = Skill::indexToRefId(8);
|
||||||
|
const RefId Skill::Enchant = Skill::indexToRefId(9);
|
||||||
|
const RefId Skill::Destruction = Skill::indexToRefId(10);
|
||||||
|
const RefId Skill::Alteration = Skill::indexToRefId(11);
|
||||||
|
const RefId Skill::Illusion = Skill::indexToRefId(12);
|
||||||
|
const RefId Skill::Conjuration = Skill::indexToRefId(13);
|
||||||
|
const RefId Skill::Mysticism = Skill::indexToRefId(14);
|
||||||
|
const RefId Skill::Restoration = Skill::indexToRefId(15);
|
||||||
|
const RefId Skill::Alchemy = Skill::indexToRefId(16);
|
||||||
|
const RefId Skill::Unarmored = Skill::indexToRefId(17);
|
||||||
|
const RefId Skill::Security = Skill::indexToRefId(18);
|
||||||
|
const RefId Skill::Sneak = Skill::indexToRefId(19);
|
||||||
|
const RefId Skill::Acrobatics = Skill::indexToRefId(20);
|
||||||
|
const RefId Skill::LightArmor = Skill::indexToRefId(21);
|
||||||
|
const RefId Skill::ShortBlade = Skill::indexToRefId(22);
|
||||||
|
const RefId Skill::Marksman = Skill::indexToRefId(23);
|
||||||
|
const RefId Skill::Mercantile = Skill::indexToRefId(24);
|
||||||
|
const RefId Skill::Speechcraft = Skill::indexToRefId(25);
|
||||||
|
const RefId Skill::HandToHand = Skill::indexToRefId(26);
|
||||||
|
|
||||||
const std::string Skill::sSkillNames[Length] = {
|
const std::string Skill::sSkillNames[Length] = {
|
||||||
"Block",
|
"Block",
|
||||||
"Armorer",
|
"Armorer",
|
||||||
|
|
@ -37,11 +65,11 @@ namespace ESM
|
||||||
"Handtohand",
|
"Handtohand",
|
||||||
};
|
};
|
||||||
|
|
||||||
Skill::SkillEnum Skill::stringToSkillId(std::string_view skill)
|
int Skill::stringToSkillId(std::string_view skill)
|
||||||
{
|
{
|
||||||
for (int id = 0; id < Skill::Length; ++id)
|
for (int id = 0; id < Skill::Length; ++id)
|
||||||
if (Misc::StringUtils::ciEqual(sSkillNames[id], skill))
|
if (Misc::StringUtils::ciEqual(sSkillNames[id], skill))
|
||||||
return Skill::SkillEnum(id);
|
return id;
|
||||||
|
|
||||||
throw std::logic_error("No such skill: " + std::string(skill));
|
throw std::logic_error("No such skill: " + std::string(skill));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,40 +48,37 @@ namespace ESM
|
||||||
std::string mIcon;
|
std::string mIcon;
|
||||||
float mWerewolfValue{};
|
float mWerewolfValue{};
|
||||||
|
|
||||||
enum SkillEnum
|
static const RefId Block;
|
||||||
{
|
static const RefId Armorer;
|
||||||
Block = 0,
|
static const RefId MediumArmor;
|
||||||
Armorer = 1,
|
static const RefId HeavyArmor;
|
||||||
MediumArmor = 2,
|
static const RefId BluntWeapon;
|
||||||
HeavyArmor = 3,
|
static const RefId LongBlade;
|
||||||
BluntWeapon = 4,
|
static const RefId Axe;
|
||||||
LongBlade = 5,
|
static const RefId Spear;
|
||||||
Axe = 6,
|
static const RefId Athletics;
|
||||||
Spear = 7,
|
static const RefId Enchant;
|
||||||
Athletics = 8,
|
static const RefId Destruction;
|
||||||
Enchant = 9,
|
static const RefId Alteration;
|
||||||
Destruction = 10,
|
static const RefId Illusion;
|
||||||
Alteration = 11,
|
static const RefId Conjuration;
|
||||||
Illusion = 12,
|
static const RefId Mysticism;
|
||||||
Conjuration = 13,
|
static const RefId Restoration;
|
||||||
Mysticism = 14,
|
static const RefId Alchemy;
|
||||||
Restoration = 15,
|
static const RefId Unarmored;
|
||||||
Alchemy = 16,
|
static const RefId Security;
|
||||||
Unarmored = 17,
|
static const RefId Sneak;
|
||||||
Security = 18,
|
static const RefId Acrobatics;
|
||||||
Sneak = 19,
|
static const RefId LightArmor;
|
||||||
Acrobatics = 20,
|
static const RefId ShortBlade;
|
||||||
LightArmor = 21,
|
static const RefId Marksman;
|
||||||
ShortBlade = 22,
|
static const RefId Mercantile;
|
||||||
Marksman = 23,
|
static const RefId Speechcraft;
|
||||||
Mercantile = 24,
|
static const RefId HandToHand;
|
||||||
Speechcraft = 25,
|
static constexpr int Length = 27;
|
||||||
HandToHand = 26,
|
|
||||||
Length
|
|
||||||
};
|
|
||||||
static const std::string sSkillNames[Length];
|
static const std::string sSkillNames[Length];
|
||||||
|
|
||||||
static SkillEnum stringToSkillId(std::string_view skill);
|
static int stringToSkillId(std::string_view skill);
|
||||||
|
|
||||||
void load(ESMReader& esm, bool& isDeleted);
|
void load(ESMReader& esm, bool& isDeleted);
|
||||||
void save(ESMWriter& esm, bool isDeleted = false) const;
|
void save(ESMWriter& esm, bool isDeleted = false) const;
|
||||||
|
|
|
||||||
|
|
@ -109,13 +109,13 @@ namespace ESM
|
||||||
ESM::RefId mSoundIdUp;
|
ESM::RefId mSoundIdUp;
|
||||||
std::string mAttachBone;
|
std::string mAttachBone;
|
||||||
std::string mSheathingBone;
|
std::string mSheathingBone;
|
||||||
Skill::SkillEnum mSkill;
|
ESM::RefId mSkill;
|
||||||
Class mWeaponClass;
|
Class mWeaponClass;
|
||||||
int mAmmoType;
|
int mAmmoType;
|
||||||
int mFlags;
|
int mFlags;
|
||||||
|
|
||||||
WeaponType(std::string shortGroup, std::string longGroup, const std::string& soundId, std::string attachBone,
|
WeaponType(std::string shortGroup, std::string longGroup, const std::string& soundId, std::string attachBone,
|
||||||
std::string sheathingBone, Skill::SkillEnum skill, Class weaponClass, int ammoType, int flags)
|
std::string sheathingBone, ESM::RefId skill, Class weaponClass, int ammoType, int flags)
|
||||||
: mShortGroup(std::move(shortGroup))
|
: mShortGroup(std::move(shortGroup))
|
||||||
, mLongGroup(std::move(longGroup))
|
, mLongGroup(std::move(longGroup))
|
||||||
, mSoundIdDown(ESM::RefId::stringRefId(soundId + " Down"))
|
, mSoundIdDown(ESM::RefId::stringRefId(soundId + " Down"))
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ namespace ESM
|
||||||
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
|
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
|
||||||
if (mObject.mNpcStats.mIsWerewolf)
|
if (mObject.mNpcStats.mIsWerewolf)
|
||||||
{
|
{
|
||||||
if (i == Skill::Acrobatics)
|
constexpr int Acrobatics = 20;
|
||||||
|
if (i == Acrobatics)
|
||||||
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
|
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
|
||||||
mObject.mNpcStats.mSkills[i] = skill;
|
mObject.mNpcStats.mSkills[i] = skill;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue