OpenMW
|
Potion creation via alchemy skill. More...
#include <alchemy.hpp>
Public Types | |
enum | Result { Result_Success, Result_NoMortarAndPestle, Result_LessThanTwoIngredients, Result_NoName, Result_NoEffects, Result_RandomFailure } |
typedef std::vector< MWWorld::Ptr > | TToolsContainer |
typedef TToolsContainer::const_iterator | TToolsIterator |
typedef std::vector< MWWorld::Ptr > | TIngredientsContainer |
typedef TIngredientsContainer::const_iterator | TIngredientsIterator |
typedef std::vector < ESM::ENAMstruct > | TEffectsContainer |
typedef TEffectsContainer::const_iterator | TEffectsIterator |
Public Member Functions | |
void | setAlchemist (const MWWorld::Ptr &npc) |
TToolsIterator | beginTools () const |
TToolsIterator | endTools () const |
TIngredientsIterator | beginIngredients () const |
TIngredientsIterator | endIngredients () const |
void | clear () |
Remove alchemist, tools and ingredients. | |
int | addIngredient (const MWWorld::Ptr &ingredient) |
void | removeIngredient (int index) |
Remove ingredient from slot (calling this function on an empty slot is a no-op). | |
TEffectsIterator | beginEffects () const |
TEffectsIterator | endEffects () const |
std::string | getPotionName () const |
Result | create (const std::string &name) |
Private Member Functions | |
std::set< EffectKey > | listEffects () const |
List all effects shared by at least two ingredients. | |
void | applyTools (int flags, float &value) const |
void | updateEffects () |
const ESM::Potion * | getRecord () const |
Return existing recrod for created potion (may return 0) | |
void | removeIngredients () |
void | addPotion (const std::string &name) |
Add a potion to the alchemist's inventory. | |
void | increaseSkill () |
Increase alchemist's skill. | |
float | getChance () const |
Return chance of success. | |
int | countIngredients () const |
Private Attributes | |
MWWorld::Ptr | mAlchemist |
TToolsContainer | mTools |
TIngredientsContainer | mIngredients |
TEffectsContainer | mEffects |
int | mValue |
Potion creation via alchemy skill.
typedef std::vector<ESM::ENAMstruct> MWMechanics::Alchemy::TEffectsContainer |
typedef TEffectsContainer::const_iterator MWMechanics::Alchemy::TEffectsIterator |
typedef std::vector<MWWorld::Ptr> MWMechanics::Alchemy::TIngredientsContainer |
typedef TIngredientsContainer::const_iterator MWMechanics::Alchemy::TIngredientsIterator |
typedef std::vector<MWWorld::Ptr> MWMechanics::Alchemy::TToolsContainer |
typedef TToolsContainer::const_iterator MWMechanics::Alchemy::TToolsIterator |
int MWMechanics::Alchemy::addIngredient | ( | const MWWorld::Ptr & | ingredient | ) |
Add ingredient into the next free slot.
void MWMechanics::Alchemy::addPotion | ( | const std::string & | name | ) | [private] |
Add a potion to the alchemist's inventory.
void MWMechanics::Alchemy::applyTools | ( | int | flags, |
float & | value | ||
) | const [private] |
void MWMechanics::Alchemy::clear | ( | ) |
Remove alchemist, tools and ingredients.
int MWMechanics::Alchemy::countIngredients | ( | ) | const [private] |
MWMechanics::Alchemy::Result MWMechanics::Alchemy::create | ( | const std::string & | name | ) |
Try to create a potion from the ingredients, place it in the inventory of the alchemist and adjust the skills of the alchemist accordingly.
name | must not be an empty string, unless there is already a potion record ( getPotionName() does not return an empty string). |
float MWMechanics::Alchemy::getChance | ( | ) | const [private] |
Return chance of success.
std::string MWMechanics::Alchemy::getPotionName | ( | ) | const |
Return the name of the potion that would be created when calling create (if a record for such a potion already exists) or return an empty string.
const ESM::Potion * MWMechanics::Alchemy::getRecord | ( | ) | const [private] |
Return existing recrod for created potion (may return 0)
void MWMechanics::Alchemy::increaseSkill | ( | ) | [private] |
Increase alchemist's skill.
std::set< MWMechanics::EffectKey > MWMechanics::Alchemy::listEffects | ( | ) | const [private] |
List all effects shared by at least two ingredients.
void MWMechanics::Alchemy::removeIngredient | ( | int | index | ) |
Remove ingredient from slot (calling this function on an empty slot is a no-op).
void MWMechanics::Alchemy::removeIngredients | ( | ) | [private] |
Remove selected ingredients from alchemist's inventory, cleanup selected ingredients and update effect list accordingly.
void MWMechanics::Alchemy::setAlchemist | ( | const MWWorld::Ptr & | npc | ) |
Set alchemist and configure alchemy setup accordingly. npc may be empty to indicate that there is no alchemist (alchemy session has ended).
void MWMechanics::Alchemy::updateEffects | ( | ) | [private] |
MWWorld::Ptr MWMechanics::Alchemy::mAlchemist [private] |
TToolsContainer MWMechanics::Alchemy::mTools [private] |
int MWMechanics::Alchemy::mValue [private] |