/ [w3loader] / ghost / src / ghost.h
To checkout: svn checkout http://svn.gnu.org.ua/sources/w3loader/ghost/src/ghost.h
Puszcza

Contents of /ghost/src/ghost.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations)
Tue Jun 2 19:44:46 2020 UTC (16 months, 3 weeks ago) by zombieteam
File MIME type: text/plain
File size: 8831 byte(s)
kick when save game
1 /*
2
3 Copyright [2008] [Trevor Hogan]
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17 CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
18
19 */
20
21 #ifndef GHOST_H
22 #define GHOST_H
23
24 #include "includes.h"
25
26 //
27 // CGHost
28 //
29
30 class CUDPSocket;
31 class CTCPServer;
32 class CTCPSocket;
33 class CGPSProtocol;
34 class CCRC32;
35 class CSHA1;
36 class CBNET;
37 class CBaseGame;
38 class CAdminGame;
39 class CGHostDB;
40 class CBaseCallable;
41 class CLanguage;
42 class CMap;
43 class CSaveGame;
44 class CConfig;
45
46 class CGHost
47 {
48 public:
49 CUDPSocket *m_UDPSocket; // a UDP socket for sending broadcasts and other junk (used with !sendlan)
50 CTCPServer *m_ReconnectSocket; // listening socket for GProxy++ reliable reconnects
51 vector<CTCPSocket *> m_ReconnectSockets;// vector of sockets attempting to reconnect (connected but not identified yet)
52 CGPSProtocol *m_GPSProtocol;
53 CCRC32 *m_CRC; // for calculating CRC's
54 CSHA1 *m_SHA; // for calculating SHA1's
55 vector<CBNET *> m_BNETs; // all our battle.net connections (there can be more than one)
56 CBaseGame *m_CurrentGame; // this game is still in the lobby state
57 CAdminGame *m_AdminGame; // this "fake game" allows an admin who knows the password to control the bot from the local network
58 vector<CBaseGame *> m_Games; // these games are in progress
59 CGHostDB *m_DB; // database
60 CGHostDB *m_DBLocal; // local database (for temporary data)
61 vector<CBaseCallable *> m_Callables; // vector of orphaned callables waiting to die
62 vector<BYTEARRAY> m_LocalAddresses; // vector of local IP addresses
63 CLanguage *m_Language; // language
64 CMap *m_Map; // the currently loaded map
65 CMap *m_AdminMap; // the map to use in the admin game
66 CMap *m_AutoHostMap; // the map to use when autohosting
67 CSaveGame *m_SaveGame; // the save game to use
68 vector<PIDPlayer> m_EnforcePlayers; // vector of pids to force players to use in the next game (used with saved games)
69 bool m_Exiting; // set to true to force ghost to shutdown next update (used by SignalCatcher)
70 bool m_ExitingNice; // set to true to force ghost to disconnect from all battle.net connections and wait for all games to finish before shutting down
71 bool m_Enabled; // set to false to prevent new games from being created
72 string m_Version; // GHost++ version string
73 uint32_t m_HostCounter; // the current host counter (a unique number to identify a game, incremented each time a game is created)
74 string m_AutoHostGameName; // the base game name to auto host with
75 string m_AutoHostOwner;
76 string m_AutoHostServer;
77 uint32_t m_AutoHostMaximumGames; // maximum number of games to auto host
78 uint32_t m_AutoHostAutoStartPlayers; // when using auto hosting auto start the game when this many players have joined
79 uint32_t m_LastAutoHostTime; // GetTime when the last auto host was attempted
80 bool m_AutoHostMatchMaking;
81 double m_AutoHostMinimumScore;
82 double m_AutoHostMaximumScore;
83 bool m_AllGamesFinished; // if all games finished (used when exiting nicely)
84 uint32_t m_AllGamesFinishedTime; // GetTime when all games finished (used when exiting nicely)
85 string m_LanguageFile; // config value: language file
86 string m_Warcraft3Path; // config value: Warcraft 3 path
87 bool m_TFT; // config value: TFT enabled or not
88 string m_BindAddress; // config value: the address to host games on
89 uint16_t m_HostPort; // config value: the port to host games on
90 bool m_Reconnect; // config value: GProxy++ reliable reconnects enabled or not
91 uint16_t m_ReconnectPort; // config value: the port to listen for GProxy++ reliable reconnects on
92 uint32_t m_ReconnectWaitTime; // config value: the maximum number of minutes to wait for a GProxy++ reliable reconnect
93 uint32_t m_MaxGames; // config value: maximum number of games in progress
94 char m_CommandTrigger; // config value: the command trigger inside games
95 string m_MapCFGPath; // config value: map cfg path
96 string m_SaveGamePath; // config value: savegame path
97 string m_MapPath; // config value: map path
98 bool m_SaveReplays; // config value: save replays
99 string m_ReplayPath; // config value: replay path
100 string m_VirtualHostName; // config value: virtual host name
101 bool m_HideIPAddresses; // config value: hide IP addresses from players
102 bool m_CheckMultipleIPUsage; // config value: check for multiple IP address usage
103 uint32_t m_SpoofChecks; // config value: do automatic spoof checks or not
104 bool m_RequireSpoofChecks; // config value: require spoof checks or not
105 bool m_ReserveAdmins; // config value: consider admins to be reserved players or not
106 bool m_RefreshMessages; // config value: display refresh messages or not (by default)
107 bool m_AutoLock; // config value: auto lock games when the owner is present
108 bool m_AutoSave; // config value: auto save before someone disconnects
109 uint32_t m_AllowDownloads; // config value: allow map downloads or not
110 bool m_PingDuringDownloads; // config value: ping during map downloads or not
111 uint32_t m_MaxDownloaders; // config value: maximum number of map downloaders at the same time
112 uint32_t m_MaxDownloadSpeed; // config value: maximum total map download speed in KB/sec
113 bool m_LCPings; // config value: use LC style pings (divide actual pings by two)
114 uint32_t m_AutoKickPing; // config value: auto kick players with ping higher than this
115 uint32_t m_BanMethod; // config value: ban method (ban by name/ip/both)
116 string m_IPBlackListFile; // config value: IP blacklist file (ipblacklist.txt)
117 uint32_t m_LobbyTimeLimit; // config value: auto close the game lobby after this many minutes without any reserved players
118 uint32_t m_Latency; // config value: the latency (by default)
119 uint32_t m_SyncLimit; // config value: the maximum number of packets a player can fall out of sync before starting the lag screen (by default)
120 bool m_VoteKickAllowed; // config value: if votekicks are allowed or not
121 uint32_t m_VoteKickPercentage; // config value: percentage of players required to vote yes for a votekick to pass
122 string m_DefaultMap; // config value: default map (map.cfg)
123 string m_MOTDFile; // config value: motd.txt
124 string m_GameLoadedFile; // config value: gameloaded.txt
125 string m_GameOverFile; // config value: gameover.txt
126 bool m_LocalAdminMessages; // config value: send local admin messages or not
127 bool m_AdminGameCreate; // config value: create the admin game or not
128 uint16_t m_AdminGamePort; // config value: the port to host the admin game on
129 string m_AdminGamePassword; // config value: the admin game password
130 string m_AdminGameMap; // config value: the admin game map config to use
131 unsigned char m_LANWar3Version; // config value: LAN warcraft 3 version
132 uint32_t m_ReplayWar3Version; // config value: replay warcraft 3 version (for saving replays)
133 uint32_t m_ReplayBuildNumber; // config value: replay build number (for saving replays)
134 bool m_TCPNoDelay; // config value: use Nagle's algorithm or not
135 uint32_t m_MatchMakingMethod; // config value: the matchmaking method
136 bool m_KickGameSaver;
137
138 CGHost( CConfig *CFG );
139 ~CGHost( );
140
141 // processing functions
142
143 bool Update( long usecBlock );
144
145 // events
146
147 void EventBNETConnecting( CBNET *bnet );
148 void EventBNETConnected( CBNET *bnet );
149 void EventBNETDisconnected( CBNET *bnet );
150 void EventBNETLoggedIn( CBNET *bnet );
151 void EventBNETGameRefreshed( CBNET *bnet );
152 void EventBNETGameRefreshFailed( CBNET *bnet );
153 void EventBNETConnectTimedOut( CBNET *bnet );
154 void EventBNETWhisper( CBNET *bnet, string user, string message );
155 void EventBNETChat( CBNET *bnet, string user, string message );
156 void EventBNETEmote( CBNET *bnet, string user, string message );
157 void EventGameDeleted( CBaseGame *game );
158
159 // other functions
160
161 void ReloadConfigs( );
162 void SetConfigs( CConfig *CFG );
163 void ExtractScripts( );
164 void LoadIPToCountryData( );
165 void CreateGame( CMap *map, unsigned char gameState, bool saveGame, string gameName, string ownerName, string creatorName, string creatorServer, bool whisper );
166 };
167
168 #endif

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20