* Added the ability to select GM loading via Login (default) or Char [Codemaster]
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5404 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
2adcba7bb2
commit
018dec7fb4
@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
|
|||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE
|
||||||
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
||||||
|
|
||||||
|
2006/03/01
|
||||||
|
* Added the ability to select GM loading via Login (default) or Char [Codemaster]
|
||||||
2006/02/28
|
2006/02/28
|
||||||
* Rewrote LAN support code. Changed configuration file name
|
* Rewrote LAN support code. Changed configuration file name
|
||||||
lan_support.conf to subnet_athena.conf, changed it syntax. [LuzZza]
|
lan_support.conf to subnet_athena.conf, changed it syntax. [LuzZza]
|
||||||
|
@ -22,3 +22,11 @@ Lance
|
|||||||
- General coding and scripting. Little Code Monkey :D
|
- General coding and scripting. Little Code Monkey :D
|
||||||
- Was invited by Manipulator and Nexon. Promoted by Deviant.
|
- Was invited by Manipulator and Nexon. Promoted by Deviant.
|
||||||
- Got really into eA at 14, began scripting in 15. Started coding this year.
|
- Got really into eA at 14, began scripting in 15. Started coding this year.
|
||||||
|
|
||||||
|
Codemaster
|
||||||
|
- Andrew
|
||||||
|
- 18
|
||||||
|
- Ohio (College in New York)
|
||||||
|
- Go Crazy :D, help with random questions, coding, scripting, documentation
|
||||||
|
- Merged in with omniAthena ^_^
|
||||||
|
- Been programming and scripting since age 9 :)
|
||||||
|
@ -46,6 +46,10 @@ kick_on_disconnect: 1
|
|||||||
// WARNING: Don't use it in multi char/map or customized table names config.
|
// WARNING: Don't use it in multi char/map or customized table names config.
|
||||||
charsave_method: 0
|
charsave_method: 0
|
||||||
|
|
||||||
|
// GM Reading Method
|
||||||
|
// 1 to have Char read GMs, 0 to have Login-controlled GMs
|
||||||
|
gm_read_method: 0
|
||||||
|
|
||||||
// The level at which a player with access is considered a GM.
|
// The level at which a player with access is considered a GM.
|
||||||
// An account with an access level lower than this is not effected
|
// An account with an access level lower than this is not effected
|
||||||
// by gm_can_drop_lv (battle_athena.conf).
|
// by gm_can_drop_lv (battle_athena.conf).
|
||||||
|
@ -61,6 +61,7 @@ char guild_skill_db[256] = "guild_skill";
|
|||||||
char guild_storage_db[256] = "guild_storage";
|
char guild_storage_db[256] = "guild_storage";
|
||||||
char party_db[256] = "party";
|
char party_db[256] = "party";
|
||||||
char pet_db[256] = "pet";
|
char pet_db[256] = "pet";
|
||||||
|
char gm_db[256] = "gm_accounts";
|
||||||
char friend_db[256] = "friends";
|
char friend_db[256] = "friends";
|
||||||
int db_use_sqldbs;
|
int db_use_sqldbs;
|
||||||
|
|
||||||
@ -153,6 +154,7 @@ unsigned int save_flag = 0;
|
|||||||
// start point (you can reset point on conf file)
|
// start point (you can reset point on conf file)
|
||||||
struct point start_point = { 0, 53, 111};
|
struct point start_point = { 0, 53, 111};
|
||||||
|
|
||||||
|
bool char_gm_read = false;
|
||||||
struct gm_account *gm_account = NULL;
|
struct gm_account *gm_account = NULL;
|
||||||
int GM_num = 0;
|
int GM_num = 0;
|
||||||
|
|
||||||
@ -330,6 +332,32 @@ int isGM(int account_id) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void read_gm_account(void) {
|
||||||
|
if(char_gm_read)
|
||||||
|
{
|
||||||
|
if (gm_account != NULL)
|
||||||
|
aFree(gm_account);
|
||||||
|
GM_num = 0;
|
||||||
|
|
||||||
|
sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,gm_db,login_db_level,lowest_gm_level);
|
||||||
|
if (mysql_query(&lmysql_handle, tmp_sql)) {
|
||||||
|
ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
|
||||||
|
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
|
||||||
|
}
|
||||||
|
lsql_res = mysql_store_result(&lmysql_handle);
|
||||||
|
if (lsql_res) {
|
||||||
|
gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
|
||||||
|
while ((lsql_row = mysql_fetch_row(lsql_res))) {
|
||||||
|
gm_account[GM_num].account_id = atoi(lsql_row[0]);
|
||||||
|
gm_account[GM_num].level = atoi(lsql_row[1]);
|
||||||
|
GM_num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_free_result(lsql_res);
|
||||||
|
mapif_send_gmaccounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int compare_item(struct item *a, struct item *b) {
|
int compare_item(struct item *a, struct item *b) {
|
||||||
|
|
||||||
@ -2026,6 +2054,8 @@ int parse_tologin(int fd) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2732:
|
case 0x2732:
|
||||||
|
if(!char_gm_read)
|
||||||
|
{
|
||||||
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
|
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
|
||||||
return 0;
|
return 0;
|
||||||
{
|
{
|
||||||
@ -2047,6 +2077,7 @@ int parse_tologin(int fd) {
|
|||||||
mapif_sendall(buf, RFIFOW(fd,2));
|
mapif_sendall(buf, RFIFOW(fd,2));
|
||||||
}
|
}
|
||||||
RFIFOSKIP(fd,RFIFOW(fd,2));
|
RFIFOSKIP(fd,RFIFOW(fd,2));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Receive GM accounts [Freya login server packet by Yor]
|
// Receive GM accounts [Freya login server packet by Yor]
|
||||||
@ -2223,11 +2254,14 @@ int parse_frommap(int fd) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2af7:
|
case 0x2af7:
|
||||||
|
if(char_gm_read)
|
||||||
|
{
|
||||||
RFIFOSKIP(fd,2);
|
RFIFOSKIP(fd,2);
|
||||||
if (login_fd > 0) { // don't send request if no login-server
|
if (login_fd > 0) { // don't send request if no login-server
|
||||||
WFIFOW(login_fd,0) = 0x2709;
|
WFIFOW(login_fd,0) = 0x2709;
|
||||||
WFIFOSET(login_fd, 2);
|
WFIFOSET(login_fd, 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// mapserver -> map names recv.
|
// mapserver -> map names recv.
|
||||||
@ -3798,7 +3832,14 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
|
|||||||
if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
|
if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(strcmpi(w1,"char_db")==0){
|
if(strcmpi(w1, "gm_read_method") == 0) {
|
||||||
|
if(atoi(w2) != 0)
|
||||||
|
char_gm_read = true;
|
||||||
|
else
|
||||||
|
char_gm_read = false;
|
||||||
|
} else if(strcmpi(w1, "gm_db") == 0) {
|
||||||
|
strcpy(gm_db, w2);
|
||||||
|
} else if(strcmpi(w1,"char_db")==0){
|
||||||
strcpy(char_db,w2);
|
strcpy(char_db,w2);
|
||||||
}else if(strcmpi(w1,"scdata_db")==0){
|
}else if(strcmpi(w1,"scdata_db")==0){
|
||||||
strcpy(scdata_db,w2);
|
strcpy(scdata_db,w2);
|
||||||
@ -4115,6 +4156,10 @@ int do_init(int argc, char **argv){
|
|||||||
add_timer_interval(gettick() + 10, send_users_tologin, 0, 0, 5 * 1000);
|
add_timer_interval(gettick() + 10, send_users_tologin, 0, 0, 5 * 1000);
|
||||||
add_timer_interval(gettick() + 3600*1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour.
|
add_timer_interval(gettick() + 3600*1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour.
|
||||||
|
|
||||||
|
if(char_gm_read)
|
||||||
|
read_gm_account();
|
||||||
|
|
||||||
|
|
||||||
if ( console ) {
|
if ( console ) {
|
||||||
set_defaultconsoleparse(parse_console);
|
set_defaultconsoleparse(parse_console);
|
||||||
start_console();
|
start_console();
|
||||||
|
@ -120,6 +120,7 @@ int use_md5_passwds = 0;
|
|||||||
char login_db[256] = "login";
|
char login_db[256] = "login";
|
||||||
int log_login=1; //Whether to log the logins or not. [Skotlex]
|
int log_login=1; //Whether to log the logins or not. [Skotlex]
|
||||||
char loginlog_db[256] = "loginlog";
|
char loginlog_db[256] = "loginlog";
|
||||||
|
bool login_gm_read = true;
|
||||||
|
|
||||||
// added to help out custom login tables, without having to recompile
|
// added to help out custom login tables, without having to recompile
|
||||||
// source so options are kept in the login_athena.conf or the inter_athena.conf
|
// source so options are kept in the login_athena.conf or the inter_athena.conf
|
||||||
@ -128,6 +129,8 @@ char login_db_userid[256] = "userid";
|
|||||||
char login_db_user_pass[256] = "user_pass";
|
char login_db_user_pass[256] = "user_pass";
|
||||||
char login_db_level[256] = "level";
|
char login_db_level[256] = "level";
|
||||||
|
|
||||||
|
char gm_db[256] = "gm_accounts";
|
||||||
|
|
||||||
char reg_db[256] = "global_reg_value";
|
char reg_db[256] = "global_reg_value";
|
||||||
|
|
||||||
struct gm_account *gm_account_db;
|
struct gm_account *gm_account_db;
|
||||||
@ -210,6 +213,8 @@ void read_gm_account(void) {
|
|||||||
MYSQL_RES* sql_res ;
|
MYSQL_RES* sql_res ;
|
||||||
MYSQL_ROW sql_row;
|
MYSQL_ROW sql_row;
|
||||||
|
|
||||||
|
if(login_gm_read)
|
||||||
|
{
|
||||||
sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`> '0'",login_db_account_id,login_db_level,login_db,login_db_level);
|
sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`> '0'",login_db_account_id,login_db_level,login_db,login_db_level);
|
||||||
if (mysql_query(&mysql_handle, tmp_sql)) {
|
if (mysql_query(&mysql_handle, tmp_sql)) {
|
||||||
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
|
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
|
||||||
@ -233,6 +238,7 @@ void read_gm_account(void) {
|
|||||||
GM_num++;
|
GM_num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mysql_free_result(sql_res);
|
mysql_free_result(sql_res);
|
||||||
}
|
}
|
||||||
@ -247,6 +253,8 @@ void send_GM_accounts(int fd) {
|
|||||||
unsigned char buf[32767];
|
unsigned char buf[32767];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
if(login_gm_read)
|
||||||
|
{
|
||||||
len = 4;
|
len = 4;
|
||||||
WBUFW(buf,0) = 0x2732;
|
WBUFW(buf,0) = 0x2732;
|
||||||
for(i = 0; i < GM_num; i++)
|
for(i = 0; i < GM_num; i++)
|
||||||
@ -264,6 +272,7 @@ void send_GM_accounts(int fd) {
|
|||||||
memcpy(WFIFOP(fd,0), buf, len);
|
memcpy(WFIFOP(fd,0), buf, len);
|
||||||
WFIFOSET(fd,len);
|
WFIFOSET(fd,len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1796,8 +1805,11 @@ int parse_login(int fd) {
|
|||||||
WFIFOSET(fd,3);
|
WFIFOSET(fd,3);
|
||||||
session[fd]->func_parse=parse_fromchar;
|
session[fd]->func_parse=parse_fromchar;
|
||||||
realloc_fifo(fd,FIFOSIZE_SERVERLINK,FIFOSIZE_SERVERLINK);
|
realloc_fifo(fd,FIFOSIZE_SERVERLINK,FIFOSIZE_SERVERLINK);
|
||||||
|
if(login_gm_read)
|
||||||
|
{
|
||||||
// send GM account to char-server
|
// send GM account to char-server
|
||||||
send_GM_accounts(fd);
|
send_GM_accounts(fd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
WFIFOW(fd, 0) =0x2711;
|
WFIFOW(fd, 0) =0x2711;
|
||||||
WFIFOB(fd, 2)=3;
|
WFIFOB(fd, 2)=3;
|
||||||
@ -2122,7 +2134,14 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
|
|||||||
i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
|
i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
|
||||||
if(i!=2)
|
if(i!=2)
|
||||||
continue;
|
continue;
|
||||||
if (strcmpi(w1, "login_db") == 0) {
|
if(strcmpi(w1, "gm_read_method") == 0) {
|
||||||
|
if(atoi(w2) == 0)
|
||||||
|
login_gm_read = true;
|
||||||
|
else
|
||||||
|
login_gm_read = false;
|
||||||
|
} else if(strcmpi(w1, "gm_db") == 0) {
|
||||||
|
strcpy(gm_db, w2);
|
||||||
|
} else if (strcmpi(w1, "login_db") == 0) {
|
||||||
strcpy(login_db, w2);
|
strcpy(login_db, w2);
|
||||||
}
|
}
|
||||||
//add for DB connection
|
//add for DB connection
|
||||||
@ -2237,8 +2256,11 @@ int do_init(int argc,char **argv){
|
|||||||
mmo_auth_sqldb_init();
|
mmo_auth_sqldb_init();
|
||||||
ShowInfo("finished mmo_auth_sqldb_init()\n");
|
ShowInfo("finished mmo_auth_sqldb_init()\n");
|
||||||
|
|
||||||
|
if(login_gm_read)
|
||||||
|
{
|
||||||
//Read account information.
|
//Read account information.
|
||||||
read_gm_account();
|
read_gm_account();
|
||||||
|
}
|
||||||
|
|
||||||
//set default parser as parse_login function
|
//set default parser as parse_login function
|
||||||
set_defaultparse(parse_login);
|
set_defaultparse(parse_login);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user