29 #include "serverapi/polymorphism.h" 33 #include <QHostAddress> 93 class MAIN_EXPORT
Server :
public QObject
97 friend class ServerPointer;
158 Server(
const QHostAddress &address,
unsigned short port);
159 virtual ~
Server()
override;
183 virtual bool hasRcon()
const {
return false; }
187 virtual QList<GameCVar> modifiers()
const;
201 virtual QRgb teamColor(
int team)
const;
207 virtual QString teamName(
int team)
const;
263 void addPlayer(
const Player &player);
267 const QHostAddress &address()
const;
271 QString addressWithPort()
const;
276 QStringList allWadNames()
const;
281 bool anyWadnameContains(
const QString &text,
282 Qt::CaseSensitivity cs = Qt::CaseInsensitive)
const;
289 void clearPlayersList();
294 QString customDetails();
299 const QList<DMFlagsSection> &dmFlags()
const;
303 const QString &email()
const;
312 QString engineName()
const;
321 const QString &gameVersion()
const;
335 QString hostName(
bool forceAddress =
false)
const;
339 const QPixmap &icon()
const;
346 bool isCustom()
const;
350 bool isEmpty()
const;
361 bool isKnown()
const;
366 bool isLockedAnywhere()
const;
370 bool isLocked()
const;
374 bool isLockedInGame()
const;
379 bool isRandomMapRotation()
const;
383 bool isRefreshing()
const;
393 bool isSecure()
const;
398 bool isSpecial()
const;
403 bool isTestingServer()
const;
408 const QString &iwad()
const;
427 const QString &map()
const;
431 const QStringList &mapList()
const;
438 unsigned short maxClients()
const;
442 unsigned short maxPlayers()
const;
446 const QString &motd()
const;
450 const QString &name()
const;
454 int numFreeClientSlots()
const;
458 int numFreeJoinSlots()
const;
464 int numFreeSpectatorSlots()
const;
471 return maxPlayers() > maxClients() ? maxPlayers() : maxClients();
480 unsigned int ping()
const;
484 const Player &player(
int index)
const;
492 unsigned short port()
const;
498 Response readRefreshQueryResponse(
const QByteArray &data);
503 void refreshStarts();
508 void refreshStops(
Response response);
513 unsigned int score(
int team = 0)
const;
517 const QList<int> &scores()
const;
523 unsigned int scoreLimit()
const;
534 QWeakPointer<Server>
self()
const;
542 bool sendRefreshQuery(QUdpSocket *socket);
548 void setCustom(
bool custom);
552 void setEmail(
const QString &mail);
556 void setGameMode(
const GameMode &gameMode);
560 void setMap(
const QString &name);
564 void setMapList(
const QStringList &mapList);
568 void setMaxClients(
unsigned short i);
572 void setMaxPlayers(
unsigned short i);
576 void setMotd(
const QString &message);
580 void setName(
const QString &name);
584 void setPort(
unsigned short i);
588 void setRandomMapRotation(
bool b);
594 void setSelf(
const QWeakPointer<Server> &
self);
598 void setSkill(
unsigned char newSkill);
602 void setWebSite(
const QString &site);
607 unsigned short timeLeft()
const;
611 unsigned short timeLimit()
const;
625 qint64 timeMsSinceLastRefresh()
const;
634 unsigned char skill()
const;
638 const PWad &wad(
int index)
const;
642 const QList<PWad> &wads()
const;
646 const QString &webSite()
const;
661 void begunRefreshing(ServerPtr server);
673 void updated(ServerPtr server,
int response);
676 POLYMORPHIC_SETTER_DECLARE(QString,
Server, customDetails, ())
677 QString customDetails_default();
686 Response readRequest(
const QByteArray &data);
687 POLYMORPHIC_SETTER_DECLARE(
Response,
Server, readRequest, (
const QByteArray &data))
694 QByteArray createSendRequest();
695 POLYMORPHIC_SETTER_DECLARE(QByteArray,
Server, createSendRequest, ())
700 void addWad(
const PWad &wad);
709 QList<int> &scoresMutable();
713 void setDmFlags(
const QList<DMFlagsSection> &dmFlags);
717 void setGameVersion(
const QString &version);
721 void setIwad(
const QString &iwad);
725 void setLocked(
bool locked);
729 void setLockedInGame(
bool locked);
736 void setPing(
unsigned int currentPing);
744 void setPingIsSet(
bool b);
746 void setTestingServer(
bool b);
750 void setTimeLeft(
unsigned short timeLeft);
754 void setTimeLimit(
unsigned short timeLimit);
758 void setScoreLimit(
unsigned int scoreLimit);
762 void setSecure(
bool bSecureServer);
767 static QString teamNames[];
773 QByteArray createSendRequest_default();
774 Response readRequest_default(
const QByteArray &data);
776 void setResponse(
Response response);
777 void setScores(
const QList<int> &scores);
778 void setWads(
const QList<PWad> &wads);
781 void setHostName(QHostInfo host);
784 Q_DECLARE_METATYPE(ServerPtr)
785 Q_DECLARE_METATYPE(ServerCPtr)
Waiting for additional packets.
Performs a case-insensitive (OS independent) file searches.
Player is banned from that server.
virtual bool hasRcon() const
Does this server support remote console connection?
int numTotalSlots() const
Actual number of free connection slots deduced from maxPlayers() and maxClients().
A group of DMFlag objects that can be safely OR'ed together to form a meaningful value.
A representation of a server for a given game.
"Dummy" response for servers that weren't refreshed yet.
Doomseeker needs to send some more challenge data to the server.
Response from the server was erroneous.
Remote console protocol interface.
Data structure that holds information about players in a server.
virtual RConProtocol * rcon()
Spawns RConProtocol instance.
Game mode representation.
Response was parsed properly and Server information is available.
Creates game servers, offline games or demo playbacks.
Server didn't respond at all.
Creates command line that launches the client executable of the game and connects it to a server...
Response
Type of response that is extracted by parsing the packet that came from the Server.
int numWads() const
Number of PWADs loaded on this server.
Access to external program executables (game clients, servers, and so on).
A general game setting or variable (like fraglimit).
Server responded with "wait", may happen when we refresh too quickly.