mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Output DB/ScriptLib versions in ".server info" command.
Required support by used scripting library.
This commit is contained in:
parent
24549669a9
commit
6f190fedd4
15 changed files with 62 additions and 17 deletions
|
|
@ -2158,6 +2158,8 @@ INSERT INTO `mangos_string` VALUES
|
|||
(54,'The new passwords do not match',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(55,'Your password can\'t be longer than 16 characters (client limit), password not changed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(56,'Current Message of the day: \r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(100,'Global notify: ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(101,'Map: %u (%s) Zone: %u (%s) Area: %u (%s)\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(102,'%s is already being teleported.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
|
|
|
|||
5
sql/updates/2008_10_26_01_mangos_mangos_string.sql
Normal file
5
sql/updates/2008_10_26_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
DELETE FROM mangos_string WHERE entry IN (57,58);
|
||||
|
||||
INSERT INTO mangos_string VALUES
|
||||
(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
|
|
@ -106,6 +106,7 @@ pkgdata_DATA = \
|
|||
2008_10_23_03_mangos_mangos_string.sql \
|
||||
2008_10_23_04_mangos_command.sql \
|
||||
2008_10_23_05_mangos_command.sql \
|
||||
2008_10_26_01_mangos_mangos_string.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -193,4 +194,5 @@ EXTRA_DIST = \
|
|||
2008_10_23_03_mangos_mangos_string.sql \
|
||||
2008_10_23_04_mangos_command.sql \
|
||||
2008_10_23_05_mangos_command.sql \
|
||||
2008_10_26_01_mangos_mangos_string.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ void ScriptsInit()
|
|||
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
char const* ScriptsVersion()
|
||||
{
|
||||
return "Default MaNGOS scripting library";
|
||||
}
|
||||
|
||||
Script* GetScriptByName(std::string Name)
|
||||
{
|
||||
if(Name.empty())
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "exit", SEC_CONSOLE, true, &ChatHandler::HandleServerExitCommand, "", NULL },
|
||||
{ "idlerestart", SEC_ADMINISTRATOR, true, &ChatHandler::HandleIdleRestartCommand, "", NULL },
|
||||
{ "idleshutdown", SEC_ADMINISTRATOR, true, &ChatHandler::HandleIdleShutDownCommand, "", NULL },
|
||||
{ "info", SEC_PLAYER, true, &ChatHandler::HandleInfoCommand, "", NULL },
|
||||
{ "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL },
|
||||
{ "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL },
|
||||
{ "restart", SEC_ADMINISTRATOR, true, &ChatHandler::HandleRestartCommand, "", NULL },
|
||||
{ "shutdown", SEC_ADMINISTRATOR, true, &ChatHandler::HandleShutDownCommand, "", NULL },
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ class ChatHandler
|
|||
bool HandleHelpCommand(const char* args);
|
||||
bool HandleCommandsCommand(const char* args);
|
||||
bool HandleStartCommand(const char* args);
|
||||
bool HandleInfoCommand(const char* args);
|
||||
bool HandleDismountCommand(const char* args);
|
||||
bool HandleSaveCommand(const char* args);
|
||||
bool HandleGMListIngameCommand(const char* args);
|
||||
|
|
@ -220,6 +219,7 @@ class ChatHandler
|
|||
|
||||
bool HandleServerCorpsesCommand(const char* args);
|
||||
bool HandleServerExitCommand(const char* args);
|
||||
bool HandleServerInfoCommand(const char* args);
|
||||
bool HandleServerMotdCommand(const char* args);
|
||||
bool HandleServerSetMotdCommand(const char* args);
|
||||
bool HandleServerSetLogLevelCommand(const char* args);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ enum MangosStrings
|
|||
LANG_NEW_PASSWORDS_NOT_MATCH = 54,
|
||||
LANG_PASSWORD_TOO_LONG = 55,
|
||||
LANG_MOTD_CURRENT = 56,
|
||||
// Room for more level 0 57-99 not used
|
||||
LANG_USING_WORLD_DB = 57,
|
||||
LANG_USING_SCRIPT_LIB = 58,
|
||||
// Room for more level 0 59-99 not used
|
||||
|
||||
// level 1 chat
|
||||
LANG_GLOBAL_NOTIFY = 100,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleInfoCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
||||
{
|
||||
uint32 activeClientsNum = sWorld.GetActiveSessionCount();
|
||||
uint32 queuedClientsNum = sWorld.GetQueuedSessionCount();
|
||||
|
|
@ -99,7 +99,9 @@ bool ChatHandler::HandleInfoCommand(const char* /*args*/)
|
|||
else
|
||||
full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
|
||||
|
||||
PSendSysMessage(full);
|
||||
SendSysMessage(full);
|
||||
PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
|
||||
PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
|
||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||
PSendSysMessage(LANG_UPTIME, str.c_str());
|
||||
|
||||
|
|
|
|||
|
|
@ -739,6 +739,7 @@ class ObjectMgr
|
|||
void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost);
|
||||
bool RemoveVendorItem(uint32 entry,uint32 item);
|
||||
bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL ) const;
|
||||
|
||||
protected:
|
||||
uint32 m_auctionid;
|
||||
uint32 m_mailid;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "Platform/Define.h"
|
||||
#include "ScriptCalls.h"
|
||||
#include "World.h"
|
||||
|
||||
ScriptsSet Script=NULL;
|
||||
|
||||
|
|
@ -55,6 +56,7 @@ bool LoadScriptingModule(char const* libName)
|
|||
|
||||
if( !(testScript->ScriptsInit =(scriptCallScriptsInit )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" ))
|
||||
||!(testScript->ScriptsFree =(scriptCallScriptsFree )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" ))
|
||||
||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" ))
|
||||
||!(testScript->GossipHello =(scriptCallGossipHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" ))
|
||||
||!(testScript->GOChooseReward =(scriptCallGOChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" ))
|
||||
||!(testScript->QuestAccept =(scriptCallQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" ))
|
||||
|
|
@ -91,5 +93,7 @@ bool LoadScriptingModule(char const* libName)
|
|||
Script=testScript;
|
||||
Script->ScriptsInit();
|
||||
|
||||
sWorld.SetScriptsVersion(Script->ScriptsVersion());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ void UnloadScriptingModule();
|
|||
|
||||
typedef void(MANGOS_IMPORT * scriptCallScriptsInit) ();
|
||||
typedef void(MANGOS_IMPORT * scriptCallScriptsFree) ();
|
||||
typedef char const* (MANGOS_IMPORT * scriptCallScriptsVersion) ();
|
||||
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *);
|
||||
|
|
@ -62,6 +63,7 @@ typedef struct
|
|||
{
|
||||
scriptCallScriptsInit ScriptsInit;
|
||||
scriptCallScriptsFree ScriptsFree;
|
||||
scriptCallScriptsVersion ScriptsVersion;
|
||||
|
||||
scriptCallGossipHello GossipHello;
|
||||
scriptCallGOChooseReward GOChooseReward;
|
||||
|
|
|
|||
|
|
@ -2551,3 +2551,17 @@ void World::UpdateMaxSessionCounters()
|
|||
m_maxActiveSessionCount = std::max(m_maxActiveSessionCount,uint32(m_sessions.size()-m_QueuedPlayer.size()));
|
||||
m_maxQueuedSessionCount = std::max(m_maxQueuedSessionCount,uint32(m_QueuedPlayer.size()));
|
||||
}
|
||||
|
||||
void World::LoadDBVersion()
|
||||
{
|
||||
QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1");
|
||||
if(result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
m_DBVersion = fields[0].GetString();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
m_DBVersion = "unknown world database";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,6 +449,15 @@ class World
|
|||
void UpdateRealmCharCount(uint32 accid);
|
||||
|
||||
LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
|
||||
|
||||
//used World DB version
|
||||
void LoadDBVersion();
|
||||
char const* GetDBVersion() { return m_DBVersion.c_str(); }
|
||||
|
||||
//used Script version
|
||||
void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }
|
||||
char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); }
|
||||
|
||||
protected:
|
||||
void _UpdateGameTime();
|
||||
void ScriptsProcess();
|
||||
|
|
@ -508,6 +517,10 @@ class World
|
|||
//sessions that are added async
|
||||
void AddSession_(WorldSession* s);
|
||||
ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue;
|
||||
|
||||
//used versions
|
||||
std::string m_DBVersion;
|
||||
std::string m_ScriptsVersion;
|
||||
};
|
||||
|
||||
extern uint32 realmID;
|
||||
|
|
|
|||
|
|
@ -458,17 +458,9 @@ bool Master::_StartDB()
|
|||
///- Clean the database before starting
|
||||
clearOnlineAccounts();
|
||||
|
||||
QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1");
|
||||
if(result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
sLog.outString("Using %s", fields[0].GetString());
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
sLog.outString("Using unknown world database.");
|
||||
sWorld.LoadDBVersion();
|
||||
|
||||
sLog.outString("Using %s", sWorld.GetDBVersion());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue