mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 07:32:00 -04:00
Armor tooltip should show the effective armor rating
This commit is contained in:
parent
2f2a95f735
commit
239c0071f5
@ -245,7 +245,8 @@ namespace MWClass
|
|||||||
else
|
else
|
||||||
typeText = "#{sHeavy}";
|
typeText = "#{sHeavy}";
|
||||||
|
|
||||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->mBase->mData.mArmor);
|
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
|
||||||
|
MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||||
|
|
||||||
int remainingHealth = getItemHealth(ptr);
|
int remainingHealth = getItemHealth(ptr);
|
||||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||||
@ -290,6 +291,22 @@ namespace MWClass
|
|||||||
return record->mId;
|
return record->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Armor::getEffectiveArmorRating(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
|
int armorSkillType = getEquipmentSkill(ptr);
|
||||||
|
int armorSkill = actor.getClass().getSkill(actor, armorSkillType);
|
||||||
|
|
||||||
|
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
int iBaseArmorSkill = world->getStore().get<ESM::GameSetting>().find("iBaseArmorSkill")->getInt();
|
||||||
|
|
||||||
|
if(ref->mBase->mData.mWeight == 0)
|
||||||
|
return ref->mBase->mData.mArmor;
|
||||||
|
else
|
||||||
|
return ref->mBase->mData.mArmor * armorSkill / iBaseArmorSkill;
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<int, std::string> Armor::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
std::pair<int, std::string> Armor::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc);
|
MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc);
|
||||||
|
@ -86,6 +86,9 @@ namespace MWClass
|
|||||||
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
|
|
||||||
|
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
||||||
|
virtual int getEffectiveArmorRating(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,7 +1086,6 @@ namespace MWClass
|
|||||||
MWMechanics::NpcStats &stats = getNpcStats(ptr);
|
MWMechanics::NpcStats &stats = getNpcStats(ptr);
|
||||||
MWWorld::InventoryStore &invStore = getInventoryStore(ptr);
|
MWWorld::InventoryStore &invStore = getInventoryStore(ptr);
|
||||||
|
|
||||||
int iBaseArmorSkill = store.find("iBaseArmorSkill")->getInt();
|
|
||||||
float fUnarmoredBase1 = store.find("fUnarmoredBase1")->getFloat();
|
float fUnarmoredBase1 = store.find("fUnarmoredBase1")->getFloat();
|
||||||
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
||||||
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
||||||
@ -1102,15 +1101,7 @@ namespace MWClass
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Armor> *ref = it->get<ESM::Armor>();
|
ratings[i] = it->getClass().getEffectiveArmorRating(*it, ptr);
|
||||||
|
|
||||||
int armorSkillType = it->getClass().getEquipmentSkill(*it);
|
|
||||||
int armorSkill = stats.getSkill(armorSkillType).getModified();
|
|
||||||
|
|
||||||
if(ref->mBase->mData.mWeight == 0)
|
|
||||||
ratings[i] = ref->mBase->mData.mArmor;
|
|
||||||
else
|
|
||||||
ratings[i] = ref->mBase->mData.mArmor * armorSkill / iBaseArmorSkill;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,4 +454,9 @@ namespace MWWorld
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Class::getEffectiveArmorRating(const Ptr &ptr, const Ptr &actor) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error("class does not support armor ratings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,6 +347,9 @@ namespace MWWorld
|
|||||||
|
|
||||||
virtual std::string getPrimaryFaction (const MWWorld::Ptr& ptr) const;
|
virtual std::string getPrimaryFaction (const MWWorld::Ptr& ptr) const;
|
||||||
virtual int getPrimaryFactionRank (const MWWorld::Ptr& ptr) const;
|
virtual int getPrimaryFactionRank (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
|
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
||||||
|
virtual int getEffectiveArmorRating(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user