-Releasing console support (disable by default)
--Allow admin to send some command in server by cli. (do not use those who require a real player) -Update msg system --Add RU translation from Lilith (give me that in UTF8 plz guys) --Upd FR translation from Capuche --Upd file read for something more dynamic --upd @langtype to display available when no arg enter as specified in doc --Fix few typos git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17255 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
8a5c0719bb
commit
755000f570
@ -1,2 +1,2 @@
|
|||||||
t
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
65: Character's base level raised.
|
65: Character's base level raised.
|
||||||
66: Character's base level lowered.
|
66: Character's base level lowered.
|
||||||
67: Character's job level can't go any higher.
|
67: Character's job level can't go any higher.
|
||||||
68: character's job level raised.
|
68: Character's job level raised.
|
||||||
69: Character's job level lowered.
|
69: Character's job level lowered.
|
||||||
70: You have learned the skill.
|
70: You have learned the skill.
|
||||||
71: You have forgotten the skill.
|
71: You have forgotten the skill.
|
||||||
@ -99,7 +99,7 @@
|
|||||||
78: %s: %d
|
78: %s: %d
|
||||||
79: It is %d affair above.
|
79: It is %d affair above.
|
||||||
80: Give the display name or monster name/id please.
|
80: Give the display name or monster name/id please.
|
||||||
81: Your GM level doesn't authorize you to preform this action on the specified player.
|
81: Your GM level doesn't authorize you to perform this action on the specified player.
|
||||||
82: Please provide a name or number from the list provided:
|
82: Please provide a name or number from the list provided:
|
||||||
83: Monster 'Emperium' cannot be spawned.
|
83: Monster 'Emperium' cannot be spawned.
|
||||||
84: All stats changed!
|
84: All stats changed!
|
||||||
|
File diff suppressed because it is too large
Load Diff
1462
conf/msg_conf/map_msg_rus.conf
Normal file
1462
conf/msg_conf/map_msg_rus.conf
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@
|
|||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
#include "../common/cli.h"
|
#include "../common/cli.h"
|
||||||
#include "../common/random.h"
|
#include "../common/random.h"
|
||||||
|
#include "../common/ers.h"
|
||||||
#include "int_guild.h"
|
#include "int_guild.h"
|
||||||
#include "int_homun.h"
|
#include "int_homun.h"
|
||||||
#include "int_mercenary.h"
|
#include "int_mercenary.h"
|
||||||
@ -4343,20 +4344,34 @@ int parse_char(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Console Command Parser [Wizputer]
|
// Console Command Parser [Wizputer]
|
||||||
int parse_console(const char* command)
|
int parse_console(const char* buf)
|
||||||
{
|
{
|
||||||
ShowNotice("Console command: %s\n", command);
|
char type[64];
|
||||||
|
char command[64];
|
||||||
|
int n=0;
|
||||||
|
|
||||||
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 || strcmpi("end", command) == 0 )
|
if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ){
|
||||||
|
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
|
||||||
|
}
|
||||||
|
if( n != 2 ){ //end string
|
||||||
|
command[0] = '\0';
|
||||||
|
}
|
||||||
|
ShowNotice("Type of command: '%s' || Command: '%s'\n",type,command);
|
||||||
|
|
||||||
|
if( n == 2 && strcmpi("server", type) == 0 ){
|
||||||
|
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
|
||||||
runflag = 0;
|
runflag = 0;
|
||||||
|
}
|
||||||
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
|
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
|
||||||
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
|
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
|
||||||
else if( strcmpi("help", command) == 0 )
|
}
|
||||||
{
|
else if( strcmpi("ers_report", type) == 0 ){
|
||||||
ShowInfo("To shutdown the server:\n");
|
ers_report();
|
||||||
ShowInfo(" 'shutdown|exit|quit|end'\n");
|
}
|
||||||
ShowInfo("To know if server is alive:\n");
|
else if( strcmpi("help", type) == 0 ){
|
||||||
ShowInfo(" 'alive|status'\n");
|
ShowInfo("Command available :\n");
|
||||||
|
ShowInfo("\t server:shutdown|alive => stop server\n");
|
||||||
|
ShowInfo("\t ers_report => display the db usage\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -5182,11 +5197,6 @@ int do_init(int argc, char **argv)
|
|||||||
add_timer_func_list(online_data_cleanup, "online_data_cleanup");
|
add_timer_func_list(online_data_cleanup, "online_data_cleanup");
|
||||||
add_timer_interval(gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
|
add_timer_interval(gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
|
||||||
|
|
||||||
if( console )
|
|
||||||
{
|
|
||||||
//##TODO invoke a CONSOLE_START plugin event
|
|
||||||
}
|
|
||||||
|
|
||||||
//Cleaning the tables for NULL entrys @ startup [Sirius]
|
//Cleaning the tables for NULL entrys @ startup [Sirius]
|
||||||
//Chardb clean
|
//Chardb clean
|
||||||
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) )
|
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) )
|
||||||
@ -5215,6 +5225,10 @@ int do_init(int argc, char **argv)
|
|||||||
runflag = CHARSERVER_ST_RUNNING;
|
runflag = CHARSERVER_ST_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( console ){ //start listening
|
||||||
|
add_timer_func_list(parse_console_timer, "parse_console_timer");
|
||||||
|
add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <conio.h>
|
||||||
|
#else
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.h"
|
||||||
#include "showmsg.h"
|
#include "showmsg.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
|
|
||||||
|
//map confs
|
||||||
char* MAP_CONF_NAME;
|
char* MAP_CONF_NAME;
|
||||||
char* INTER_CONF_NAME;
|
char* INTER_CONF_NAME;
|
||||||
char* LOG_CONF_NAME;
|
char* LOG_CONF_NAME;
|
||||||
@ -14,15 +20,21 @@ char* BATTLE_CONF_FILENAME;
|
|||||||
char* ATCOMMAND_CONF_FILENAME;
|
char* ATCOMMAND_CONF_FILENAME;
|
||||||
char* SCRIPT_CONF_NAME;
|
char* SCRIPT_CONF_NAME;
|
||||||
char* GRF_PATH_FILENAME;
|
char* GRF_PATH_FILENAME;
|
||||||
//char
|
//char confs
|
||||||
char* CHAR_CONF_NAME;
|
char* CHAR_CONF_NAME;
|
||||||
char* SQL_CONF_NAME;
|
char* SQL_CONF_NAME;
|
||||||
//login
|
//login confs
|
||||||
char* LOGIN_CONF_NAME;
|
char* LOGIN_CONF_NAME;
|
||||||
//common
|
//common conf (used by multiple serv)
|
||||||
char* LAN_CONF_NAME; //char-login
|
char* LAN_CONF_NAME; //char-login
|
||||||
char* MSG_CONF_NAME_EN; //all
|
char* MSG_CONF_NAME_EN; //all
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function to check if specified option have an argument follow it
|
||||||
|
* return
|
||||||
|
* false : no other args found, and throw a warning
|
||||||
|
* true : something following us
|
||||||
|
*/
|
||||||
bool opt_has_next_value(const char* option, int i, int argc)
|
bool opt_has_next_value(const char* option, int i, int argc)
|
||||||
{
|
{
|
||||||
if (i >= argc - 1) {
|
if (i >= argc - 1) {
|
||||||
@ -33,19 +45,27 @@ bool opt_has_next_value(const char* option, int i, int argc)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*======================================================
|
/*
|
||||||
* Servers Version Screen [MC Cameri]
|
* Display some info about emulator such as
|
||||||
*------------------------------------------------------*/
|
* svn version
|
||||||
|
* website/forum adresse
|
||||||
|
* irc hangout
|
||||||
|
*/
|
||||||
void display_versionscreen(bool do_exit)
|
void display_versionscreen(bool do_exit)
|
||||||
{
|
{
|
||||||
ShowInfo(CL_WHITE"rAthena SVN version: %s" CL_RESET"\n", get_svn_revision());
|
ShowInfo(CL_WHITE"rAthena SVN version: %s" CL_RESET"\n", get_svn_revision());
|
||||||
ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://rathena.org/\n");
|
ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://rathena.org/\n");
|
||||||
ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rathena.net/#rathena\n");
|
ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rizon.net/#rathena\n");
|
||||||
ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
|
ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
|
||||||
if (do_exit)
|
if (do_exit)
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the option specify in command line
|
||||||
|
* and assign the confs used by the different server
|
||||||
|
* exit on failure or return true
|
||||||
|
*/
|
||||||
int cli_get_options(int argc, char ** argv)
|
int cli_get_options(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -135,3 +155,29 @@ int cli_get_options(int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cli_hasevent(){
|
||||||
|
#ifdef WIN32
|
||||||
|
return _kbhit();
|
||||||
|
#else
|
||||||
|
struct pollfd fds;
|
||||||
|
fds.fd = 0; /* this is STDIN */
|
||||||
|
fds.events = POLLIN;
|
||||||
|
return poll(&fds, 1, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_console_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
||||||
|
char buf[MAX_CONSOLE_IN]; //max cmd atm is 63+63+63+3+3
|
||||||
|
|
||||||
|
memset(buf,0,MAX_CONSOLE_IN); //clear out buf
|
||||||
|
|
||||||
|
if(cli_hasevent()){
|
||||||
|
if(fgets(buf, MAX_CONSOLE_IN, stdin)==NULL)
|
||||||
|
return -1;
|
||||||
|
else if(strlen(buf)>MIN_CONSOLE_IN)
|
||||||
|
parse_console(buf);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_CONSOLE_IN 200 //max is map...
|
||||||
|
#define MIN_CONSOLE_IN 4 //min is help
|
||||||
//map
|
//map
|
||||||
extern char* MAP_CONF_NAME;
|
extern char* MAP_CONF_NAME;
|
||||||
extern char* INTER_CONF_NAME;
|
extern char* INTER_CONF_NAME;
|
||||||
@ -31,6 +33,8 @@ extern "C" {
|
|||||||
|
|
||||||
extern void display_helpscreen(bool exit);
|
extern void display_helpscreen(bool exit);
|
||||||
int cli_get_options(int argc, char ** argv);
|
int cli_get_options(int argc, char ** argv);
|
||||||
|
int parse_console_timer(int tid, unsigned int tick, int id, intptr_t data);
|
||||||
|
extern int parse_console(const char* buf); //particular for each serv
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
#include "msg_conf.h"
|
#include "msg_conf.h"
|
||||||
#include "showmsg.h"
|
#include "showmsg.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
/*
|
||||||
// Return the message string of the specified number by [Yor]
|
* Return the message string of the specified number by [Yor]
|
||||||
//-----------------------------------------------------------
|
* (read in table msg_table, with specified lenght table in size)
|
||||||
|
*/
|
||||||
const char* _msg_txt(int msg_number,int size, char ** msg_table)
|
const char* _msg_txt(int msg_number,int size, char ** msg_table)
|
||||||
{
|
{
|
||||||
if (msg_number >= 0 && msg_number < size &&
|
if (msg_number >= 0 && msg_number < size &&
|
||||||
@ -19,9 +19,10 @@ const char* _msg_txt(int msg_number,int size, char ** msg_table)
|
|||||||
return "??";
|
return "??";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
|
||||||
* Read Message Data
|
/*
|
||||||
*------------------------------------------*/
|
* Read txt file and store them into msg_table
|
||||||
|
*/
|
||||||
int _msg_config_read(const char* cfgName,int size, char ** msg_table)
|
int _msg_config_read(const char* cfgName,int size, char ** msg_table)
|
||||||
{
|
{
|
||||||
int msg_number;
|
int msg_number;
|
||||||
@ -62,9 +63,9 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*
|
||||||
* Cleanup Message Data
|
* Destroy msg_table (freeup mem)
|
||||||
*------------------------------------------*/
|
*/
|
||||||
void _do_final_msg(int size, char ** msg_table){
|
void _do_final_msg(int size, char ** msg_table){
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
@ -89,6 +90,10 @@ int msg_langstr2langtype(char * langtype){
|
|||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lookup a langtype into his associate lang string
|
||||||
|
* return ?? if not found
|
||||||
|
*/
|
||||||
const char* msg_langtype2langstr(int langtype){
|
const char* msg_langtype2langstr(int langtype){
|
||||||
switch(langtype){
|
switch(langtype){
|
||||||
case 0: return "English (ENG)";
|
case 0: return "English (ENG)";
|
||||||
|
@ -23,9 +23,13 @@ enum lang_types {
|
|||||||
// 0xFF will enable all, while 0x00 will enable English only.
|
// 0xFF will enable all, while 0x00 will enable English only.
|
||||||
#define LANG_ENABLE 0x00
|
#define LANG_ENABLE 0x00
|
||||||
|
|
||||||
|
//read msg in table
|
||||||
const char* _msg_txt(int msg_number,int size, char ** msg_table);
|
const char* _msg_txt(int msg_number,int size, char ** msg_table);
|
||||||
|
//store msg from txtfile into msg_table
|
||||||
int _msg_config_read(const char* cfgName,int size, char ** msg_table);
|
int _msg_config_read(const char* cfgName,int size, char ** msg_table);
|
||||||
|
//clear msg_table
|
||||||
void _do_final_msg(int size, char ** msg_table);
|
void _do_final_msg(int size, char ** msg_table);
|
||||||
|
//Lookups
|
||||||
int msg_langstr2langtype(char * langtype);
|
int msg_langstr2langtype(char * langtype);
|
||||||
const char* msg_langtype2langstr(int langtype);
|
const char* msg_langtype2langstr(int langtype);
|
||||||
// Verify that the choosen langtype is enabled.
|
// Verify that the choosen langtype is enabled.
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "../common/timer.h"
|
#include "../common/timer.h"
|
||||||
#include "../common/msg_conf.h"
|
#include "../common/msg_conf.h"
|
||||||
#include "../common/cli.h"
|
#include "../common/cli.h"
|
||||||
|
#include "../common/ers.h"
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
#include "ipban.h"
|
#include "ipban.h"
|
||||||
#include "login.h"
|
#include "login.h"
|
||||||
@ -366,49 +367,61 @@ int login_lan_config_read(const char *lancfgName)
|
|||||||
//-----------------------
|
//-----------------------
|
||||||
// Console Command Parser [Wizputer]
|
// Console Command Parser [Wizputer]
|
||||||
//-----------------------
|
//-----------------------
|
||||||
int parse_console(const char* command)
|
int parse_console(const char* buf){
|
||||||
{
|
char type[64];
|
||||||
ShowNotice("Console command: %s\n", command);
|
char command[64];
|
||||||
|
int n=0;
|
||||||
|
|
||||||
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 || strcmpi("end", command) == 0 )
|
if( ( n = sscanf(buf, "%127[^:]:%255[^\n\r]", type, command) ) < 2 ){
|
||||||
|
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
|
||||||
|
}
|
||||||
|
if( n != 2 ){ //end string
|
||||||
|
command[0] = '\0';
|
||||||
|
}
|
||||||
|
ShowNotice("Type of command: '%s' || Command: '%s'\n",type,command);
|
||||||
|
|
||||||
|
if( n == 2){
|
||||||
|
if(strcmpi("server", type) == 0 ){
|
||||||
|
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
|
||||||
runflag = 0;
|
runflag = 0;
|
||||||
|
}
|
||||||
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
|
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
|
||||||
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
|
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
|
||||||
else if( strcmpi("help", command) == 0 )
|
|
||||||
{
|
|
||||||
ShowInfo("To shutdown the server:\n");
|
|
||||||
ShowInfo(" 'shutdown|exit|quit|end'\n");
|
|
||||||
ShowInfo("To know if server is alive:\n");
|
|
||||||
ShowInfo(" 'alive|status'\n");
|
|
||||||
ShowInfo("To create a new account:\n");
|
|
||||||
ShowInfo(" 'create'\n");
|
|
||||||
}
|
}
|
||||||
else
|
if( strcmpi("create",type) == 0 )
|
||||||
{// commands with parameters
|
|
||||||
char cmd[128], params[256];
|
|
||||||
|
|
||||||
if( sscanf(command, "%127s %255[^\r\n]", cmd, params) < 2 )
|
|
||||||
{
|
{
|
||||||
|
char username[NAME_LENGTH], password[NAME_LENGTH], md5password[32+1], sex; //23+1 plaintext 32+1 md5
|
||||||
|
bool md5 = 0;
|
||||||
|
if( sscanf(command, "%23s %23s %c", username, password, &sex) < 3 || strnlen(username, sizeof(username)) < 4 || strnlen(password, sizeof(password)) < 1 ){
|
||||||
|
ShowWarning("Console: Invalid parameters for '%s'. Usage: %s <username> <password> <sex:F/M>\n", type, type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if( login_config.use_md5_passwds ){
|
||||||
if( strcmpi(cmd, "create") == 0 )
|
MD5_String(password,md5password);
|
||||||
{
|
md5 = 1;
|
||||||
char username[NAME_LENGTH], password[NAME_LENGTH], sex;
|
|
||||||
|
|
||||||
if( sscanf(params, "%23s %23s %c", username, password, &sex) < 3 || strnlen(username, sizeof(username)) < 4 || strnlen(password, sizeof(password)) < 1 )
|
|
||||||
{
|
|
||||||
ShowWarning("Console: Invalid parameters for '%s'. Usage: %s <username> <password> <sex:F/M>\n", cmd, cmd);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
if( mmo_auth_new(username,(md5?md5password:password), TOUPPER(sex), "0.0.0.0") != -1 ){
|
||||||
if( mmo_auth_new(username, password, TOUPPER(sex), "0.0.0.0") != -1 )
|
|
||||||
{
|
|
||||||
ShowError("Console: Account creation failed.\n");
|
ShowError("Console: Account creation failed.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ShowStatus("Console: Account '%s' created successfully.\n", username);
|
ShowStatus("Console: Account '%s' created successfully.\n", username);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if( strcmpi("ers_report", type) == 0 ){
|
||||||
|
ers_report();
|
||||||
|
}
|
||||||
|
else if( strcmpi("help", type) == 0 ){
|
||||||
|
ShowInfo("Command available :\n");
|
||||||
|
ShowInfo("\t server:shutdown|alive => stop|chk server\n");
|
||||||
|
ShowInfo("\t ers_report => display the db usage\n");
|
||||||
|
ShowInfo("\t create:<username> <password> <sex:F|M> => create new account\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{// commands with parameters
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1916,10 +1929,6 @@ int do_init(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( login_config.console ) {
|
|
||||||
//##TODO invoke a CONSOLE_START plugin event
|
|
||||||
}
|
|
||||||
|
|
||||||
// server port open & binding
|
// server port open & binding
|
||||||
if( (login_fd = make_listen_bind(login_config.login_ip,login_config.login_port)) == -1 ) {
|
if( (login_fd = make_listen_bind(login_config.login_ip,login_config.login_port)) == -1 ) {
|
||||||
ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",login_config.login_port);
|
ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",login_config.login_port);
|
||||||
@ -1934,6 +1943,11 @@ int do_init(int argc, char** argv)
|
|||||||
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port);
|
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port);
|
||||||
login_log(0, "login server", 100, "login server started");
|
login_log(0, "login server", 100, "login server started");
|
||||||
|
|
||||||
|
if( login_config.console ) {
|
||||||
|
add_timer_func_list(parse_console_timer, "parse_console_timer");
|
||||||
|
add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9076,15 +9076,15 @@ ACMD_FUNC(fontcolor)
|
|||||||
|
|
||||||
ACMD_FUNC(langtype)
|
ACMD_FUNC(langtype)
|
||||||
{
|
{
|
||||||
char langtype[8];
|
char langstr[8];
|
||||||
|
int i=0, test=0; char output[100];
|
||||||
|
|
||||||
|
memset(langstr, '\0', sizeof(langstr));
|
||||||
|
memset(output, '\0', sizeof(output));
|
||||||
|
|
||||||
|
if(sscanf(message, "%3s", langstr) >= 1){
|
||||||
int lang=-1;
|
int lang=-1;
|
||||||
memset(langtype, '\0', sizeof(langtype));
|
lang = msg_langstr2langtype(langstr); //Switch langstr to associated langtype
|
||||||
|
|
||||||
if(sscanf(message, "%3s", langtype) < 1){
|
|
||||||
clif_displaymessage(fd,msg_txt(sd,460)); // Please enter a valid language (usage: @langtype <language>).
|
|
||||||
}
|
|
||||||
|
|
||||||
lang = msg_langstr2langtype(langtype); //Switch langstr to associated langtype
|
|
||||||
if( msg_checklangtype(lang,false) == 1 ){ //Verify it's enabled and set it
|
if( msg_checklangtype(lang,false) == 1 ){ //Verify it's enabled and set it
|
||||||
char output[100];
|
char output[100];
|
||||||
pc_setaccountreg(sd, "#langtype", lang); //For login/char
|
pc_setaccountreg(sd, "#langtype", lang); //For login/char
|
||||||
@ -9092,23 +9092,23 @@ ACMD_FUNC(langtype)
|
|||||||
sprintf(output,msg_txt(sd,461),msg_langtype2langstr(lang)); // Language is now set to %s.
|
sprintf(output,msg_txt(sd,461),msg_langtype2langstr(lang)); // Language is now set to %s.
|
||||||
clif_displaymessage(fd,output);
|
clif_displaymessage(fd,output);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (lang != -1) {
|
} else if (lang != -1) { //defined langage but failed check
|
||||||
clif_displaymessage(fd,msg_txt(sd,462)); // This langage is currently disabled.
|
clif_displaymessage(fd,msg_txt(sd,462)); // This langage is currently disabled.
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
}
|
||||||
int i=0, test=0; char output[100];
|
}
|
||||||
|
|
||||||
|
//wrong or no entry
|
||||||
|
clif_displaymessage(fd,msg_txt(sd,460)); // Please enter a valid language (usage: @langtype <language>).
|
||||||
clif_displaymessage(fd,msg_txt(sd,464)); // Available languages:
|
clif_displaymessage(fd,msg_txt(sd,464)); // Available languages:
|
||||||
while(test!=-1){ //out of range
|
while(test!=-1){ //out of range
|
||||||
test = msg_checklangtype(i,false);
|
test = msg_checklangtype(i,false);
|
||||||
if(test == 1) {
|
if(test == 1)
|
||||||
sprintf(output,"%s\n",msg_langtype2langstr(i));
|
clif_displaymessage(fd,msg_langtype2langstr(i));
|
||||||
clif_displaymessage(fd,output);
|
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ACMD_FUNC(reloadmsgconf)
|
ACMD_FUNC(reloadmsgconf)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +310,9 @@ int merc_hom_levelup(struct homun_data *hd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((m_class&HOM_REG) && hd->homunculus.level >= battle_config.hom_max_level) || ((m_class&HOM_S) && hd->homunculus.level >= battle_config.hom_S_max_level) || !hd->exp_next || hd->homunculus.exp < hd->exp_next)
|
if(((m_class&HOM_REG) && hd->homunculus.level >= battle_config.hom_max_level)
|
||||||
|
|| ((m_class&HOM_S) && hd->homunculus.level >= battle_config.hom_S_max_level)
|
||||||
|
|| !hd->exp_next || hd->homunculus.exp < hd->exp_next)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hom = &hd->homunculus;
|
hom = &hd->homunculus;
|
||||||
|
107
src/map/map.c
107
src/map/map.c
@ -3100,8 +3100,7 @@ static int char_ip_set = 0;
|
|||||||
/*==========================================
|
/*==========================================
|
||||||
* Console Command Parser [Wizputer]
|
* Console Command Parser [Wizputer]
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int parse_console(const char* buf)
|
int parse_console(const char* buf){
|
||||||
{
|
|
||||||
char type[64];
|
char type[64];
|
||||||
char command[64];
|
char command[64];
|
||||||
char map[64];
|
char map[64];
|
||||||
@ -3114,19 +3113,24 @@ int parse_console(const char* buf)
|
|||||||
memset(&sd, 0, sizeof(struct map_session_data));
|
memset(&sd, 0, sizeof(struct map_session_data));
|
||||||
strcpy(sd.status.name, "console");
|
strcpy(sd.status.name, "console");
|
||||||
|
|
||||||
if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%63s %hd %hd[^\n]", type, command, map, &x, &y) ) < 5 )
|
if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%63s %hd %hd[^\n]", type, command, map, &x, &y) ) < 5 ){
|
||||||
{
|
if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ) {
|
||||||
if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 )
|
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
|
||||||
{
|
|
||||||
n = sscanf(buf, "%63[^\n]", type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( n == 5 )
|
if( n != 5 ){ //end string
|
||||||
{
|
map[0] = '\0';
|
||||||
|
if( n < 2 )
|
||||||
|
command[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowNotice("Type of command: '%s' || Command: '%s' || Map: '%s' Coords: %d %d\n", type, command, map, x, y);
|
||||||
|
|
||||||
|
if(strcmpi("admin",type) == 0 ) {
|
||||||
|
if(strcmpi("map",command) == 0){
|
||||||
m = map_mapname2mapid(map);
|
m = map_mapname2mapid(map);
|
||||||
if( m < 0 )
|
if( m < 0 ){
|
||||||
{
|
|
||||||
ShowWarning("Console: Unknown map.\n");
|
ShowWarning("Console: Unknown map.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3137,42 +3141,23 @@ int parse_console(const char* buf)
|
|||||||
if( y > 0 )
|
if( y > 0 )
|
||||||
sd.bl.y = y;
|
sd.bl.y = y;
|
||||||
}
|
}
|
||||||
else
|
else if( !is_atcommand(sd.fd, &sd, command, 0) )
|
||||||
{
|
|
||||||
map[0] = '\0';
|
|
||||||
if( n < 2 )
|
|
||||||
command[0] = '\0';
|
|
||||||
if( n < 1 )
|
|
||||||
type[0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowNotice("Type of command: '%s' || Command: '%s' || Map: '%s' Coords: %d %d\n", type, command, map, x, y);
|
|
||||||
|
|
||||||
if( n == 5 && strcmpi("admin",type) == 0 )
|
|
||||||
{
|
|
||||||
if( !is_atcommand(sd.fd, &sd, command, 0) )
|
|
||||||
ShowInfo("Console: not atcommand\n");
|
ShowInfo("Console: not atcommand\n");
|
||||||
}
|
}
|
||||||
else if( n == 2 && strcmpi("server", type) == 0 )
|
else if( n == 2 && strcmpi("server", type) == 0 ){
|
||||||
{
|
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
|
||||||
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 )
|
|
||||||
{
|
|
||||||
runflag = 0;
|
runflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( strcmpi("ers_report", type) == 0 ){
|
else if( strcmpi("ers_report", type) == 0 ){
|
||||||
ers_report();
|
ers_report();
|
||||||
}
|
}
|
||||||
else if( strcmpi("help", type) == 0 )
|
else if( strcmpi("help", type) == 0 ) {
|
||||||
{
|
ShowInfo("Command available :\n");
|
||||||
ShowInfo("To use GM commands:\n");
|
ShowInfo("\t admin:@acmd => use an atcommand\n");
|
||||||
ShowInfo(" admin:<gm command>:<map of \"gm\"> <x> <y>\n");
|
ShowInfo("\t admin:map:<map><x><y> => change our current map\n");
|
||||||
ShowInfo("You can use any GM command that doesn't require the GM.\n");
|
ShowInfo("\t server:shutdown => stop server\n");
|
||||||
ShowInfo("No using @item or @warp however you can use @charwarp\n");
|
ShowInfo("\t ers_report => display the db usage\n");
|
||||||
ShowInfo("The <map of \"gm\"> <x> <y> is for commands that need coords of the GM\n");
|
|
||||||
ShowInfo("IE: @spawn\n");
|
|
||||||
ShowInfo("To shutdown the server:\n");
|
|
||||||
ShowInfo(" server:shutdown\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3708,23 +3693,25 @@ struct msg_data *map_lang2msgdb(uint8 lang){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void map_do_init_msg(void){
|
void map_do_init_msg(void){
|
||||||
map_msg_db = idb_alloc(DB_OPT_BASE);
|
int test=0, i=0, size;
|
||||||
|
char * listelang[] = {
|
||||||
|
MSG_CONF_NAME_EN, //default
|
||||||
|
MSG_CONF_NAME_RUS,
|
||||||
|
MSG_CONF_NAME_SPN,
|
||||||
|
MSG_CONF_NAME_GRM,
|
||||||
|
MSG_CONF_NAME_CHN,
|
||||||
|
MSG_CONF_NAME_MAL,
|
||||||
|
MSG_CONF_NAME_IDN,
|
||||||
|
MSG_CONF_NAME_FRN
|
||||||
|
};
|
||||||
|
|
||||||
msg_config_read(MSG_CONF_NAME_EN,0); // English (default)
|
map_msg_db = idb_alloc(DB_OPT_BASE);
|
||||||
if( LANG_ENABLE&LANG_RUS )
|
size = ARRAYLENGTH(listelang); //avoid recalc
|
||||||
msg_config_read(MSG_CONF_NAME_RUS,1); // Russian
|
while(test!=-1 && size>i){ //for all enable lang +(English default)
|
||||||
if( LANG_ENABLE&LANG_SPN )
|
test = msg_checklangtype(i,false);
|
||||||
msg_config_read(MSG_CONF_NAME_SPN,2); // Spanish
|
if(test == 1) msg_config_read(listelang[i],i); //if enable read it and assign i to langtype
|
||||||
if( LANG_ENABLE&LANG_GRM )
|
i++;
|
||||||
msg_config_read(MSG_CONF_NAME_GRM,3); // German
|
}
|
||||||
if( LANG_ENABLE&LANG_CHN )
|
|
||||||
msg_config_read(MSG_CONF_NAME_CHN,4); // Chinese
|
|
||||||
if( LANG_ENABLE&LANG_MAL )
|
|
||||||
msg_config_read(MSG_CONF_NAME_MAL,5); // Malaysian
|
|
||||||
if( LANG_ENABLE&LANG_IDN )
|
|
||||||
msg_config_read(MSG_CONF_NAME_IDN,6); // Indonesian
|
|
||||||
if( LANG_ENABLE&LANG_FRN )
|
|
||||||
msg_config_read(MSG_CONF_NAME_FRN,7); // French
|
|
||||||
}
|
}
|
||||||
void map_do_final_msg(void){
|
void map_do_final_msg(void){
|
||||||
DBIterator *iter = db_iterator(map_msg_db);
|
DBIterator *iter = db_iterator(map_msg_db);
|
||||||
@ -3906,11 +3893,6 @@ int do_init(int argc, char *argv[])
|
|||||||
|
|
||||||
npc_event_do_oninit(); // Init npcs (OnInit)
|
npc_event_do_oninit(); // Init npcs (OnInit)
|
||||||
|
|
||||||
if( console )
|
|
||||||
{
|
|
||||||
//##TODO invoke a CONSOLE_START plugin event
|
|
||||||
}
|
|
||||||
|
|
||||||
if (battle_config.pk_mode)
|
if (battle_config.pk_mode)
|
||||||
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
|
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
|
||||||
|
|
||||||
@ -3926,6 +3908,11 @@ int do_init(int argc, char *argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( console ){ //start listening
|
||||||
|
add_timer_func_list(parse_console_timer, "parse_console_timer");
|
||||||
|
add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user