Crossfire Server, Trunk
CREStringListPanel.cpp
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 #include <QtWidgets>
14 #include "CREStringListPanel.h"
16 
17 CREStringListPanel::CREStringListPanel(QWidget* parent) : QDialog(parent)
18 {
19  setModal(true);
20  setWindowTitle(tr("NPC possible messages"));
21 
22  QVBoxLayout* layout = new QVBoxLayout(this);
23  layout->addWidget(new QLabel(tr("Messages:"), this));
24 
25  myItems = new QListWidget(this);
26  layout->addWidget(myItems);
27  myItems->setItemDelegateForColumn(0, new CREMultilineItemDelegate(myItems, false));
28 
29  QHBoxLayout* buttons = new QHBoxLayout();
30 
31  QPushButton* add = new QPushButton(tr("add"), this);
32  connect(add, SIGNAL(clicked(bool)), this, SLOT(onAddItem(bool)));
33  buttons->addWidget(add);
34 
35  QPushButton* remove = new QPushButton(tr("remove"), this);
36  connect(remove, SIGNAL(clicked(bool)), this, SLOT(onDeleteItem(bool)));
37  buttons->addWidget(remove);
38 
39  QPushButton* reset = new QPushButton(tr("reset changes"), this);
40  connect(reset, SIGNAL(clicked(bool)), this, SLOT(onReset(bool)));
41  buttons->addWidget(reset);
42 
43  layout->addLayout(buttons);
44 }
45 
47 {
48 }
49 
50 void CREStringListPanel::setData(const QStringList& list)
51 {
52  myItems->clear();
53  for (const QString item : list)
55  myOriginal = list;
56 }
57 
58 QStringList CREStringListPanel::data() const
59 {
60  QStringList data;
61  for (int i = 0; i < myItems->count(); i++)
62  data.append(myItems->item(i)->text().trimmed());
63  return data;
64 }
65 
66 QListWidgetItem* CREStringListPanel::createItem(const QString& text)
67 {
68  QListWidgetItem* wi = new QListWidgetItem(text);
69  wi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
70  myItems->addItem(wi);
71  return wi;
72 }
73 
75 {
76  myItems->editItem(createItem("<message>"));
77 }
78 
80 {
81  if (myItems->currentRow() < 0 || myItems->currentRow() >= myItems->count())
82  return;
83  delete myItems->takeItem(myItems->currentRow());
84 }
85 
87 {
88  if (QMessageBox::question(this, "Confirm reset", "Reset the values, losing all changes?") != QMessageBox::StandardButton::Yes)
89  return;
91 }
CREMultilineItemDelegate.h
layout
Definition: main.cpp:84
CREStringListPanel::CREStringListPanel
CREStringListPanel(QWidget *parent)
Definition: CREStringListPanel.cpp:17
CREStringListPanel::~CREStringListPanel
virtual ~CREStringListPanel()
Definition: CREStringListPanel.cpp:46
guildoracle.list
list
Definition: guildoracle.py:87
CREStringListPanel::setData
void setData(const QStringList &list)
Definition: CREStringListPanel.cpp:50
CREStringListPanel::onDeleteItem
void onDeleteItem(bool)
Definition: CREStringListPanel.cpp:79
CREStringListPanel::createItem
QListWidgetItem * createItem(const QString &text)
Definition: CREStringListPanel.cpp:66
CREStringListPanel.h
CREStringListPanel::data
QStringList data() const
Definition: CREStringListPanel.cpp:58
CREStringListPanel::myItems
QListWidget * myItems
Definition: CREStringListPanel.h:38
CREStringListPanel::onAddItem
void onAddItem(bool)
Definition: CREStringListPanel.cpp:74
buttons
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be and may attack the nearest of your enemies Others can be in that they follow you around and help you in your quest to kill enemies and find treasure SPECIAL ITEMS There are many special items which can be found in of these the most important may be the signs all a player must do is apply the handle In the case of buttons
Definition: survival-guide.txt:57
CREMultilineItemDelegate
Definition: CREMultilineItemDelegate.h:19
item
Definition: item.py:1
CREStringListPanel::onReset
void onReset(bool)
Definition: CREStringListPanel.cpp:86
reset
Python Guilds Quick outline Add a guild(mapmakers) this is still a problem *after dropping the token to gain access to the stove a woodfloor now appears which is Toolshed Token(found in Guild_HQ) *Note also have multiple gates in place to protect players and items from the mana explosion drop x for Jewelers room *Jewelers room works just need to determine what x is drop x for Thaumaturgy room *Thaumaturgy room works just need to determine what x is drop gold dropping the Firestar named fearless allows access to but I suspect that the drop location of the chest is not as intended because the player is in the way once you enter the chest the exit back to the basement is things such as the message et al reside on teleporters which then transport items to the map as they are when the map is reset(which is normal)
CREStringListPanel::myOriginal
QStringList myOriginal
Definition: CREStringListPanel.h:39
connect
Definition: connect.py:1
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