Crossfire Server, Trunk
CREPrePostPanel.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 _CREPREPOSTPANEL_H
14 #define _CREPREPOSTPANEL_H
15 
16 #include <QWidget>
17 #include <QObject>
18 #include <QtWidgets>
19 
20 #include "MessageManager.h"
21 #include "CREPrePostList.h"
22 
23 class QListWidget;
24 class QComboBox;
25 class QLineEdit;
27 
31 class CRESubItemWidget : public QWidget
32 {
33  Q_OBJECT
34 
35  public:
36  CRESubItemWidget(QWidget* parent) : QWidget(parent) { };
37 
38  virtual void setData(const QStringList& data) = 0;
39 
40  signals:
41  void dataModified(const QStringList& data);
42 };
43 
48 {
49  Q_OBJECT
50 
51  public:
52  CRESubItemConnection(QWidget* parent);
53 
54  virtual void setData(const QStringList& data);
55 
56  private:
57  QLineEdit* myEdit;
58  QLabel* myWarning;
59 
60  void showWarning(const QString& warning);
61 
62  private slots:
63  void editChanged(const QString& text);
64 };
65 
70 {
71  Q_OBJECT
72 
73  public:
74  CRESubItemQuest(PrePostWidget::Mode mode, QWidget* parent);
75 
76  virtual void setData(const QStringList& data);
77 
78  private:
81  QComboBox* myQuestList;
83  QComboBox* myFirstStep;
85  QComboBox* mySecondStep;
86  QRadioButton* myAtStep;
87  QRadioButton* myBelowStep;
88  QRadioButton* myFromStep;
89  QRadioButton* myStepRange;
90  bool myInit;
91 
92  void fillQuestSteps();
93  void updateData();
94 
95  private slots:
96  void selectedQuestChanged(int index);
97  void checkToggled(bool checked);
98  void selectedStepChanged(int index);
99 };
100 
105 {
106  Q_OBJECT
107 
108  public:
109  CRESubItemToken(bool isPre, QWidget* parent);
110 
111  virtual void setData(const QStringList& data);
112 
113  private:
114  QLineEdit* myToken;
115  QLineEdit* myValue;
116  QTextEdit* myValues;
117 
118  void updateData();
119 
120  private slots:
121  void tokenChanged(const QString&);
122  void valuesChanged();
123 };
124 
129 {
130  Q_OBJECT
131 
132  public:
133  CRESubItemList(QWidget* parent);
134  void setData(const QStringList& data);
135 
136  private:
137  void addItem(const QString& item);
138  QStringList data() const;
139 
141  QListWidget* mySubItems;
142 
143  private slots:
144  void endEdition(QWidget* editor, QAbstractItemDelegate::EndEditHint hint);
145  void onAddSubItem(bool);
146  void onDeleteSubItem(bool);
147 };
148 
152 class CREPrePostPanel : public QDialog
153 {
154  Q_OBJECT
155 
156  public:
163  CREPrePostPanel(PrePostWidget::Mode mode, const QList<QuestConditionScript*> scripts, QWidget* parent);
164  virtual ~CREPrePostPanel();
165 
166  QStringList getData();
167  void setData(const QStringList& data);
168 
169  private:
171  QStringList myData;
173  QStringList myOriginal;
175  QComboBox* myChoices;
177  QList<CRESubItemWidget*> mySubWidgets;
179  QStackedWidget* mySubItemsStack;
182 
189 
190  private slots:
191  void currentChoiceChanged(int index);
192  void subItemChanged(const QStringList& data);
193  void onReset(bool);
194 };
195 
196 #endif /* _CREPREPOSTPANEL_H */
CRESubItemQuest
Definition: CREPrePostPanel.h:69
CRESubItemWidget::setData
virtual void setData(const QStringList &data)=0
CRESubItemToken::myValue
QLineEdit * myValue
Definition: CREPrePostPanel.h:115
CRESubItemWidget::dataModified
void dataModified(const QStringList &data)
CREPrePostPanel::myOriginal
QStringList myOriginal
Definition: CREPrePostPanel.h:173
CREPrePostPanel::CREPrePostPanel
CREPrePostPanel(PrePostWidget::Mode mode, const QList< QuestConditionScript * > scripts, QWidget *parent)
Definition: CREPrePostPanel.cpp:426
python_init.scripts
scripts
Definition: python_init.py:11
CRESubItemToken::tokenChanged
void tokenChanged(const QString &)
Definition: CREPrePostPanel.cpp:416
CRESubItemList::mySubItems
QListWidget * mySubItems
Definition: CREPrePostPanel.h:141
CRESubItemConnection::myWarning
QLabel * myWarning
Definition: CREPrePostPanel.h:58
CRESubItemWidget::CRESubItemWidget
CRESubItemWidget(QWidget *parent)
Definition: CREPrePostPanel.h:36
CREPrePostPanel::myMode
PrePostWidget::Mode myMode
Definition: CREPrePostPanel.h:181
CREPrePostPanel::~CREPrePostPanel
virtual ~CREPrePostPanel()
Definition: CREPrePostPanel.cpp:475
CRESubItemQuest::CRESubItemQuest
CRESubItemQuest(PrePostWidget::Mode mode, QWidget *parent)
Definition: CREPrePostPanel.cpp:143
CRESubItemQuest::myStepRange
QRadioButton * myStepRange
Definition: CREPrePostPanel.h:89
CREPrePostPanel::getData
QStringList getData()
Definition: CREPrePostPanel.cpp:479
CRESubItemQuest::updateData
void updateData()
Definition: CREPrePostPanel.cpp:298
CRESubItemConnection
Definition: CREPrePostPanel.h:47
CRESubItemToken::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:381
CRESubItemList::data
QStringList data() const
Definition: CREPrePostPanel.cpp:56
CRESubItemQuest::checkToggled
void checkToggled(bool checked)
Definition: CREPrePostPanel.cpp:335
mode
linux kernel c mode(defun linux-c-mode() "C mode with adjusted defaults for use with the Linux kernel."(interactive)(c-mode)(c-set-style "K&R")(setq c-basic-offset 8))
CRESubItemConnection::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:103
CRESubItemQuest::mySecondStep
QComboBox * mySecondStep
Definition: CREPrePostPanel.h:85
CREPrePostPanel::onReset
void onReset(bool)
Definition: CREPrePostPanel.cpp:530
CREPrePostPanel::myChoices
QComboBox * myChoices
Definition: CREPrePostPanel.h:175
CRESubItemQuest::myFirstStep
QComboBox * myFirstStep
Definition: CREPrePostPanel.h:83
QuestConditionScript
Definition: QuestConditionScript.h:21
CRESubItemWidget
Definition: CREPrePostPanel.h:31
CRESubItemQuest::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:208
CRESubItemToken::CRESubItemToken
CRESubItemToken(bool isPre, QWidget *parent)
Definition: CREPrePostPanel.cpp:352
CREPrePostPanel::myData
QStringList myData
Definition: CREPrePostPanel.h:171
CREPrePostList.h
CRESubItemList::endEdition
void endEdition(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
Definition: CREPrePostPanel.cpp:64
CRESubItemQuest::myQuestList
QComboBox * myQuestList
Definition: CREPrePostPanel.h:81
CRESubItemToken::updateData
void updateData()
Definition: CREPrePostPanel.cpp:405
CRESubItemToken
Definition: CREPrePostPanel.h:104
CRESubItemList::addItem
void addItem(const QString &item)
Definition: CREPrePostPanel.cpp:40
script
Install Bug reporting Credits but rather whatever guild name you are using *With the current map and server there are three they and GreenGoblin *Whatever name you give the folder should but it will still use GUILD_TEMPLATE *You can change what guild it uses by editing the map files Modify Map or objects if you want to use the optional Python based Guild Storage hall The first three are on the main the next two are in the guild_hq and the final one is in hallofjoining Withe the Storage three objects are found on the main floor and the last two are in the basement It s not that but you will need a map editor You find the object that has the script
Definition: README.txt:19
navar-midane_time.data
data
Definition: navar-midane_time.py:11
CRESubItemConnection::showWarning
void showWarning(const QString &warning)
Definition: CREPrePostPanel.cpp:123
CREPrePostPanel::setData
void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:484
CRESubItemQuest::myMode
PrePostWidget::Mode myMode
Definition: CREPrePostPanel.h:79
CREPrePostPanel::mySubItemsStack
QStackedWidget * mySubItemsStack
Definition: CREPrePostPanel.h:179
CREPrePostPanel::createSubItemWidget
CRESubItemWidget * createSubItemWidget(const QuestConditionScript *script)
Definition: CREPrePostPanel.cpp:516
CRESubItemList::onAddSubItem
void onAddSubItem(bool)
Definition: CREPrePostPanel.cpp:69
CRESubItemQuest::myBelowStep
QRadioButton * myBelowStep
Definition: CREPrePostPanel.h:87
CRESubItemList
Definition: CREPrePostPanel.h:128
CRESubItemList::CRESubItemList
CRESubItemList(QWidget *parent)
Definition: CREPrePostPanel.cpp:21
CRESubItemConnection::CRESubItemConnection
CRESubItemConnection(QWidget *parent)
Definition: CREPrePostPanel.cpp:88
item
Definition: item.py:1
CRESubItemQuest::selectedStepChanged
void selectedStepChanged(int index)
Definition: CREPrePostPanel.cpp:344
CRESubItemQuest::myAtStep
QRadioButton * myAtStep
Definition: CREPrePostPanel.h:86
CRESubItemQuest::myInit
bool myInit
Definition: CREPrePostPanel.h:90
npc_dialog.index
int index
Definition: npc_dialog.py:102
CRESubItemList::setData
void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:47
CRESubItemQuest::fillQuestSteps
void fillQuestSteps()
CRESubItemConnection::editChanged
void editChanged(const QString &text)
Definition: CREPrePostPanel.cpp:129
CRESubItemQuest::selectedQuestChanged
void selectedQuestChanged(int index)
Definition: CREPrePostPanel.cpp:266
CRESubItemQuest::myFromStep
QRadioButton * myFromStep
Definition: CREPrePostPanel.h:88
CRESubItemList::onDeleteSubItem
void onDeleteSubItem(bool)
Definition: CREPrePostPanel.cpp:78
CREPrePostPanel::currentChoiceChanged
void currentChoiceChanged(int index)
Definition: CREPrePostPanel.cpp:498
CREPrePostPanel::subItemChanged
void subItemChanged(const QStringList &data)
Definition: CREPrePostPanel.cpp:509
CRESubItemToken::valuesChanged
void valuesChanged()
Definition: CREPrePostPanel.cpp:421
CRESubItemConnection::myEdit
QLineEdit * myEdit
Definition: CREPrePostPanel.h:57
text
Crossfire Protocol most of the time after the actual code was already omit certain important and possibly make life miserable any new developer or curious player should be able to find most of the relevant information here If inconsistencies are found or this documentation proves to be consider the latest server side protocol code in the public source code repository as the authoritative reference Introduction If you were ever curious enough to telnet or netcat to a Crossfire chances are you were sorely disappointed While the protocol may seem to use plain text at it actually uses a mix of ASCII and binary data This handbook attempts to document various aspects of the Crossfire protocol As consult the README file to find out how to get in touch with helpful people via mailing and more History the communications plan was set to be a text based system It was up to the server and client to parse these messages and determine what to do These messages were assumed to be line per message At a reasonably early stage of Eric Anderson wrote a then the data itself you could send many data and after the other end could decode these commands This works fairly but I think the creation of numerous sub packets has some performance hit the eutl was not especially well so writing a client for a different platform became more Eric left to work on other products shortly after writing his which didn t really leave anyone with a full understanding of the socket code I have decided to remove the eutl dependency At least one advantage is that having this network related code directly in the client and server makes error handling a bit easier cleaner Packet Format the outside packet method the byte size for the size information is not included here Eutl originally used bytes for the size to bytes seems it makes a least some sense The actual data is something of the nature of the commands listed below It is a text followed by possible other data The remaining data can be binary it is up to the client and server to decode what it sent The commands as described below is just the data portion of the packet If writing a new remember that you must take into account the size of the packet There is no termination of other than knowing how long it should be For most everything that is sent is text This is more or less how things worked under except it packed the ints into bytes in a known order In some we handle ints as in they are sent as binary information How any command handles it is detailed below in the command description The S and C represent the direction of the we use MSB as well as any ints or shorts that get sent inside the packets All packets are defined to have at least one word of text
Definition: protocol.txt:84
PrePostWidget::Mode
Mode
Definition: CREPrePostList.h:27
CREPrePostPanel::mySubWidgets
QList< CRESubItemWidget * > mySubWidgets
Definition: CREPrePostPanel.h:177
CRESubItemToken::myValues
QTextEdit * myValues
Definition: CREPrePostPanel.h:116
CREPrePostPanel
Definition: CREPrePostPanel.h:152
CRESubItemToken::myToken
QLineEdit * myToken
Definition: CREPrePostPanel.h:114
MessageManager.h