2014-12-15 12:13:25 +00:00
|
|
|
#ifndef OPENMW_GUI_SPELLMODEL_H
|
|
|
|
#define OPENMW_GUI_SPELLMODEL_H
|
|
|
|
|
|
|
|
#include "../mwworld/ptr.hpp"
|
2020-11-18 00:47:56 +00:00
|
|
|
#include <components/esm/effectlist.hpp>
|
2014-12-15 12:13:25 +00:00
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
|
|
|
|
struct Spell
|
|
|
|
{
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
Type_Power,
|
|
|
|
Type_Spell,
|
|
|
|
Type_EnchantedItem
|
|
|
|
};
|
|
|
|
|
|
|
|
Type mType;
|
|
|
|
std::string mName;
|
|
|
|
std::string mCostColumn; // Cost/chance or Cost/charge
|
|
|
|
std::string mId; // Item ID or spell ID
|
|
|
|
MWWorld::Ptr mItem; // Only for Type_EnchantedItem
|
2018-07-14 11:47:05 +00:00
|
|
|
int mCount; // Only for Type_EnchantedItem
|
2014-12-15 12:13:25 +00:00
|
|
|
bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
|
|
|
|
bool mActive; // (Items only) is the item equipped?
|
|
|
|
|
|
|
|
Spell()
|
2015-04-25 18:37:42 +00:00
|
|
|
: mType(Type_Spell)
|
2018-08-01 16:18:37 +00:00
|
|
|
, mCount(0)
|
2015-04-25 18:37:42 +00:00
|
|
|
, mSelected(false)
|
2014-12-15 12:13:25 +00:00
|
|
|
, mActive(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
///@brief Model that lists all usable powers, spells and enchanted items for an actor.
|
|
|
|
class SpellModel
|
|
|
|
{
|
|
|
|
public:
|
2018-05-24 06:48:46 +00:00
|
|
|
SpellModel(const MWWorld::Ptr& actor, const std::string& filter);
|
2014-12-15 12:13:25 +00:00
|
|
|
SpellModel(const MWWorld::Ptr& actor);
|
|
|
|
|
|
|
|
typedef int ModelIndex;
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
Spell getItem (ModelIndex index) const;
|
|
|
|
///< throws for invalid index
|
|
|
|
|
|
|
|
size_t getItemCount() const;
|
2019-04-24 23:22:47 +00:00
|
|
|
ModelIndex getSelectedIndex() const;
|
|
|
|
///< returns -1 if nothing is selected
|
2014-12-15 12:13:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
MWWorld::Ptr mActor;
|
|
|
|
|
|
|
|
std::vector<Spell> mSpells;
|
2018-05-24 06:48:46 +00:00
|
|
|
|
|
|
|
std::string mFilter;
|
2020-11-18 00:47:56 +00:00
|
|
|
|
|
|
|
bool matchingEffectExists(std::string filter, const ESM::EffectList &effects);
|
2014-12-15 12:13:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|