Crossfire Server, Trunk
MessageManager.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 _MESSAGEMANAGER_H
14 #define _MESSAGEMANAGER_H
15 
16 #include "assets/AssetWrapper.h"
17 #include "MessageFile.h"
18 #include <QList>
19 
21 
25 class MessageManager : public AssetWrapper {
26  Q_OBJECT
27  public:
29  virtual ~MessageManager();
30 
31  virtual QString displayName() const override { return tr("NPC dialogs"); }
32 
33  virtual int childrenCount() const override { return myMessages.size(); }
34  virtual AssetWrapper *child(int child) override { return myMessages[child]; }
35  virtual int childIndex(AssetWrapper *child) override { return myMessages.indexOf(static_cast<MessageFile *>(child)); }
36 
37  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override;
38 
40  void loadMessages();
42  void saveMessages();
43 
48  QList<MessageFile*>& messages();
53  const QList<MessageFile*>& messages() const;
59  MessageFile* findMessage(const QString& path);
60 
65  QList<QuestConditionScript*> preConditions() const;
70  QList<QuestConditionScript*> postConditions() const;
71 
72  private:
73  QList<MessageFile*> myMessages;
74  QList<QuestConditionScript*> myPreConditions;
75  QList<QuestConditionScript*> myPostConditions;
76 
77  QString loadScriptComment(const QString& path) const;
78  void loadDirectory(const QString& directory);
79  void findPrePost(const QString directory, QList<QuestConditionScript*>& list);
80 };
81 
82 #endif /* _MESSAGEMANAGER_H */
MessageManager::loadScriptComment
QString loadScriptComment(const QString &path) const
Definition: MessageManager.cpp:111
MessageManager::myPreConditions
QList< QuestConditionScript * > myPreConditions
Definition: MessageManager.h:74
QuestConditionScript
Definition: QuestConditionScript.h:21
AssetWrapper.h
MessageManager::findMessage
MessageFile * findMessage(const QString &path)
Definition: MessageManager.cpp:61
MessageManager::loadMessages
void loadMessages()
Definition: MessageManager.cpp:34
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
guildoracle.list
list
Definition: guildoracle.py:87
MessageManager::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: MessageManager.cpp:144
MessageManager::messages
QList< MessageFile * > & messages()
Definition: MessageManager.cpp:51
MessageManager::MessageManager
MessageManager(AssetWrapper *parent)
Definition: MessageManager.cpp:23
MessageFile
Definition: MessageFile.h:68
MessageManager::postConditions
QList< QuestConditionScript * > postConditions() const
Definition: MessageManager.cpp:106
MessageManager::childrenCount
virtual int childrenCount() const override
Definition: MessageManager.h:33
MessageManager::myPostConditions
QList< QuestConditionScript * > myPostConditions
Definition: MessageManager.h:75
MessageManager::~MessageManager
virtual ~MessageManager()
Definition: MessageManager.cpp:27
MessageManager::preConditions
QList< QuestConditionScript * > preConditions() const
Definition: MessageManager.cpp:101
MessageManager::displayName
virtual QString displayName() const override
Definition: MessageManager.h:31
AssetWrapper
Definition: AssetWrapper.h:25
python_init.path
path
Definition: python_init.py:8
MessageManager::myMessages
QList< MessageFile * > myMessages
Definition: MessageManager.h:73
MessageManager
Definition: MessageManager.h:25
MessageFile.h
MessageManager::loadDirectory
void loadDirectory(const QString &directory)
Definition: MessageManager.cpp:72
MessageManager::child
virtual AssetWrapper * child(int child) override
Definition: MessageManager.h:34
MessageManager::childIndex
virtual int childIndex(AssetWrapper *child) override
Definition: MessageManager.h:35
MessageManager::findPrePost
void findPrePost(const QString directory, QList< QuestConditionScript * > &list)
Definition: MessageManager.cpp:134
MessageManager::saveMessages
void saveMessages()
Definition: MessageManager.cpp:43