Show attack speed of ranged weapons

pull/541/head
Andrei Kortunov 6 years ago
parent 989de05f80
commit 62f6f174cf

@ -65,7 +65,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
@ -318,21 +318,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)
{ {
// 64 game units = 1 yard = 3 ft, display value in feet // 64 game units = 1 yard = 3 ft, 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*3/64, "#{sRange}"); text += MWGui::ToolTips::getWeightString(combatDistance*3/64, "#{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}");
} }

@ -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.

@ -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

Loading…
Cancel
Save