Crossfire Server, Trunk
RecipeWrapper.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef CRE_WRAPPER_FORMULAE_H
14 #define CRE_WRAPPER_FORMULAE_H
15 
16 #include <QObject>
17 #include <QStringList>
18 
19 #include "global.h"
20 #include "assets/AssetWrapper.h"
21 
22 class ResourcesManager;
23 
24 class RecipeWrapper : public AssetTWrapper<const recipe> {
25  Q_OBJECT
26 
27  Q_PROPERTY(QString name READ displayName)
28  Q_PROPERTY(QString title READ title)
29  Q_PROPERTY(int chance READ chance)
30  Q_PROPERTY(int difficulty READ difficulty)
31  Q_PROPERTY(int experience READ experience)
32  Q_PROPERTY(QStringList archs READ archs)
33  Q_PROPERTY(QStringList ingredients READ ingredients)
34  Q_PROPERTY(bool transmute READ transmute)
35  Q_PROPERTY(int minLevel READ minLevel)
36  Q_PROPERTY(QString keycode READ keycode)
37  Q_PROPERTY(int index READ index)
38  Q_PROPERTY(QString skill READ skill)
39  Q_PROPERTY(QString cauldron READ cauldron)
40  Q_PROPERTY(int yield READ yield)
41 
42 public:
43  RecipeWrapper(AssetWrapper *parent, const recipe *rp, ResourcesManager *resources);
44 
45  virtual QString displayName() const override;
46  virtual QIcon displayIcon() const override;
47 
48  virtual PossibleUse uses(const AssetWrapper *asset, std::string &hint) const override;
49 
50  QString title() const;
51  int chance() const;
52  int difficulty() const;
53  int experience() const;
54  QStringList archs() const;
55  QStringList ingredients() const;
56  bool transmute() const;
57  int minLevel() const;
58  QString keycode() const;
59  int index() const { return myWrappedItem->index; }
60  QString skill() const { return myWrappedItem->skill; }
61  QString cauldron() const { return myWrappedItem->cauldron; }
62  int yield() const { return myWrappedItem->yield; }
63 };
64 
65 #endif // CRE_WRAPPER_FORMULAE_H
RecipeWrapper::yield
int yield() const
Definition: RecipeWrapper.h:62
AssetTWrapper< const recipe >::myWrappedItem
const recipe * myWrappedItem
Definition: AssetWrapper.h:104
global.h
RecipeWrapper::skill
QString skill
Definition: RecipeWrapper.h:38
AssetWrapper.h
RecipeWrapper::minLevel
int minLevel
Definition: RecipeWrapper.h:35
RecipeWrapper::displayName
virtual QString displayName() const override
Definition: RecipeWrapper.cpp:78
RecipeWrapper::cauldron
QString cauldron() const
Definition: RecipeWrapper.h:61
ResourcesManager
Definition: ResourcesManager.h:80
recipe::yield
int yield
Definition: recipe.h:21
RecipeWrapper
Definition: RecipeWrapper.h:24
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
RecipeWrapper::cauldron
QString cauldron
Definition: RecipeWrapper.h:39
RecipeWrapper::index
int index
Definition: RecipeWrapper.h:37
RecipeWrapper::displayIcon
virtual QIcon displayIcon() const override
Definition: RecipeWrapper.cpp:96
AssetWrapper
Definition: AssetWrapper.h:25
recipe::index
int index
Definition: recipe.h:18
title
Definition: readable.cpp:108
RecipeWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &hint) const override
Definition: RecipeWrapper.cpp:113
RecipeWrapper::transmute
bool transmute
Definition: RecipeWrapper.h:34
recipe
Definition: recipe.h:10
RecipeWrapper::yield
int yield
Definition: RecipeWrapper.h:40
RecipeWrapper::keycode
QString keycode
Definition: RecipeWrapper.h:36
std
Definition: json.hpp:4494
RecipeWrapper::skill
QString skill() const
Definition: RecipeWrapper.h:60
RecipeWrapper::name
QString name
Definition: RecipeWrapper.h:27
RecipeWrapper::difficulty
int difficulty
Definition: RecipeWrapper.h:30
recipe::skill
sstring skill
Definition: recipe.h:26
RecipeWrapper::archs
QStringList archs
Definition: RecipeWrapper.h:32
RecipeWrapper::chance
int chance
Definition: RecipeWrapper.h:29
RecipeWrapper::ingredients
QStringList ingredients
Definition: RecipeWrapper.h:33
RecipeWrapper::experience
int experience
Definition: RecipeWrapper.h:31
recipe::cauldron
sstring cauldron
Definition: recipe.h:27
AssetTWrapper
Definition: AssetWrapper.h:94