mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Refactorization
This commit is contained in:
parent
4e17bc1499
commit
b40e24c50c
4 changed files with 33 additions and 33 deletions
|
@ -61,7 +61,7 @@ namespace MWGui
|
|||
void EnchantingDialog::updateLabels()
|
||||
{
|
||||
std::stringstream enchantCost;
|
||||
enchantCost << std::setprecision(1) << std::fixed << mEnchanting.getEnchantCost();
|
||||
enchantCost << std::setprecision(1) << std::fixed << mEnchanting.getEnchantPoints();
|
||||
mEnchantmentPoints->setCaption(enchantCost.str() + " / " + boost::lexical_cast<std::string>(mEnchanting.getMaxEnchantValue()));
|
||||
|
||||
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge()));
|
||||
|
@ -74,19 +74,19 @@ namespace MWGui
|
|||
|
||||
switch(mEnchanting.getCastStyle())
|
||||
{
|
||||
case ESM::CS_CastOnce:
|
||||
case ESM::CastingStyle_CastOnce:
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce","Cast Once"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case ESM::CS_WhenStrikes:
|
||||
case ESM::CastingStyle_WhenStrikes:
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case ESM::CS_WhenUsed:
|
||||
case ESM::CastingStyle_WhenUsed:
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenUsed", "When Used"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case ESM::CS_ConstantEffect:
|
||||
case ESM::CastingStyle_ConstantEffect:
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastConstant", "Cast Constant"));
|
||||
mAddEffectDialog.constantEffect=true;
|
||||
break;
|
||||
|
@ -280,7 +280,7 @@ namespace MWGui
|
|||
return;
|
||||
}
|
||||
|
||||
if (mEnchanting.getEnchantCost() > mEnchanting.getMaxEnchantValue())
|
||||
if (mEnchanting.getEnchantPoints() > mEnchanting.getMaxEnchantValue())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage29}");
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace MWMechanics
|
||||
{
|
||||
Enchanting::Enchanting():
|
||||
mCastStyle(ESM::CS_CastOnce)
|
||||
mCastStyle(ESM::CastingStyle_CastOnce)
|
||||
{}
|
||||
|
||||
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
||||
|
@ -74,12 +74,12 @@ namespace MWMechanics
|
|||
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 1);
|
||||
}
|
||||
|
||||
if(mCastStyle==ESM::CS_ConstantEffect)
|
||||
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
||||
{
|
||||
enchantment.mData.mCharge=0;
|
||||
}
|
||||
enchantment.mData.mType = mCastStyle;
|
||||
enchantment.mData.mCost = getEnchantCost();
|
||||
enchantment.mData.mCost = getEnchantPoints();
|
||||
enchantment.mEffects = mEffectList;
|
||||
|
||||
const ESM::Enchantment *enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord (enchantment);
|
||||
|
@ -102,7 +102,7 @@ namespace MWMechanics
|
|||
{
|
||||
if (itemEmpty())
|
||||
{
|
||||
mCastStyle = ESM::CS_WhenUsed;
|
||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,12 +112,12 @@ namespace MWMechanics
|
|||
{ // Armor or Clothing
|
||||
switch(mCastStyle)
|
||||
{
|
||||
case ESM::CS_WhenUsed:
|
||||
case ESM::CastingStyle_WhenUsed:
|
||||
if (powerfulSoul)
|
||||
mCastStyle = ESM::CS_ConstantEffect;
|
||||
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
||||
return;
|
||||
default: // takes care of Constant effect too
|
||||
mCastStyle = ESM::CS_WhenUsed;
|
||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -125,28 +125,28 @@ namespace MWMechanics
|
|||
{ // Weapon
|
||||
switch(mCastStyle)
|
||||
{
|
||||
case ESM::CS_WhenStrikes:
|
||||
mCastStyle = ESM::CS_WhenUsed;
|
||||
case ESM::CastingStyle_WhenStrikes:
|
||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
||||
return;
|
||||
case ESM::CS_WhenUsed:
|
||||
case ESM::CastingStyle_WhenUsed:
|
||||
if (powerfulSoul)
|
||||
mCastStyle = ESM::CS_ConstantEffect;
|
||||
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
||||
else
|
||||
mCastStyle = ESM::CS_WhenStrikes;
|
||||
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
||||
return;
|
||||
default: // takes care of Constant effect too
|
||||
mCastStyle = ESM::CS_WhenStrikes;
|
||||
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(mObjectType == typeid(ESM::Book).name())
|
||||
{ // Scroll or Book
|
||||
mCastStyle = ESM::CS_CastOnce;
|
||||
mCastStyle = ESM::CastingStyle_CastOnce;
|
||||
return;
|
||||
}
|
||||
|
||||
// Fail case
|
||||
mCastStyle = ESM::CS_CastOnce;
|
||||
mCastStyle = ESM::CastingStyle_CastOnce;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -163,7 +163,7 @@ namespace MWMechanics
|
|||
*
|
||||
* Formula on UESPWiki is not entirely correct.
|
||||
*/
|
||||
float Enchanting::getEnchantCost() const
|
||||
float Enchanting::getEnchantPoints() const
|
||||
{
|
||||
if (mEffectList.mList.empty())
|
||||
// No effects added, cost = 0
|
||||
|
@ -184,7 +184,7 @@ namespace MWMechanics
|
|||
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
||||
area = (it->mArea == 0) ? 1 : it->mArea;
|
||||
|
||||
if (mCastStyle == ESM::CS_ConstantEffect)
|
||||
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
||||
{
|
||||
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
||||
}
|
||||
|
@ -209,10 +209,10 @@ namespace MWMechanics
|
|||
|
||||
float Enchanting::getCastCost() const
|
||||
{
|
||||
if (mCastStyle == ESM::CS_ConstantEffect)
|
||||
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
||||
return 0;
|
||||
|
||||
const float enchantCost = getEnchantCost();
|
||||
const float enchantCost = getEnchantPoints();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
|
@ -233,7 +233,7 @@ namespace MWMechanics
|
|||
return 0;
|
||||
|
||||
float priceMultipler = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentValueMult")->getFloat();
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mEnchanter, (getEnchantCost() * priceMultipler), true);
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mEnchanter, (getEnchantPoints() * priceMultipler), true);
|
||||
return price;
|
||||
}
|
||||
|
||||
|
@ -290,8 +290,8 @@ namespace MWMechanics
|
|||
(0.25 * creatureStats.getAttribute (ESM::Attribute::Intelligence).getModified())
|
||||
+ (0.125 * creatureStats.getAttribute (ESM::Attribute::Luck).getModified()));
|
||||
|
||||
float chance2 = 2.5 * getEnchantCost();
|
||||
if(mCastStyle==ESM::CS_ConstantEffect)
|
||||
float chance2 = 2.5 * getEnchantPoints();
|
||||
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
||||
{
|
||||
float constantChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentConstantChanceMult")->getFloat();
|
||||
chance2 /= constantChance;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace MWMechanics
|
|||
bool create(); //Return true if created, false if failed.
|
||||
void nextCastStyle(); //Set enchant type to next possible type (for mOldItemPtr object)
|
||||
int getCastStyle() const;
|
||||
float getEnchantCost() const;
|
||||
float getEnchantPoints() const;
|
||||
float getCastCost() const;
|
||||
int getEnchantPrice() const;
|
||||
float getMaxEnchantValue() const;
|
||||
|
|
|
@ -26,10 +26,10 @@ enum RangeType
|
|||
// Casting style (in enchanting)
|
||||
enum CastingStyle
|
||||
{
|
||||
CS_CastOnce = 0,
|
||||
CS_WhenStrikes = 1,
|
||||
CS_WhenUsed = 2,
|
||||
CS_ConstantEffect = 3
|
||||
CastingStyle_CastOnce = 0,
|
||||
CastingStyle_WhenStrikes = 1,
|
||||
CastingStyle_WhenUsed = 2,
|
||||
CastingStyle_ConstantEffect = 3
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
|
|
Loading…
Reference in a new issue