Add "world:version" command

This commit is contained in:
Akkadius 2019-12-23 02:16:43 -06:00
parent 25bd285be5
commit d23dccec82
3 changed files with 58 additions and 24 deletions

View File

@ -1,20 +1,22 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _EQEMU_VERSION_H
#define _EQEMU_VERSION_H
@ -22,14 +24,15 @@
#define LOGIN_VERSION "0.8.0"
#define EQEMU_PROTOCOL_VERSION "0.3.10"
#define CURRENT_VERSION "1.1.3"
#define CURRENT_VERSION "2.0"
/*
Everytime a Database SQL is added to Github,
increment CURRENT_BINARY_DATABASE_VERSION number and make sure you update the manifest
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
/**
* Every time a Database SQL is added to Github increment CURRENT_BINARY_DATABASE_VERSION
* number and make sure you update the manifest
*
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9144
@ -38,6 +41,7 @@
#else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
#ifndef WIN32

View File

@ -46,7 +46,8 @@ namespace WorldserverCommandHandler {
/**
* Register commands
*/
function_map["database:version"] = &WorldserverCommandHandler::DatabaseVersion;
function_map["world:version"] = &WorldserverCommandHandler::Version;
function_map["database:version"] = &WorldserverCommandHandler::DatabaseVersion;
function_map["database:set-account-status"] = &WorldserverCommandHandler::DatabaseSetAccountStatus;
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
@ -77,6 +78,34 @@ namespace WorldserverCommandHandler {
std::cout << payload.str() << std::endl;
}
/**
* @param argc
* @param argv
* @param cmd
* @param description
*/
void Version(int argc, char **argv, argh::parser &cmd, std::string &description)
{
description = "Shows server version";
if (cmd[{"-h", "--help"}]) {
return;
}
Json::Value database_version;
database_version["bots_database_version"] = CURRENT_BINARY_BOTS_DATABASE_VERSION;
database_version["compile_date"] = COMPILE_DATE;
database_version["compile_time"] = COMPILE_TIME;
database_version["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
database_version["server_version"] = CURRENT_VERSION;
std::stringstream payload;
payload << database_version;
std::cout << payload.str() << std::endl;
}
/**
* @param argc
* @param argv

View File

@ -26,6 +26,7 @@
namespace WorldserverCommandHandler {
void CommandHandler(int argc, char **argv);
void Version(int argc, char **argv, argh::parser &cmd, std::string &description);
void DatabaseVersion(int argc, char **argv, argh::parser &cmd, std::string &description);
void DatabaseSetAccountStatus(int argc, char **argv, argh::parser &cmd, std::string &description);
};