mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-03 07:11:35 +00:00
Remove the now unused npcstats methods useSkill and increaseSkill
This commit is contained in:
parent
9f15f3b431
commit
264a8c0669
2 changed files with 0 additions and 89 deletions
|
@ -209,90 +209,6 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(ESM::RefId id, const ES
|
|||
return progressRequirement;
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::useSkill(ESM::RefId id, const ESM::Class& class_, int usageType, float extraFactor)
|
||||
{
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(id);
|
||||
float skillGain = 1;
|
||||
if (usageType >= 4)
|
||||
throw std::runtime_error("skill usage type out of range");
|
||||
if (usageType >= 0)
|
||||
{
|
||||
skillGain = skill->mData.mUseValue[usageType];
|
||||
if (skillGain < 0)
|
||||
throw std::runtime_error("invalid skill gain factor");
|
||||
}
|
||||
skillGain *= extraFactor;
|
||||
|
||||
MWMechanics::SkillValue& value = getSkill(skill->mId);
|
||||
|
||||
value.setProgress(value.getProgress() + skillGain);
|
||||
|
||||
if (int(value.getProgress()) >= int(getSkillProgressRequirement(skill->mId, class_)))
|
||||
{
|
||||
// skill levelled up
|
||||
increaseSkill(skill->mId, class_, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::increaseSkill(ESM::RefId id, const ESM::Class& class_, bool preserveProgress, bool readBook)
|
||||
{
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(id);
|
||||
float base = getSkill(skill->mId).getBase();
|
||||
|
||||
if (base >= 100.f)
|
||||
return;
|
||||
|
||||
base += 1;
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
|
||||
|
||||
// is this a minor or major skill?
|
||||
int increase = gmst.find("iLevelupMiscMultAttriubte")->mValue.getInteger(); // Note: GMST has a typo
|
||||
int index = ESM::Skill::refIdToIndex(skill->mId);
|
||||
for (const auto& skills : class_.mData.mSkills)
|
||||
{
|
||||
if (skills[0] == index)
|
||||
{
|
||||
mLevelProgress += gmst.find("iLevelUpMinorMult")->mValue.getInteger();
|
||||
increase = gmst.find("iLevelUpMinorMultAttribute")->mValue.getInteger();
|
||||
break;
|
||||
}
|
||||
else if (skills[1] == index)
|
||||
{
|
||||
mLevelProgress += gmst.find("iLevelUpMajorMult")->mValue.getInteger();
|
||||
increase = gmst.find("iLevelUpMajorMultAttribute")->mValue.getInteger();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mSkillIncreases[ESM::Attribute::indexToRefId(skill->mData.mAttribute)] += increase;
|
||||
|
||||
mSpecIncreases[skill->mData.mSpecialization] += gmst.find("iLevelupSpecialization")->mValue.getInteger();
|
||||
|
||||
// Play sound & skill progress notification
|
||||
/// \todo check if character is the player, if levelling is ever implemented for NPCs
|
||||
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("skillraise"));
|
||||
|
||||
std::string message{ MWBase::Environment::get().getWindowManager()->getGameSettingString("sNotifyMessage39", {}) };
|
||||
message = Misc::StringUtils::format(
|
||||
message, MyGUI::TextIterator::toTagsString(skill->mName).asUTF8(), static_cast<int>(base));
|
||||
|
||||
if (readBook)
|
||||
message = "#{sBookSkillMessage}\n" + message;
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(message, MWGui::ShowInDialogueMode_Never);
|
||||
|
||||
if (mLevelProgress >= gmst.find("iLevelUpTotal")->mValue.getInteger())
|
||||
{
|
||||
// levelup is possible now
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sLevelUpMsg}", MWGui::ShowInDialogueMode_Never);
|
||||
}
|
||||
|
||||
getSkill(skill->mId).setBase(base);
|
||||
if (!preserveProgress)
|
||||
getSkill(skill->mId).setProgress(0);
|
||||
}
|
||||
|
||||
int MWMechanics::NpcStats::getLevelProgress() const
|
||||
{
|
||||
return mLevelProgress;
|
||||
|
|
|
@ -87,11 +87,6 @@ namespace MWMechanics
|
|||
|
||||
float getSkillProgressRequirement(ESM::RefId id, const ESM::Class& class_) const;
|
||||
|
||||
void useSkill(ESM::RefId id, const ESM::Class& class_, int usageType = -1, float extraFactor = 1.f);
|
||||
///< Increase skill by usage.
|
||||
|
||||
void increaseSkill(ESM::RefId id, const ESM::Class& class_, bool preserveProgress, bool readBook = false);
|
||||
|
||||
int getLevelProgress() const;
|
||||
void setLevelProgress(int progress);
|
||||
|
||||
|
|
Loading…
Reference in a new issue