From e4b9fddf841e615bb86e5f9ce10c29b2d171efc3 Mon Sep 17 00:00:00 2001
From: skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>
Date: Fri, 13 Oct 2006 18:50:55 +0000
Subject: - Base attack for non players is now calculated as str + [str/10]^2
 (it does not has +dex/5+luk/5 which players do have) - Fixed the char-sql
 server trying to read the gms off a "gm_db" config setting stead of
 "login_db"

git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8981 54d463be-8e91-2dee-dedb-b68131a5f0ec
---
 src/char_sql/char.c | 27 ++++++++++++++-------------
 src/map/status.c    |  8 +++++++-
 2 files changed, 21 insertions(+), 14 deletions(-)

(limited to 'src')

diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index b0c90be7a..83f3c93df 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -56,7 +56,6 @@ char guild_skill_db[256] = "guild_skill";
 char guild_storage_db[256] = "guild_storage";
 char party_db[256] = "party";
 char pet_db[256] = "pet";
-char gm_db[256] = "gm_accounts";
 char friend_db[256] = "friends";
 #ifdef TXT_SQL_CONVERT
 int save_log = 0; //Have the logs be off by default when converting
@@ -65,6 +64,7 @@ int save_log = 1;
 int db_use_sqldbs;
 int connection_ping_interval = 0;
 
+char login_db[256] = "login";
 char login_db_account_id[32] = "account_id";
 char login_db_level[32] = "level";
 
@@ -377,7 +377,7 @@ void read_gm_account(void) {
 		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);
+	sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_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);
@@ -3932,8 +3932,17 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 				char_gm_read = true;
 			else
 				char_gm_read = false;
-		} else if(strcmpi(w1, "gm_db") == 0) {
-			strcpy(gm_db, w2);
+		//custom columns for login database
+		}else if(strcmpi(w1,"login_db")==0){
+			strcpy(login_db, w2);
+		}else if(strcmpi(w1,"login_db_level")==0){
+			strcpy(login_db_level,w2);
+		}else if(strcmpi(w1,"login_db_account_id")==0){
+			strcpy(login_db_account_id,w2);
+		}else if(strcmpi(w1,"lowest_gm_level")==0){
+			lowest_gm_level = atoi(w2);
+			ShowStatus("set lowest_gm_level : %s\n",w2);
+		//support the import command, just like any other config
 #endif
 		}else if(strcmpi(w1,"scdata_db")==0){
 			strcpy(scdata_db,w2);
@@ -3988,15 +3997,7 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
 			strcpy(item_db2_db,w2);
 		} else if(strcmpi(w1,"connection_ping_interval")==0) {
 			connection_ping_interval = config_switch(w2);
-		//custom columns for login database
-		}else if(strcmpi(w1,"login_db_level")==0){
-			strcpy(login_db_level,w2);
-		}else if(strcmpi(w1,"login_db_account_id")==0){
-			strcpy(login_db_account_id,w2);
-		}else if(strcmpi(w1,"lowest_gm_level")==0){
-			lowest_gm_level = atoi(w2);
-			ShowStatus("set lowest_gm_level : %s\n",w2);
-		//support the import command, just like any other config
+
 #endif
 		}else if(strcmpi(w1,"import")==0){
 			sql_config_read(w2);
diff --git a/src/map/status.c b/src/map/status.c
index 75decab54..c97021637 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1188,8 +1188,14 @@ static int status_base_atk(struct block_list *bl, struct status_data *status)
 		str = status->str;
 		dex = status->dex;
 	}
+	//Normally only players have base-atk, but homunc have a different batk
+	// equation, hinting that perhaps non-players should use this for batk.
+	// [Skotlex]
 	dstr = str/10;
-	return str + dstr*dstr + dex/5 + status->luk/5;
+	str += dstr*dstr;
+	if (bl->type == BL_PC)
+		str+= dex/5 + status->luk/5;
+	return str;
 }
 
 #define status_base_matk_max(status) (status->int_+(status->int_/5)*(status->int_/5))
-- 
cgit v1.2.3-70-g09d2