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 bool isSpecial()
const;
395 bool isTestingServer()
const;
400 const QString& iwad()
const;
419 const QString& map()
const;
423 const QStringList& mapList()
const;
430 unsigned short maxClients()
const;
434 unsigned short maxPlayers()
const;
438 const QString& motd()
const;
442 const QString& name()
const;
446 int numFreeClientSlots()
const;
450 int numFreeJoinSlots()
const;
456 int numFreeSpectatorSlots()
const;
461 int numTotalSlots()
const {
return maxPlayers() > maxClients() ? maxPlayers() : maxClients(); }
469 unsigned int ping()
const;
473 const Player& player(
int index)
const;
481 unsigned short port()
const;
487 Response readRefreshQueryResponse(
const QByteArray& data);
492 void refreshStarts();
497 void refreshStops(
Response response);
502 unsigned int score(
int team=0)
const;
506 const QList<int>& scores()
const;
512 unsigned int scoreLimit()
const;
523 QWeakPointer<Server>
self()
const;
531 bool sendRefreshQuery(QUdpSocket* socket);
537 void setCustom(
bool custom);
541 void setEmail(
const QString& mail);
545 void setGameMode(
const GameMode& gameMode);
549 void setMap(
const QString& name);
553 void setMapList(
const QStringList& mapList);
557 void setMaxClients(
unsigned short i);
561 void setMaxPlayers(
unsigned short i);
565 void setMotd(
const QString& message);
569 void setName(
const QString& name);
573 void setPort(
unsigned short i);
577 void setRandomMapRotation(
bool b);
583 void setSelf(
const QWeakPointer<Server> &
self);
587 void setSkill(
unsigned char newSkill);
591 void setWebSite(
const QString& site);
596 unsigned short timeLeft()
const;
600 unsigned short timeLimit()
const;
614 qint64 timeMsSinceLastRefresh()
const;
623 unsigned char skill()
const;
627 const PWad &wad(
int index)
const;
631 const QList<PWad>& wads()
const;
635 const QString& webSite()
const;
650 void begunRefreshing(ServerPtr server);
662 void updated(ServerPtr server,
int response);
665 POLYMORPHIC_SETTER_DECLARE(QString,
Server, customDetails, ());
666 QString customDetails_default();
675 Response readRequest(
const QByteArray &data);
676 POLYMORPHIC_SETTER_DECLARE(
Response,
Server, readRequest, (
const QByteArray &data));
683 QByteArray createSendRequest();
684 POLYMORPHIC_SETTER_DECLARE(QByteArray,
Server, createSendRequest, ());
689 void addWad(
const PWad& wad);
698 QList<int>& scoresMutable();
702 void setDmFlags(
const QList<DMFlagsSection>& dmFlags);
706 void setGameVersion(
const QString& version);
710 void setIwad(
const QString& iwad);
714 void setLocked(
bool locked);
718 void setLockedInGame(
bool locked);
725 void setPing(
unsigned int currentPing);
733 void setPingIsSet(
bool b);
735 void setTestingServer(
bool b);
739 void setTimeLeft(
unsigned short timeLeft);
743 void setTimeLimit(
unsigned short timeLimit);
747 void setScoreLimit(
unsigned int scoreLimit);
751 void setSecure(
bool bSecureServer);
756 static QString teamNames[];
762 QByteArray createSendRequest_default();
763 Response readRequest_default(
const QByteArray &data);
765 void setResponse(
Response response);
766 void setScores(
const QList<int>& scores);
767 void setWads(
const QList<PWad>& wads);
770 void setHostName(QHostInfo host);
773 Q_DECLARE_METATYPE(ServerPtr);
774 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.