mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-14 00:09:41 +00:00
Added armor check
This commit is contained in:
parent
955fe3e8cf
commit
97fc8acbdb
4 changed files with 89 additions and 9 deletions
|
@ -13,7 +13,8 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefId
|
||||||
mBooksSize(0),
|
mBooksSize(0),
|
||||||
mActivatorsSize(0),
|
mActivatorsSize(0),
|
||||||
mPotionsSize(0),
|
mPotionsSize(0),
|
||||||
mApparatiSize(0)
|
mApparatiSize(0),
|
||||||
|
mArmorsSzie(0)
|
||||||
{
|
{
|
||||||
setSizeVariables();
|
setSizeVariables();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +25,7 @@ void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
||||||
mActivatorsSize = mReferencables.getActivators().getSize();
|
mActivatorsSize = mReferencables.getActivators().getSize();
|
||||||
mPotionsSize = mReferencables.getPotions().getSize();
|
mPotionsSize = mReferencables.getPotions().getSize();
|
||||||
mApparatiSize = mReferencables.getApparati().getSize();
|
mApparatiSize = mReferencables.getApparati().getSize();
|
||||||
|
mArmorsSzie = mReferencables.getArmors().getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
||||||
|
@ -60,6 +62,14 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
|
||||||
}
|
}
|
||||||
|
|
||||||
stage -= mApparatiSize;
|
stage -= mApparatiSize;
|
||||||
|
|
||||||
|
if (stage < mArmorsSzie)
|
||||||
|
{
|
||||||
|
armorCheck(stage, mReferencables.getArmors(), messages);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stage -= mArmorsSzie;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMTools::ReferenceableCheckStage::setup()
|
int CSMTools::ReferenceableCheckStage::setup()
|
||||||
|
@ -176,6 +186,7 @@ void CSMTools::ReferenceableCheckStage::potionCheck(int stage, const CSMWorld::R
|
||||||
{
|
{
|
||||||
messages.push_back(id.toString() + "|" + Potion.mId + " has no icon");
|
messages.push_back(id.toString() + "|" + Potion.mId + " has no icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IIRC potion can have empty effects list just fine.
|
//IIRC potion can have empty effects list just fine.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,3 +239,64 @@ void CSMTools::ReferenceableCheckStage::apparatusCheck(int stage, const CSMWorld
|
||||||
messages.push_back(id.toString() + "|" + Apparatus.mId + " has non-positive quality");
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has non-positive quality");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMTools::ReferenceableCheckStage::armorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Armor >& records, std::vector< std::string >& messages)
|
||||||
|
{
|
||||||
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
||||||
|
|
||||||
|
if (baserecord.isDeleted())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ESM::Armor& Armor = (static_cast<const CSMWorld::Record<ESM::Armor>& >(baserecord)).get();
|
||||||
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Armor, Armor.mId);
|
||||||
|
|
||||||
|
//Checking for name
|
||||||
|
if (Armor.mName.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has an empty name");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Checking for weight
|
||||||
|
if (Armor.mData.mWeight < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative weight");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Checking for value
|
||||||
|
if (Armor.mData.mValue < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative value");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for model
|
||||||
|
if (Armor.mModel.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has no model");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for icon
|
||||||
|
if (Armor.mIcon.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has no icon");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for enchantment points
|
||||||
|
if (Armor.mData.mEnchant < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative enchantment");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for armor class, armor should have poistive armor class, but 0 is considered legal
|
||||||
|
if (Armor.mData.mArmor < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative armor class");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for health. Only positive numbers are allowed, and 0 is illegal
|
||||||
|
if (Armor.mData.mHealth <= 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Armor.mId + " has non positive health");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace CSMTools
|
||||||
void activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages);
|
void activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages);
|
||||||
void potionCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Potion>& records, std::vector<std::string>& messages);
|
void potionCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Potion>& records, std::vector<std::string>& messages);
|
||||||
void apparatusCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Apparatus>& records, std::vector<std::string>& messages);
|
void apparatusCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Apparatus>& records, std::vector<std::string>& messages);
|
||||||
|
void armorCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Armor>& records, std::vector<std::string>& messages);
|
||||||
|
|
||||||
void setSizeVariables();
|
void setSizeVariables();
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ namespace CSMTools
|
||||||
int mActivatorsSize;
|
int mActivatorsSize;
|
||||||
int mPotionsSize;
|
int mPotionsSize;
|
||||||
int mApparatiSize;
|
int mApparatiSize;
|
||||||
|
int mArmorsSzie;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // REFERENCEABLECHECKSTAGE_H
|
#endif // REFERENCEABLECHECKSTAGE_H
|
||||||
|
|
|
@ -251,3 +251,8 @@ const CSMWorld::RefIdDataContainer< ESM::Apparatus >& CSMWorld::RefIdData::getAp
|
||||||
{
|
{
|
||||||
return mApparati;
|
return mApparati;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CSMWorld::RefIdDataContainer< ESM::Armor >& CSMWorld::RefIdData::getArmors() const
|
||||||
|
{
|
||||||
|
return mArmors;
|
||||||
|
}
|
||||||
|
|
|
@ -225,6 +225,7 @@ namespace CSMWorld
|
||||||
const RefIdDataContainer<ESM::Activator>& getActivators() const;
|
const RefIdDataContainer<ESM::Activator>& getActivators() const;
|
||||||
const RefIdDataContainer<ESM::Potion>& getPotions() const;
|
const RefIdDataContainer<ESM::Potion>& getPotions() const;
|
||||||
const RefIdDataContainer<ESM::Apparatus>& getApparati() const;
|
const RefIdDataContainer<ESM::Apparatus>& getApparati() const;
|
||||||
|
const RefIdDataContainer<ESM::Armor>& getArmors() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue