mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Merge remote-tracking branch 'miroslavr/master'
This commit is contained in:
commit
f1f38fc786
@ -24,7 +24,7 @@ namespace MWGui
|
||||
|
||||
EnchantingDialog::EnchantingDialog()
|
||||
: WindowBase("openmw_enchanting_dialog.layout")
|
||||
, EffectEditorBase()
|
||||
, EffectEditorBase(EffectEditorBase::Enchanting)
|
||||
, mItemSelectionDialog(NULL)
|
||||
{
|
||||
getWidget(mName, "NameEdit");
|
||||
@ -87,6 +87,7 @@ namespace MWGui
|
||||
}
|
||||
else
|
||||
{
|
||||
mName->setCaption(item.getClass().getName(item));
|
||||
mItemBox->setItem(item);
|
||||
mItemBox->setUserString ("ToolTipType", "ItemPtr");
|
||||
mItemBox->setUserData(item);
|
||||
@ -208,6 +209,7 @@ namespace MWGui
|
||||
else
|
||||
{
|
||||
setItem(MWWorld::Ptr());
|
||||
updateLabels();
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,6 +218,7 @@ namespace MWGui
|
||||
mItemSelectionDialog->setVisible(false);
|
||||
|
||||
setItem(item);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1);
|
||||
mEnchanting.nextCastStyle();
|
||||
updateLabels();
|
||||
}
|
||||
@ -237,6 +240,7 @@ namespace MWGui
|
||||
}
|
||||
|
||||
setSoulGem(item);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1);
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
|
@ -471,6 +471,7 @@ namespace MWGui
|
||||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
mWeapBox->clearUserStrings();
|
||||
mWeapBox->setUserString("ToolTipType", "ItemPtr");
|
||||
mWeapBox->setUserData(item);
|
||||
|
||||
@ -515,12 +516,14 @@ namespace MWGui
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
mWeapImage->setItem(MWWorld::Ptr());
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
mWeapImage->setIcon("icons\\k\\tx_werewolf_hand.dds");
|
||||
else
|
||||
mWeapImage->setIcon("icons\\k\\stealth_handtohand.dds");
|
||||
std::string icon = (player.getClass().getNpcStats(player).isWerewolf()) ? "icons\\k\\tx_werewolf_hand.dds" : "icons\\k\\stealth_handtohand.dds";
|
||||
mWeapImage->setIcon(icon);
|
||||
|
||||
mWeapBox->clearUserStrings();
|
||||
mWeapBox->setUserString("ToolTipType", "Layout");
|
||||
mWeapBox->setUserString("ToolTipLayout", "HandToHandToolTip");
|
||||
mWeapBox->setUserString("Caption_HandToHandText", itemName);
|
||||
mWeapBox->setUserString("ImageTexture_HandToHandImage", icon);
|
||||
}
|
||||
|
||||
void HUD::setCrosshairVisible(bool visible)
|
||||
|
@ -287,7 +287,7 @@ namespace MWGui
|
||||
|
||||
SpellCreationDialog::SpellCreationDialog()
|
||||
: WindowBase("openmw_spellcreation_dialog.layout")
|
||||
, EffectEditorBase()
|
||||
, EffectEditorBase(EffectEditorBase::Spellmaking)
|
||||
{
|
||||
getWidget(mNameEdit, "NameEdit");
|
||||
getWidget(mMagickaCost, "MagickaCost");
|
||||
@ -444,10 +444,11 @@ namespace MWGui
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
EffectEditorBase::EffectEditorBase()
|
||||
EffectEditorBase::EffectEditorBase(Type type)
|
||||
: mAddEffectDialog()
|
||||
, mSelectAttributeDialog(NULL)
|
||||
, mSelectSkillDialog(NULL)
|
||||
, mType(type)
|
||||
{
|
||||
mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded);
|
||||
mAddEffectDialog.eventEffectModified += MyGUI::newDelegate(this, &EffectEditorBase::onEffectModified);
|
||||
@ -482,6 +483,13 @@ namespace MWGui
|
||||
const std::vector<ESM::ENAMstruct>& list = spell->mEffects.mList;
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2)
|
||||
{
|
||||
const ESM::MagicEffect * effect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it2->mEffectID);
|
||||
|
||||
// skip effects that do not allow spellmaking/enchanting
|
||||
int requiredFlags = (mType == Spellmaking) ? ESM::MagicEffect::AllowSpellmaking : ESM::MagicEffect::AllowEnchanting;
|
||||
if (!(effect->mData.mFlags & requiredFlags))
|
||||
continue;
|
||||
|
||||
if (std::find(knownEffects.begin(), knownEffects.end(), it2->mEffectID) == knownEffects.end())
|
||||
knownEffects.push_back(it2->mEffectID);
|
||||
}
|
||||
|
@ -85,7 +85,13 @@ namespace MWGui
|
||||
class EffectEditorBase
|
||||
{
|
||||
public:
|
||||
EffectEditorBase();
|
||||
enum Type
|
||||
{
|
||||
Spellmaking,
|
||||
Enchanting
|
||||
};
|
||||
|
||||
EffectEditorBase(Type type);
|
||||
virtual ~EffectEditorBase();
|
||||
|
||||
protected:
|
||||
@ -121,6 +127,9 @@ namespace MWGui
|
||||
void setWidgets (Widgets::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
|
||||
|
||||
virtual void notifyEffectsChanged () {}
|
||||
|
||||
private:
|
||||
Type mType;
|
||||
};
|
||||
|
||||
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
|
||||
#include "mapwindow.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
@ -19,6 +20,7 @@
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
std::string ToolTips::sSchoolNames[] = {"#{sSchoolAlteration}", "#{sSchoolConjuration}", "#{sSchoolDestruction}", "#{sSchoolIllusion}", "#{sSchoolMysticism}", "#{sSchoolRestoration}"};
|
||||
|
||||
ToolTips::ToolTips() :
|
||||
Layout("openmw_tooltips.layout")
|
||||
@ -220,6 +222,12 @@ namespace MWGui
|
||||
params.mNoTarget = false;
|
||||
effects.push_back(params);
|
||||
}
|
||||
if (MWMechanics::spellIncreasesSkill(spell)) // display school of spells that contribute to skill progress
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int school = MWMechanics::getSpellSchool(spell, player);
|
||||
info.text = "#{sSchool}: " + sSchoolNames[school];
|
||||
}
|
||||
info.effects = effects;
|
||||
tooltipSize = createToolTip(info);
|
||||
}
|
||||
@ -739,19 +747,11 @@ namespace MWGui
|
||||
icon.insert(slashPos+1, "b_");
|
||||
icon = Misc::ResourceHelpers::correctIconPath(icon);
|
||||
|
||||
std::vector<std::string> schools;
|
||||
schools.push_back ("#{sSchoolAlteration}");
|
||||
schools.push_back ("#{sSchoolConjuration}");
|
||||
schools.push_back ("#{sSchoolDestruction}");
|
||||
schools.push_back ("#{sSchoolIllusion}");
|
||||
schools.push_back ("#{sSchoolMysticism}");
|
||||
schools.push_back ("#{sSchoolRestoration}");
|
||||
|
||||
widget->setUserString("ToolTipType", "Layout");
|
||||
widget->setUserString("ToolTipLayout", "MagicEffectToolTip");
|
||||
widget->setUserString("Caption_MagicEffectName", "#{" + name + "}");
|
||||
widget->setUserString("Caption_MagicEffectDescription", effect->mDescription);
|
||||
widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + schools[effect->mData.mSchool]);
|
||||
widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + sSchoolNames[effect->mData.mSchool]);
|
||||
widget->setUserString("ImageTexture_MagicEffectImage", icon);
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,8 @@ namespace MWGui
|
||||
/// Adjust position for a tooltip so that it doesn't leave the screen and does not obscure the mouse cursor
|
||||
void position(MyGUI::IntPoint& position, MyGUI::IntSize size, MyGUI::IntSize viewportSize);
|
||||
|
||||
static std::string sSchoolNames[6];
|
||||
|
||||
int mHorizontalScrollIndex;
|
||||
|
||||
|
||||
|
@ -151,6 +151,20 @@ namespace MWMechanics
|
||||
return school;
|
||||
}
|
||||
|
||||
bool spellIncreasesSkill(const ESM::Spell *spell)
|
||||
{
|
||||
if (spell->mData.mType == ESM::Spell::ST_Spell && !(spell->mData.mFlags & ESM::Spell::F_Always))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool spellIncreasesSkill(const std::string &spellId)
|
||||
{
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
return spellIncreasesSkill(spell);
|
||||
}
|
||||
|
||||
float getEffectResistanceAttribute (short effectId, const MagicEffects* actorEffects)
|
||||
{
|
||||
short resistanceEffect = ESM::MagicEffect::getResistanceEffect(effectId);
|
||||
@ -775,7 +789,7 @@ namespace MWMechanics
|
||||
}
|
||||
}
|
||||
|
||||
if (mCaster.getRefData().getHandle() == "player" && spell->mData.mType == ESM::Spell::ST_Spell)
|
||||
if (mCaster.getRefData().getHandle() == "player" && spellIncreasesSkill(spell))
|
||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||
spellSchoolToSkill(school), 0);
|
||||
|
||||
@ -874,5 +888,4 @@ namespace MWMechanics
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ namespace MWMechanics
|
||||
int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor);
|
||||
int getSpellSchool(const ESM::Spell* spell, const MWWorld::Ptr& actor);
|
||||
|
||||
/// Get whether or not the given spell contributes to skill progress.
|
||||
bool spellIncreasesSkill(const ESM::Spell* spell);
|
||||
bool spellIncreasesSkill(const std::string& spellId);
|
||||
|
||||
/// Get the resistance attribute against an effect for a given actor. This will add together
|
||||
/// ResistX and Weakness to X effects relevant against the given effect.
|
||||
float getEffectResistanceAttribute (short effectId, const MagicEffects* actorEffects);
|
||||
|
@ -42,8 +42,13 @@ void MagicEffect::load(ESMReader &esm)
|
||||
esm.getHNT(mIndex, "INDX");
|
||||
|
||||
esm.getHNT(mData, "MEDT", 36);
|
||||
if (mIndex>=0 && mIndex<NumberOfHardcodedFlags)
|
||||
mData.mFlags |= HardcodedFlags[mIndex];
|
||||
if (esm.getFormat() == 0)
|
||||
{
|
||||
// don't allow mods to change fixed flags in the legacy format
|
||||
mData.mFlags &= (AllowSpellmaking | AllowEnchanting | NegativeLight);
|
||||
if (mIndex>=0 && mIndex<NumberOfHardcodedFlags)
|
||||
mData.mFlags |= HardcodedFlags[mIndex];
|
||||
}
|
||||
|
||||
mIcon = esm.getHNOString("ITEX");
|
||||
mParticle = esm.getHNOString("PTEX");
|
||||
|
@ -16,6 +16,7 @@ struct MagicEffect
|
||||
|
||||
enum Flags
|
||||
{
|
||||
// Originally fixed flags (HardcodedFlags array consists of just these)
|
||||
TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure.
|
||||
TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure.
|
||||
NoDuration = 0x4, // Has no duration. Only runs effect once on cast.
|
||||
@ -28,8 +29,14 @@ struct MagicEffect
|
||||
UncappedDamage = 0x1000, // Negates multiple cap behaviours. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second.
|
||||
NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target.
|
||||
Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally.
|
||||
CasterLinked = 0x20000 // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
|
||||
CasterLinked = 0x20000, // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
|
||||
|
||||
// Originally modifiable flags
|
||||
AllowSpellmaking = 0x200, // Can be used for spellmaking
|
||||
AllowEnchanting = 0x400, // Can be used for enchanting
|
||||
NegativeLight = 0x800 // Negative light source
|
||||
};
|
||||
|
||||
enum MagnitudeDisplayType
|
||||
{
|
||||
MDT_None,
|
||||
|
@ -6,7 +6,7 @@
|
||||
<!-- Label -->
|
||||
<Widget type="TextBox" skin="HeaderText" position="0 0 186 18" name="LabelT" align="Left Top">
|
||||
<Property key="Caption" value="Choose a Specialization"/>
|
||||
<Property key="TextAlign" value="Left Top"/>
|
||||
<Property key="TextAlign" value="HCenter Top"/>
|
||||
</Widget>
|
||||
|
||||
<!-- Attribute list -->
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||
<Property key="Caption" value="#{sName}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp8}"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="EditBox" skin="MW_TextEdit" position="0 0 30 30" name="NameEdit">
|
||||
@ -25,6 +28,9 @@
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||
<Property key="Caption" value="#{sItem}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp1}"/>
|
||||
</Widget>
|
||||
<Widget type="ItemWidget" skin="MW_ItemIconBox" position="0 0 50 50" name="ItemBox">
|
||||
</Widget>
|
||||
@ -33,6 +39,9 @@
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||
<Property key="Caption" value="#{sSoulGem}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp2}"/>
|
||||
</Widget>
|
||||
<Widget type="ItemWidget" skin="MW_ItemIconBox" position="0 0 50 50" name="SoulBox">
|
||||
</Widget>
|
||||
@ -70,6 +79,9 @@
|
||||
<!-- Available effects -->
|
||||
<Widget type="TextBox" skin="NormalText" position="12 108 300 24">
|
||||
<Property key="Caption" value="#{sMagicEffects}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp9}"/>
|
||||
</Widget>
|
||||
<Widget type="MWList" skin="MW_SimpleList" position="12 136 202 209" name="AvailableEffects">
|
||||
</Widget>
|
||||
@ -77,6 +89,9 @@
|
||||
<!-- Used effects -->
|
||||
<Widget type="TextBox" skin="NormalText" position="226 108 300 24">
|
||||
<Property key="Caption" value="#{sEffects}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp10}"/>
|
||||
</Widget>
|
||||
<Widget type="Widget" skin="MW_Box" position="226 136 316 209">
|
||||
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 308 201" name="UsedEffects">
|
||||
@ -89,6 +104,9 @@
|
||||
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" name="TypeButton">
|
||||
<Property key="Caption" value="Constant effect"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp7}"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="Widget">
|
||||
@ -100,6 +118,9 @@
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="PriceLabel">
|
||||
<Property key="Caption" value="0"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sEnchantmentHelp6}"/>
|
||||
</Widget>
|
||||
|
||||
|
||||
|
@ -65,6 +65,24 @@
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<!-- Hand-to-hand tooltip -->
|
||||
<Widget type="HBox" skin="HUD_Box_NoTransp" position="0 0 300 300" align="Stretch" name="HandToHandToolTip">
|
||||
<Property key="AutoResize" value="true"/>
|
||||
<Property key="Padding" value="8"/>
|
||||
|
||||
<Widget type="VBox">
|
||||
<UserString key="VStretch" value="true"/>
|
||||
<Widget type="ImageBox" skin="ImageBox" position="8 8 32 32" align="Left Top" name="HandToHandImage"/>
|
||||
<Widget type="Widget">
|
||||
<UserString key="VStretch" value="true"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" position="44 8 248 284" align="Left Top" name="HandToHandText">
|
||||
<Property key="TextAlign" value="Center"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<!-- Health tooltip -->
|
||||
<Widget type="HBox" skin="HUD_Box_NoTransp" position="0 0 300 300" align="Stretch" name="HealthToolTip">
|
||||
<Property key="AutoResize" value="true"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user