Crossfire Server, Trunk
CREMapPanel.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 "CREMapPanel.h"
14 #include "CREMapInformation.h"
15 #include "CREMainWindow.h"
17 #include "scripts/ScriptFile.h"
18 #include "CREPixmap.h"
19 
20 #include "define.h"
21 #include "assets.h"
22 #include "AssetsManager.h"
23 
24 static QHash<QString, archetype*> events;
25 
26 void static fillEvents()
27 {
28  if (!events.isEmpty())
29  {
30  return;
31  }
32 
34  {
35  if (arch->clone.type == EVENT_CONNECTOR)
36  {
37  events.insert(arch->name, arch);
38  }
39  });
40 }
41 
43 {
44  Q_ASSERT(manager != NULL);
46 
47  myLayout->addWidget(new QLabel(tr("Name:"), this), 0, 0);
48  myName = new QLabel();
49  myLayout->addWidget(myName, 0, 1);
50 
51  myExitsFrom = new QTreeWidget(this);
52  myExitsFrom->setHeaderLabel(tr("Exits from this map"));
53  myLayout->addWidget(myExitsFrom, 1, 0, 1, 2);
54 
55  myExitsTo = new QTreeWidget(this);
56  myExitsTo->setHeaderLabel(tr("Exits leading to this map"));
57  myLayout->addWidget(myExitsTo, 2, 0, 1, 2);
58 
59  myScripts = new QTreeWidget(this);
60  myScripts->setHeaderLabel(tr("Scripts on this map"));
61  myScripts->setIconSize(QSize(32, 32));
62  myLayout->addWidget(myScripts, 3, 0, 1, 2);
63 
64  myLayout->addWidget(new QLabel(tr("Background music:"), this), 4, 0);
65  myBackgroundMusic = new QLabel();
66  myLayout->addWidget(myBackgroundMusic, 4, 1);
67 
68  fillEvents();
69 }
70 
72 {
73 }
74 
76 {
77  myName->setText(myItem->name());
78 
79  myExitsFrom->clear();
80  foreach(QString path, myItem->accessedFrom())
81  myExitsFrom->addTopLevelItem(new QTreeWidgetItem(QStringList(path)));
82 
83  myExitsTo->clear();
84  foreach(QString path, myItem->exitsTo())
85  myExitsTo->addTopLevelItem(new QTreeWidgetItem(QStringList(path)));
86 
87  myScripts->clear();
89  {
90  foreach(HookInformation* hook, script->hooks())
91  {
92  if (hook->map() == myItem)
93  {
94  QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("%1 [%2, %3], %4, %5, %6").arg(hook->itemName()).arg(hook->x()).arg(hook->y()).arg(hook->eventName()).arg(hook->pluginName()).arg(script->path())));
95 
96  archetype* arch = events[hook->eventName().toLower()];
97  if (arch != NULL && arch->clone.face != NULL)
98  {
99  child->setIcon(0, CREPixmap::getIcon(arch->clone.face->number));
100  }
101 
102  myScripts->addTopLevelItem(child);
103  }
104  }
105  }
106 
108 }
HookInformation::eventName
QString eventName() const
Definition: ScriptFile.cpp:106
CREMapPanel::myBackgroundMusic
QLabel * myBackgroundMusic
Definition: CREMapPanel.h:41
CREMapPanel::CREMapPanel
CREMapPanel(ScriptFileManager *manager, QWidget *parent)
Definition: CREMapPanel.cpp:42
EVENT_CONNECTOR
@ EVENT_CONNECTOR
Definition: object.h:232
HookInformation::pluginName
QString pluginName() const
Definition: ScriptFile.cpp:101
CREMapInformation::accessedFrom
QStringList accessedFrom() const
Definition: CREMapInformation.cpp:146
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
HookInformation::y
int y() const
Definition: ScriptFile.cpp:91
AssetWrapperPanel::myLayout
QGridLayout * myLayout
Definition: AssetWrapperPanel.h:56
CREMapPanel::myScripts
QTreeWidget * myScripts
Definition: CREMapPanel.h:40
CREMapPanel::~CREMapPanel
virtual ~CREMapPanel()
Definition: CREMapPanel.cpp:71
HookInformation::x
int x() const
Definition: ScriptFile.cpp:86
ScriptFileManager.h
CREMapPanel::myManager
ScriptFileManager * myManager
Definition: CREMapPanel.h:36
ScriptFileManager
Definition: ScriptFileManager.h:26
CREMapInformation::exitsTo
QStringList exitsTo() const
Definition: CREMapInformation.cpp:135
AssetsManager.h
HookInformation
Definition: ScriptFile.h:25
ScriptFile.h
getManager
AssetsManager * getManager()
Definition: assets.cpp:305
CREMapInformation::name
QString name
Definition: CREMapInformation.h:32
CREMapPanel::updateItem
virtual void updateItem() override
Definition: CREMapPanel.cpp:75
ScriptFileManager::scriptsForMap
QList< ScriptFile * > scriptsForMap(CREMapInformation *map)
Definition: ScriptFileManager.cpp:26
ScriptFile
Definition: ScriptFile.h:48
CREMainWindow.h
AssetSWrapperPanel< CREMapInformation >::myItem
CREMapInformation * myItem
Definition: AssetWrapperPanel.h:126
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
CREMapPanel::myExitsTo
QTreeWidget * myExitsTo
Definition: CREMapPanel.h:38
AssetsManager::archetypes
Archetypes * archetypes()
Definition: AssetsManager.h:44
CREMapPanel.h
archetype
Definition: object.h:474
AssetSWrapperPanel
Definition: AssetWrapperPanel.h:113
path
pluglist shows those as well as a short text describing each the list will simply appear empty The keyword for the Python plugin is Python plugout< keyword > Unloads a given identified by its _keyword_ So if you want to unload the Python you need to do plugout Python plugin< libname > Loads a given whose _filename_ is libname So in the case of you d have to do a plugin cfpython so Note that all filenames are relative to the default plugin path(SHARE/plugins). Console messages. ----------------- When Crossfire starts
HookInformation::map
const CREMapInformation * map() const
Definition: ScriptFile.cpp:81
HookInformation::itemName
QString itemName() const
Definition: ScriptFile.cpp:96
CREPixmap.h
AssetsCollection::each
void each(std::function< void(T *)> op)
Definition: AssetsCollection.h:158
CREMapPanel::myName
QLabel * myName
Definition: CREMapPanel.h:37
CREMapInformation::backgroundMusic
QString backgroundMusic
Definition: CREMapInformation.h:37
define.h
assets.h
fillEvents
static void fillEvents()
Definition: CREMapPanel.cpp:26
CREPixmap::getIcon
static QIcon getIcon(uint16_t faceNumber)
Definition: CREPixmap.cpp:65
events
static QHash< QString, archetype * > events
Definition: CREMapPanel.cpp:24
manager
static AssetsManager * manager
Definition: assets.cpp:60
CREMapInformation.h
CREMapPanel::myExitsFrom
QTreeWidget * myExitsFrom
Definition: CREMapPanel.h:39