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; std::string text;
if (Settings::Manager::getBool("show effect duration","Game")) 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::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}");
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}"); 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>(); 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 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); int remainingHealth = getItemHealth(ptr);
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/" text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth); + MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
} }
// add reach and attack speed for melee weapon const bool verbose = Settings::Manager::getBool("show melee info", "Game");
if (ref->mBase->mData.mType < 9 && 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 // display value in feet
const float combatDistance = store.get<ESM::GameSetting>().find("fCombatDistance")->mValue.getFloat() * ref->mBase->mData.mReach; const float combatDistance = store.get<ESM::GameSetting>().find("fCombatDistance")->mValue.getFloat() * ref->mBase->mData.mReach;
text += MWGui::ToolTips::getWeightString(combatDistance / Constants::UnitsPerFoot, "#{sRange}"); text += MWGui::ToolTips::getWeightString(combatDistance / Constants::UnitsPerFoot, "#{sRange}");
text += " #{sFeet}"; 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}"); text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}");
} }

View File

@ -119,7 +119,7 @@ namespace MWMechanics
rating *= getHitChance(actor, enemy, value) / 100.f; 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; rating *= weapon->mData.mSpeed;
return rating * ratingMult; return rating * ratingMult;

View File

@ -36,7 +36,7 @@ show melee info
:Range: True/False :Range: True/False
:Default: 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. 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 damage bonus of arrow and bolts.
show projectile damage = false 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 melee info = false
# Show success probability in self-enchant dialog # Show success probability in self-enchant dialog