Planeshift
|
00001 /* 00002 * psserver.h 00003 * 00004 * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef __PSSERVER_H__ 00021 #define __PSSERVER_H__ 00022 #include "psstdint.h" 00023 00024 //============================================================================= 00025 // Crystal Space Includes 00026 //============================================================================= 00027 #include <csutil/ref.h> 00028 #include <csutil/randomgen.h> 00029 #include <csutil/csstring.h> 00030 00031 //============================================================================= 00032 // Project Includes 00033 //============================================================================= 00034 #include "util/psconst.h" 00035 00036 //============================================================================= 00037 // Local Includes 00038 //============================================================================= 00039 00040 00041 struct iObjectRegistry; 00042 struct iConfigManager; 00043 class NetManager; 00044 struct iChat; 00045 class EntityManager; 00046 class MsgHandler; // Receive and distributes incoming messages. 00047 class AuthenticationServer; 00048 class ChatManager; 00049 class GuildManager; 00050 class GroupManager; 00051 class AdminManager; 00052 class UserManager; 00053 class WeatherManager; 00054 class psTimerThread; 00055 class psDatabase; 00056 class ServerCharManager; 00057 class SpawnManager; 00058 class EventManager; 00059 class TutorialManager; 00060 class ServerStatus; 00061 class psMarriageManager; 00062 class CombatManager; 00063 class SpellManager; 00064 class ExchangeManager; 00065 class ProgressionManager; 00066 class NPCManager; 00067 class CacheManager; 00068 class psCharacterLoader; 00069 class csRandomGen; 00070 class CharCreationManager; 00071 class QuestManager; 00072 class EconomyManager; 00073 class WorkManager; 00074 class QuestionManager; 00075 class ClientConnectionSet; 00076 class Client; 00077 class MathScriptEngine; 00078 class AdviceManager; 00079 class ActionManager; 00080 class IntroductionManager; 00081 class ServerSongManager; 00082 class MiniGameManager; 00083 class LogCSV; 00084 class iResultSet; 00085 class csVector3; 00086 struct iVFS; 00087 class GMEventManager; 00088 class BankManager; 00089 class HireManager; 00090 class ServerConsole; 00091 class psQuitEvent; 00092 00102 class psServer 00103 { 00104 public: 00105 00111 psServer(); 00112 00119 ~psServer(); 00120 00149 bool Initialize(iObjectRegistry* objreg); 00150 00162 void MainLoop(); 00163 00169 bool IsMapLoaded() 00170 { 00171 return MapLoaded; 00172 } 00173 00180 bool LoadMap(const char* mapname); 00181 00188 bool IsReady(); 00189 00196 bool HasBeenReady(); 00197 00204 bool IsFull(size_t numclients, Client* client); 00205 00217 void RemovePlayer(uint32_t clientnum,const char* reason); 00218 00228 void MutePlayer(uint32_t clientnum,const char* reason); 00229 00233 void UnmutePlayer(uint32_t clientnum,const char* reason); 00234 00238 const char* GetMOTD() 00239 { 00240 return (const char*)motd.GetData(); 00241 } 00242 00246 void SetMOTD(const char* str) 00247 { 00248 motd=str; 00249 } 00250 00256 NetManager* GetNetManager() 00257 { 00258 return netmanager; 00259 } 00260 00266 ChatManager* GetChatManager() 00267 { 00268 return chatmanager; 00269 } 00270 00276 AdviceManager* GetAdviceManager() 00277 { 00278 return advicemanager; 00279 } 00280 00286 ActionManager* GetActionManager() 00287 { 00288 return actionmanager; 00289 } 00290 00296 NPCManager* GetNPCManager() 00297 { 00298 return npcmanager; 00299 } 00300 00306 psDatabase* GetDatabase() 00307 { 00308 return database; 00309 } 00310 00316 iConfigManager* GetConfig() 00317 { 00318 return configmanager; 00319 } 00320 00326 iObjectRegistry* GetObjectReg() 00327 { 00328 return objreg; 00329 } 00330 00336 SpawnManager* GetSpawnManager() 00337 { 00338 return spawnmanager; 00339 } 00340 00346 EventManager* GetEventManager() 00347 { 00348 return eventmanager; 00349 } 00350 00356 WeatherManager* GetWeatherManager() 00357 { 00358 return weathermanager; 00359 } 00360 00366 MathScriptEngine* GetMathScriptEngine() 00367 { 00368 return mathscriptengine; 00369 } 00370 00376 AdminManager* GetAdminManager() 00377 { 00378 return adminmanager; 00379 } 00380 00387 ServerCharManager* GetCharManager() 00388 { 00389 return charmanager; 00390 } 00391 00397 ProgressionManager* GetProgressionManager() 00398 { 00399 return progression; 00400 } 00401 00405 psMarriageManager* GetMarriageManager() 00406 { 00407 return marriageManager; 00408 } 00409 00413 ExchangeManager* GetExchangeManager() 00414 { 00415 return exchangemanager; 00416 } 00417 00423 CombatManager* GetCombatManager() 00424 { 00425 return combatmanager; 00426 } 00427 00434 SpellManager* GetSpellManager() 00435 { 00436 return spellmanager; 00437 } 00438 00445 WorkManager* GetWorkManager() 00446 { 00447 return workmanager; 00448 } 00449 00456 GuildManager* GetGuildManager() 00457 { 00458 return guildmanager; 00459 } 00460 00467 EconomyManager* GetEconomyManager() 00468 { 00469 return economymanager; 00470 } 00471 00478 MiniGameManager* GetMiniGameManager() 00479 { 00480 return minigamemanager; 00481 } 00482 00489 GMEventManager* GetGMEventManager() 00490 { 00491 return gmeventManager; 00492 } 00493 00499 BankManager* GetBankManager() 00500 { 00501 return bankmanager; 00502 } 00503 00509 HireManager* GetHireManager() 00510 { 00511 return hiremanager; 00512 } 00513 00519 UserManager* GetUserManager() 00520 { 00521 return usermanager; 00522 } 00523 00529 CacheManager* GetCacheManager() 00530 { 00531 return cachemanager; 00532 } 00533 00539 IntroductionManager* GetIntroductionManager() 00540 { 00541 return intromanager; 00542 } 00543 00549 ServerSongManager* GetSongManager() 00550 { 00551 return songManager; 00552 } 00553 00559 TutorialManager* GetTutorialManager() 00560 { 00561 return tutorialmanager; 00562 } 00563 00567 AuthenticationServer* GetAuthServer() 00568 { 00569 return authserver; 00570 } 00571 00577 ClientConnectionSet* GetConnections(); 00578 00584 float GetRandom() 00585 { 00586 return rng->Get(); 00587 } 00588 00594 float GetRandomRange(const float pos, const float range) 00595 { 00596 return (pos - range + GetRandom()*range*2); 00597 } 00598 00604 uint32 GetRandom(uint32 limit) 00605 { 00606 return rng->Get(limit); 00607 } 00608 00612 void SendSystemInfo(int clientnum, const char* fmt, ...); 00613 00617 void SendSystemBaseInfo(int clientnum, const char* fmt, ...); 00618 00622 void SendSystemResult(int clientnum,const char* fmt, ...); 00623 00627 void SendSystemOK(int clientnum,const char* fmt, ...); 00628 00632 void SendSystemError(int clientnum, const char* fmt, ...); 00633 00634 LogCSV* GetLogCSV() 00635 { 00636 return logcsv; 00637 } 00638 00642 void LoadLogSettings(); 00643 00647 void SaveLogSettings(); 00648 00660 bool AddBuddy(PID self, PID buddy); 00661 00672 bool RemoveBuddy(PID self, PID buddy); 00673 00692 void UpdateDialog(const char* area, const char* trigger, 00693 const char* response, int num); 00694 00707 void UpdateDialog(const char* area, const char* trigger, 00708 const char* prohim, const char* proher, 00709 const char* it, const char* them); 00710 00719 iResultSet* GetAllTriggersInArea(csString data); 00720 00734 iResultSet* GetSuperclientNPCs(int superclientID); 00735 00743 bool GetServerOption(const char* option_name,csString &value); 00744 00752 bool SetServerOption(const char* option_name,const csString &value); 00753 00754 iResultSet* GetAllResponses(csString &trigger); 00755 00765 bool CheckAccess(Client* client, const char* command, bool returnError=true); 00766 00773 void QuitServer(int time, Client* client); 00774 00778 PID GetUnusedPID() 00779 { 00780 return --unused_pid; 00781 } 00782 00785 QuestManager* GetQuestManager() 00786 { 00787 return questmanager; 00788 } 00789 00790 00791 static psCharacterLoader CharacterLoader; 00792 00793 NPCManager* npcmanager; 00794 psMarriageManager* marriageManager; 00795 CombatManager* combatmanager; 00796 csRandomGen* rng; 00797 QuestManager* questmanager; 00798 CharCreationManager* charCreationManager; 00799 csRef<GuildManager> guildmanager; 00800 csRef<QuestionManager> questionmanager; 00801 csRef<GroupManager> groupmanager; 00802 UserManager* usermanager; 00803 ExchangeManager* exchangemanager; 00804 EntityManager* entitymanager; 00805 CacheManager* cachemanager; 00806 csRef<iVFS> vfs; 00807 00808 protected: 00809 00810 ServerConsole* serverconsole; 00811 NetManager* netmanager; 00812 AdminManager* adminmanager; 00813 psDatabase* database; 00814 ServerCharManager* charmanager; 00815 SpawnManager* spawnmanager; 00816 csRef<EventManager> eventmanager; 00817 WeatherManager* weathermanager; 00818 SpellManager* spellmanager; 00819 ProgressionManager* progression; 00820 WorkManager* workmanager; 00821 EconomyManager* economymanager; 00822 TutorialManager* tutorialmanager; 00823 MiniGameManager* minigamemanager; 00824 IntroductionManager* intromanager; 00825 ServerSongManager* songManager; 00826 MathScriptEngine* mathscriptengine; 00827 iObjectRegistry* objreg; 00828 csRef<iConfigManager> configmanager; 00829 csRef<ChatManager> chatmanager; 00830 csRef<AdviceManager> advicemanager; 00831 csRef<ActionManager> actionmanager; 00832 csRef<AuthenticationServer> authserver; 00833 LogCSV* logcsv; 00834 bool MapLoaded; 00835 csString motd; 00836 GMEventManager* gmeventManager; 00837 BankManager* bankmanager; 00838 HireManager* hiremanager; 00839 00840 psQuitEvent* server_quit_event; 00841 00846 uint32_t unused_pid; 00847 }; 00848 00851 #endif 00852 00853 00854