Use class service flags for autocalc NPCs

focus_on_focal
Evil Eye 2 years ago
parent de83a41de6
commit 60c26832d2

@ -20,6 +20,7 @@
Bug #6993: Shooting your last round of ammunition causes the attack animation to cancel
Bug #7009: Falling actors teleport to the ground without receiving any damage on cell loading
Bug #7034: Misc items defined in one content file are not treated as keys if another content file uses them as such
Bug #7044: Changing a class' services does not affect autocalculated NPCs
Feature #6933: Support high-resolution cursor textures
Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData
Feature #6979: Add support of loading and displaying LOD assets purely based on their filename extension

@ -607,7 +607,7 @@ namespace EsmTool
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl;
std::cout << " Playable: " << mData.mData.mIsPlayable << std::endl;
std::cout << " AutoCalc: " << mData.mData.mCalc << std::endl;
std::cout << " AI Services: " << Misc::StringUtils::format("0x%08X", mData.mData.mServices) << std::endl;
std::cout << " Attribute1: " << attributeLabel(mData.mData.mAttribute[0]) << " (" << mData.mData.mAttribute[0]
<< ")" << std::endl;
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute[1]) << " (" << mData.mData.mAttribute[1]

@ -1274,7 +1274,14 @@ namespace MWClass
int Npc::getServices(const MWWorld::ConstPtr& actor) const
{
return actor.get<ESM::NPC>()->mBase->mAiData.mServices;
const ESM::NPC* npc = actor.get<ESM::NPC>()->mBase;
if (npc->mFlags & ESM::NPC::Autocalc)
{
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
return class_->mData.mServices;
}
return npc->mAiData.mServices;
}
std::string_view Npc::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const

@ -96,7 +96,7 @@ namespace ESM
mData.mAttribute[0] = mData.mAttribute[1] = 0;
mData.mSpecialization = 0;
mData.mIsPlayable = 0;
mData.mCalc = 0;
mData.mServices = 0;
for (int i = 0; i < 5; ++i)
for (int i2 = 0; i2 < 2; ++i2)

@ -14,9 +14,6 @@ namespace ESM
/*
* Character class definitions
*/
// These flags tells us which items should be auto-calculated for this
// class
struct Class
{
constexpr static RecNameInts sRecordId = REC_CLAS;
@ -24,28 +21,6 @@ namespace ESM
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "Class"; }
enum AutoCalc
{
Weapon = 0x00001,
Armor = 0x00002,
Clothing = 0x00004,
Books = 0x00008,
Ingredient = 0x00010,
Lockpick = 0x00020,
Probe = 0x00040,
Lights = 0x00080,
Apparatus = 0x00100,
Repair = 0x00200,
Misc = 0x00400,
Spells = 0x00800,
MagicItems = 0x01000,
Potions = 0x02000,
Training = 0x04000,
Spellmaking = 0x08000,
Enchanting = 0x10000,
RepairItem = 0x20000
};
enum Specialization
{
Combat = 0,
@ -62,9 +37,7 @@ namespace ESM
int mSpecialization; // 0 = Combat, 1 = Magic, 2 = Stealth
int mSkills[5][2]; // Minor and major skills.
int mIsPlayable; // 0x0001 - Playable class
// I have no idea how to autocalculate these items...
int mCalc;
int mServices;
int& getSkill(int index, bool major);
///< Throws an exception for invalid values of \a index.

Loading…
Cancel
Save