1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:23:54 +00:00

Merged pull request #1928

This commit is contained in:
Marc Zinnschlag 2018-09-20 13:31:56 +02:00
commit 3761aaadfd
5 changed files with 18 additions and 8 deletions

View file

@ -161,7 +161,12 @@ namespace MWClass
std::string text;
if (Settings::Manager::getBool("show effect duration","Game"))
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(ptr.getClass().getRemainingUsageTime(ptr));
{
// -1 is infinite light source, so duration makes no sense here. Other negative values are treated as 0.
float remainingTime = ptr.getClass().getRemainingUsageTime(ptr);
if (remainingTime != -1.0f)
text += "\n#{sDuration}: " + MWGui::ToolTips::toString(std::max(0.f, remainingTime));
}
text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");

View file

@ -66,7 +66,7 @@ namespace MWClass
{
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
return (ref->mBase->mData.mType < 11); // thrown weapons and arrows/bolts don't have health, only quantity
return (ref->mBase->mData.mType < ESM::Weapon::MarksmanThrown); // thrown weapons and arrows/bolts don't have health, only quantity
}
int Weapon::getItemMaxHealth (const MWWorld::ConstPtr& ptr) const
@ -319,21 +319,26 @@ namespace MWClass
}
}
if (ref->mBase->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
if (hasItemHealth(ptr))
{
int remainingHealth = getItemHealth(ptr);
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
}
// add reach and attack speed for melee weapon
if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game"))
const bool verbose = Settings::Manager::getBool("show melee info", "Game");
// add reach for melee weapon
if (ref->mBase->mData.mType < ESM::Weapon::MarksmanBow && verbose)
{
// display value in feet
const float combatDistance = store.get<ESM::GameSetting>().find("fCombatDistance")->mValue.getFloat() * ref->mBase->mData.mReach;
text += MWGui::ToolTips::getWeightString(combatDistance / Constants::UnitsPerFoot, "#{sRange}");
text += " #{sFeet}";
}
// add attack speed for any weapon excepts arrows and bolts
if (ref->mBase->mData.mType < ESM::Weapon::Arrow && verbose)
{
text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}");
}

View file

@ -119,7 +119,7 @@ namespace MWMechanics
rating *= getHitChance(actor, enemy, value) / 100.f;
if (weapon->mData.mType < ESM::Weapon::MarksmanBow)
if (weapon->mData.mType < ESM::Weapon::Arrow)
rating *= weapon->mData.mSpeed;
return rating * ratingMult;

View file

@ -36,7 +36,7 @@ show melee info
:Range: True/False
:Default: False
If this setting is true, the reach and speed of melee weapons will show on their tooltip.
If this setting is true, the reach and speed of weapons will show on their tooltip.
This setting can only be configured by editing the settings configuration file.

View file

@ -188,7 +188,7 @@ show owned = 0
# Show damage bonus of arrow and bolts.
show projectile damage = false
# Show additional melee weapon info: reach and attack speed
# Show additional weapon info: reach and attack speed
show melee info = false
# Show success probability in self-enchant dialog