Crossfire Server, Trunk
ArtifactWrapper.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 ARTIFACT_WRAPPER_H
14 #define ARTIFACT_WRAPPER_H
15 
16 #include <QObject>
17 #include <QStringList>
18 
19 extern "C" {
20 #include "global.h"
21 }
22 
23 #include "assets/AssetWrapper.h"
25 class ResourcesManager;
26 
27 class ArtifactWrapper : public AssetTWrapper<artifact> {
28  Q_OBJECT
29 
30  Q_PROPERTY(QString name READ name)
31  Q_PROPERTY(QObject* item READ item)
32  Q_PROPERTY(int chance READ chance WRITE setChance)
33  Q_PROPERTY(int difficulty READ difficulty)
34  Q_PROPERTY(QStringList allowed READ allowed)
35 
36 public:
37  ArtifactWrapper(AssetWrapper *parent, artifact *art, ResourcesManager *resourcesManager);
38 
39  virtual QString displayName() const override;
40  virtual QIcon displayIcon() const override;
41 
42  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override;
43 
44  void setSpecificItem(const object *item) { mySpecificItem = item; }
45 
46  QString name() const;
47  QObject* item();
48  int chance() const;
49  void setChance(int chance);
50  int difficulty() const;
51  QStringList allowed() const;
52 
53 protected:
55  const object *mySpecificItem;
56 };
57 
58 #endif // ARTIFACT_WRAPPER_H
ArtifactWrapper::displayIcon
virtual QIcon displayIcon() const override
Definition: ArtifactWrapper.cpp:48
global.h
ArtifactWrapper
Definition: ArtifactWrapper.h:27
AssetWrapper.h
ResourcesManager
Definition: ResourcesManager.h:79
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:28
ArtifactWrapper::chance
int chance
Definition: ArtifactWrapper.h:32
ArtifactWrapper::item
QObject item
Definition: ArtifactWrapper.h:31
ArtifactWrapper::setSpecificItem
void setSpecificItem(const object *item)
Definition: ArtifactWrapper.h:44
ArtifactWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: ArtifactWrapper.cpp:86
AssetWrapper
Definition: AssetWrapper.h:22
ArtifactWrapper::difficulty
int difficulty
Definition: ArtifactWrapper.h:33
artifactstruct
Definition: artifact.h:14
AssetWrapperPanel.h
item
Definition: item.py:1
ArtifactWrapper::mySpecificItem
const object * mySpecificItem
Definition: ArtifactWrapper.h:55
std
Definition: json.hpp:4494
ArtifactWrapper::myResourcesManager
ResourcesManager * myResourcesManager
Definition: ArtifactWrapper.h:54
ArtifactWrapper::allowed
QStringList allowed
Definition: ArtifactWrapper.h:34
ArtifactWrapper::name
QString name
Definition: ArtifactWrapper.h:30
ArtifactWrapper::displayName
virtual QString displayName() const override
Definition: ArtifactWrapper.cpp:24
ArtifactWrapper::setChance
void setChance(int chance)
Definition: ArtifactWrapper.cpp:64
AssetTWrapper
Definition: AssetWrapper.h:87