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;
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;
469 int numTotalSlots()
const {
return maxPlayers() > maxClients() ? maxPlayers() : maxClients(); }
477 unsigned int ping()
const;
481 const Player& player(
int index)
const;
489 unsigned short port()
const;
495 Response readRefreshQueryResponse(
const QByteArray& data);
500 void refreshStarts();
505 void refreshStops(
Response response);
510 unsigned int score(
int team=0)
const;
514 const QList<int>& scores()
const;
520 unsigned int scoreLimit()
const;
531 QWeakPointer<Server>
self()
const;
539 bool sendRefreshQuery(QUdpSocket* socket);
545 void setCustom(
bool custom);
549 void setEmail(
const QString& mail);
553 void setGameMode(
const GameMode& gameMode);
557 void setMap(
const QString& name);
561 void setMapList(
const QStringList& mapList);
565 void setMaxClients(
unsigned short i);
569 void setMaxPlayers(
unsigned short i);
573 void setMotd(
const QString& message);
577 void setName(
const QString& name);
581 void setPort(
unsigned short i);
585 void setRandomMapRotation(
bool b);
591 void setSelf(
const QWeakPointer<Server> &
self);
595 void setSkill(
unsigned char newSkill);
599 void setWebSite(
const QString& site);
604 unsigned short timeLeft()
const;
608 unsigned short timeLimit()
const;
622 qint64 timeMsSinceLastRefresh()
const;
631 unsigned char skill()
const;
635 const PWad &wad(
int index)
const;
639 const QList<PWad>& wads()
const;
643 const QString& webSite()
const;
658 void begunRefreshing(ServerPtr server);
670 void updated(ServerPtr server,
int response);
673 POLYMORPHIC_SETTER_DECLARE(QString,
Server, customDetails, ());
674 QString customDetails_default();
683 Response readRequest(
const QByteArray &data);
684 POLYMORPHIC_SETTER_DECLARE(
Response,
Server, readRequest, (
const QByteArray &data));
691 QByteArray createSendRequest();
692 POLYMORPHIC_SETTER_DECLARE(QByteArray,
Server, createSendRequest, ());
697 void addWad(
const PWad& wad);
706 QList<int>& scoresMutable();
710 void setDmFlags(
const QList<DMFlagsSection>& dmFlags);
714 void setGameVersion(
const QString& version);
718 void setIwad(
const QString& iwad);
722 void setLocked(
bool locked);
726 void setLockedInGame(
bool locked);
733 void setPing(
unsigned int currentPing);
741 void setPingIsSet(
bool b);
743 void setTestingServer(
bool b);
747 void setTimeLeft(
unsigned short timeLeft);
751 void setTimeLimit(
unsigned short timeLimit);
755 void setScoreLimit(
unsigned int scoreLimit);
759 void setSecure(
bool bSecureServer);
764 static QString teamNames[];
770 QByteArray createSendRequest_default();
771 Response readRequest_default(
const QByteArray &data);
773 void setResponse(
Response response);
774 void setScores(
const QList<int>& scores);
775 void setWads(
const QList<PWad>& wads);
778 void setHostName(QHostInfo host);
781 Q_DECLARE_METATYPE(ServerPtr);
782 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.