27 #include "serverapi/polymorphism.h"
35 #include <QHostAddress>
93 class MAIN_EXPORT
Server :
public QObject
97 friend class ServerPointer;
158 Server(
const QHostAddress &address,
unsigned short port);
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;
255 void addPlayer(
const Player& player);
259 const QHostAddress &address()
const;
263 QString addressWithPort()
const;
268 QStringList allWadNames()
const;
273 bool anyWadnameContains(
const QString& text,
274 Qt::CaseSensitivity cs = Qt::CaseInsensitive)
const;
281 void clearPlayersList();
286 QString customDetails();
291 const QList<DMFlagsSection>& dmFlags()
const;
295 const QString& email()
const;
304 QString engineName()
const;
313 const QString& gameVersion()
const;
327 QString hostName(
bool forceAddress=
false)
const;
331 const QPixmap &icon()
const;
338 bool isCustom()
const;
342 bool isEmpty()
const;
353 bool isKnown()
const;
358 bool isLockedAnywhere()
const;
362 bool isLocked()
const;
366 bool isLockedInGame()
const;
371 bool isRandomMapRotation()
const;
375 bool isRefreshing()
const;
385 bool isSecure()
const;
390 const QString& iwad()
const;
396 Response lastResponse()
const;
409 const QString& map()
const;
413 const QStringList& mapList()
const;
420 unsigned short maxClients()
const;
424 unsigned short maxPlayers()
const;
428 const QString& motd()
const;
432 const QString& name()
const;
436 int numFreeClientSlots()
const;
440 int numFreeJoinSlots()
const;
446 int numFreeSpectatorSlots()
const;
451 int numTotalSlots()
const {
return maxPlayers() > maxClients() ? maxPlayers() : maxClients(); }
459 unsigned int ping()
const;
463 const Player& player(
int index)
const;
471 unsigned short port()
const;
477 Response readRefreshQueryResponse(
const QByteArray& data);
482 void refreshStarts();
487 void refreshStops(Response response);
492 unsigned int score(
int team=0)
const;
496 const QList<int>& scores()
const;
502 unsigned int scoreLimit()
const;
513 QWeakPointer<Server>
self()
const;
521 bool sendRefreshQuery(QUdpSocket* socket);
527 void setCustom(
bool custom);
531 void setEmail(
const QString& mail);
535 void setGameMode(
const GameMode& gameMode);
539 void setMap(
const QString& name);
543 void setMapList(
const QStringList& mapList);
547 void setMaxClients(
unsigned short i);
551 void setMaxPlayers(
unsigned short i);
555 void setMotd(
const QString& message);
559 void setName(
const QString& name);
563 void setPort(
unsigned short i);
567 void setRandomMapRotation(
bool b);
573 void setSelf(
const QWeakPointer<Server> &
self);
577 void setSkill(
unsigned char newSkill);
581 void setWebSite(
const QString& site);
586 unsigned short timeLeft()
const;
590 unsigned short timeLimit()
const;
604 qint64 timeMsSinceLastRefresh()
const;
613 unsigned char skill()
const;
617 const PWad &wad(
int index)
const;
621 const QList<PWad>& wads()
const;
625 const QString& webSite()
const;
634 void begunRefreshing(ServerPtr server);
646 void updated(ServerPtr server,
int response);
649 POLYMORPHIC_SETTER_DECLARE(QString,
Server, customDetails, ());
650 QString customDetails_default();
659 Response readRequest(
const QByteArray &data);
660 POLYMORPHIC_SETTER_DECLARE(Response,
Server, readRequest, (
const QByteArray &data));
667 QByteArray createSendRequest();
668 POLYMORPHIC_SETTER_DECLARE(QByteArray,
Server, createSendRequest, ());
673 void addWad(
const PWad& wad);
682 QList<int>& scoresMutable();
686 void setDmFlags(
const QList<DMFlagsSection>& dmFlags);
690 void setGameVersion(
const QString& version);
694 void setIwad(
const QString& iwad);
698 void setLocked(
bool locked);
702 void setLockedInGame(
bool locked);
709 void setPing(
unsigned int currentPing);
717 void setPingIsSet(
bool b);
722 void setTimeLeft(
unsigned short timeLeft);
726 void setTimeLimit(
unsigned short timeLimit);
730 void setScoreLimit(
unsigned int scoreLimit);
734 void setSecure(
bool bSecureServer);
739 static QString teamNames[];
748 void emitUpdated(
int response);
750 QByteArray createSendRequest_default();
751 Response readRequest_default(const QByteArray &data);
753 void setResponse(Response response);
754 void setScores(const QList<
int>& scores);
755 void setWads(const QList<
PWad>& wads);
758 void setHostName(QHostInfo host);
761 Q_DECLARE_METATYPE(ServerPtr);
762 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 erroreneous.
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.