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