Jump to content
  • 0

Harmony is not compatible with version 11712 rAthena


sony

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  01/03/13
  • Last Seen:  

I'm trying to install the newest version harmony of rAthena and can not compile.

follows the diff harmony

Index: src/map/script.c
===================================================================
--- src/map/script.c	(revision 17484)
+++ src/map/script.c	(working copy)
@@ -17963,6 +17963,8 @@
 BUILDIN_FUNC(deletepset);
 #endif
 
+#include "harmony_scriptfunc.inc"
+
 /// script command definitions
 /// for an explanation on args, see add_buildin_func
 struct script_function buildin_func[] = {
@@ -17994,6 +17996,7 @@
 	BUILDIN_DEF(setarray,"rv*"),
 	BUILDIN_DEF(cleararray,"rvi"),
 	BUILDIN_DEF(copyarray,"rri"),
+#include "harmony_scriptdef.h"
 	BUILDIN_DEF(getarraysize,"r"),
 	BUILDIN_DEF(deletearray,"r?"),
 	BUILDIN_DEF(getelementofarray,"ri"),
Index: src/map/chrif.c
===================================================================
--- src/map/chrif.c	(revision 17484)
+++ src/map/chrif.c	(working copy)
@@ -4,6 +4,7 @@
 #include "../common/cbasetypes.h"
 #include "../common/malloc.h"
 #include "../common/socket.h"
+#include "../common/harmony.h"
 #include "../common/timer.h"
 #include "../common/nullpo.h"
 #include "../common/showmsg.h"
@@ -1296,6 +1297,18 @@
 	return 0;
 }
 
+int chrif_harmony_request(uint8 *dat, size_t dat_size) {
+	chrif_check(-1);
+
+	WFIFOHEAD(char_fd,4+dat_size);
+	WFIFOW(char_fd,0) = 0x40a1;
+	WFIFOW(char_fd,2) = 4+dat_size;
+	memcpy(WFIFOP(char_fd,4), dat, dat_size);
+	WFIFOSET(char_fd,4+dat_size);
+
+	return 0;
+}
+
 /*=========================================
  * Tell char-server to reset all chars offline [Wizputer]
  *-----------------------------------------*/
@@ -1412,6 +1425,13 @@
 
 	while ( RFIFOREST(fd) >= 2 ) {
 		cmd = RFIFOW(fd,0);
+		if (cmd == 0x40a4) {
+			if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd, 2))
+				return 0;
+			harm_funcs->zone_login_pak(RFIFOP(fd, 4), RFIFOW(fd, 2)-4);
+			RFIFOSKIP(fd, RFIFOW(fd, 2));
+			continue;
+		}
 		if (cmd < 0x2af8 || cmd >= 0x2af8 + ARRAYLENGTH(packet_len_table) || packet_len_table[cmd-0x2af8] == 0) {
 			int r = intif_parse(fd); // Passed on to the intif
 
Index: src/map/chrif.h
===================================================================
--- src/map/chrif.h	(revision 17484)
+++ src/map/chrif.h	(working copy)
@@ -52,6 +52,7 @@
 int chrif_char_offline(struct map_session_data *sd);
 int chrif_char_offline_nsd(int account_id, int char_id);
 int chrif_char_reset_offline(void);
+int chrif_harmony_request(uint8 *dat, size_t dat_size);
 int send_users_tochar(void);
 int chrif_char_online(struct map_session_data *sd);
 int chrif_changesex(struct map_session_data *sd);
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c	(revision 17484)
+++ src/map/atcommand.c	(working copy)
@@ -6,6 +6,7 @@
 #include "../common/timer.h"
 #include "../common/nullpo.h"
 #include "../common/core.h"
+#include "../common/harmony.h"
 #include "../common/showmsg.h"
 #include "../common/malloc.h"
 #include "../common/random.h"
@@ -2201,6 +2202,8 @@
 	return 0;
 }
 
+#include "harmony_atcommand.inc"
+
 /*==========================================
  *
  *------------------------------------------*/
@@ -9091,6 +9094,7 @@
 		ACMD_DEF2R("blvl", baselevelup, 1),
 		ACMD_DEF2("jlvl", joblevelup),
 		ACMD_DEF(help),
+#include "harmony_atcommanddef_ra.inc"
 		ACMD_DEF(pvpoff),
 		ACMD_DEF(pvpon),
 		ACMD_DEF(gvgoff),
Index: src/map/pc_groups.c
===================================================================
--- src/map/pc_groups.c	(revision 17484)
+++ src/map/pc_groups.c	(working copy)
@@ -302,6 +302,27 @@
 }
 
 /**
+ * Iterates groups with a given callback functipn
+ * @public
+ */
+void pc_group_iterate(bool(*callback)(int group_id, int level, const char* name))
+{
+	GroupSettings *group_settings = NULL;
+	DBIterator *iter = NULL;
+	
+	iter = db_iterator(pc_group_db);
+	for (group_settings = (GroupSettings*)dbi_first(iter);
+	     dbi_exists(iter);
+	     group_settings = (GroupSettings*)dbi_next(iter))
+	{
+		if (!callback(group_settings->id, group_settings->level, group_settings->name)) {
+			break;
+		}
+	}
+	iter->destroy(iter);
+}
+
+/**
  * In group configuration file, setting for each command is either
  * <commandname> : <bool> (only atcommand), or
  * <commandname> : [ <bool>, <bool> ] ([ atcommand, charcommand ])
Index: src/map/pc_groups.h
===================================================================
--- src/map/pc_groups.h	(revision 17484)
+++ src/map/pc_groups.h	(working copy)
@@ -14,6 +14,7 @@
 bool pc_group_should_log_commands(int group_id);
 const char* pc_group_id2name(int group_id);
 int pc_group_id2level(int group_id);
+void pc_group_iterate(bool(*callback)(int group_id, int level, const char* name));
 void pc_group_pc_load(struct map_session_data *);
 
 void do_init_pc_groups(void);
Index: src/map/clif.c
===================================================================
--- src/map/clif.c	(revision 17484)
+++ src/map/clif.c	(working copy)
@@ -7,6 +7,7 @@
 #include "../common/grfio.h"
 #include "../common/malloc.h"
 #include "../common/nullpo.h"
+#include "../common/harmony.h"
 #include "../common/random.h"
 #include "../common/showmsg.h"
 #include "../common/strlib.h"
@@ -34,6 +35,7 @@
 #include "unit.h"
 #include "guild.h"
 #include "vending.h"
+#include "harmony.h"
 #include "pet.h"
 #include "homunculus.h"
 #include "instance.h"
@@ -16798,9 +16800,12 @@
 		if( !sd && packet_db[packet_ver][cmd].func != clif_parse_WantToConnection )
 			; //Only valid packet when there is no session
 		else
-		if( sd && sd->bl.prev == NULL && packet_db[packet_ver][cmd].func != clif_parse_LoadEndAck )
+		if( sd && sd->bl.prev == NULL && packet_db[packet_ver][cmd].func != clif_parse_LoadEndAck && !(cmd >= 0x6A0 && cmd <= 0x6E0) )
 			; //Only valid packet when player is not on a map
 		else
+		if (!harm_funcs->zone_process(fd, cmd, RFIFOP(fd, 0), packet_len))
+			; // Vaporized
+		else
 			packet_db[packet_ver][cmd].func(fd, sd);
 	}
 #ifdef DUMP_UNKNOWN_PACKET
@@ -17294,6 +17299,7 @@
 
 	clif_config.packet_db_ver = MAX_PACKET_VER;
 	packet_ver = MAX_PACKET_VER;	// read into packet_db's version by default
+#include "harmony_packets.inc"
 	while( fgets(line, sizeof(line), fp) )
 	{
 		ln++;
Index: src/map/map.c
===================================================================
--- src/map/map.c	(revision 17484)
+++ src/map/map.c	(working copy)
@@ -33,6 +33,7 @@
 #include "trade.h"
 #include "party.h"
 #include "unit.h"
+#include "harmony.h"
 #include "battle.h"
 #include "battleground.h"
 #include "quest.h"
@@ -40,6 +41,7 @@
 #include "mapreg.h"
 #include "guild.h"
 #include "pet.h"
+#include "harmony.h"
 #include "homunculus.h"
 #include "instance.h"
 #include "mercenary.h"
@@ -1639,6 +1641,7 @@
 	pc_itemcd_do(sd,false);
 
 	npc_script_event(sd, NPCE_LOGOUT);
+	harmony_logout(sd);
 
 	//Unit_free handles clearing the player related data,
 	//map_quit handles extra specific data which is related to quitting normally
@@ -3736,6 +3739,7 @@
 	do_final_storage();
 	do_final_guild();
 	do_final_party();
+	harmony_final();
 	do_final_pc();
 	do_final_pet();
 	do_final_mob();
@@ -4044,6 +4048,7 @@
 	do_init_skill();
 	do_init_mob();
 	do_init_pc();
+	harmony_init();
 	do_init_status();
 	do_init_party();
 	do_init_guild();
Index: src/char/char.c
===================================================================
--- src/char/char.c	(revision 17484)
+++ src/char/char.c	(working copy)
@@ -2364,6 +2364,17 @@
 			session[fd]->flag.ping = 0;
 		break;
 
+		// Harmony
+		case 0x40a3:
+			if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
+				return 0;
+			{
+				RFIFOW(fd, 0) = 0x40a4;
+				mapif_sendall(RFIFOP(fd, 0), RFIFOW(fd,2));
+			}
+			RFIFOSKIP(fd, RFIFOW(fd,2));
+		break;
+
 		// changesex reply
 		case 0x2723:
 			if (RFIFOREST(fd) < 7)
@@ -3402,6 +3413,24 @@
 			WFIFOW(fd,0) = 0x2b24;
 			WFIFOSET(fd,2);
 			RFIFOSKIP(fd,2);
+		break;
+		
+		case 0x40a1: // Harmony
+		{
+			uint16 len;
+
+			if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < (len = RFIFOW(fd,2)))
+				return 0;
+
+			if (login_fd > 0) {
+				WFIFOHEAD(login_fd,len);
+				WFIFOW(login_fd, 0) = 0x40a2;
+				memcpy(WFIFOP(login_fd, 2), RFIFOP(fd, 2), len-2);
+				WFIFOSET(login_fd, len);
+			}
+
+			RFIFOSKIP(fd, len);
+		}
 		break;
 
 		case 0x2b26: // auth request from map-server
Index: src/common/socket.c
===================================================================
--- src/common/socket.c	(revision 17484)
+++ src/common/socket.c	(working copy)
@@ -4,6 +4,7 @@
 #include "../common/cbasetypes.h"
 #include "../common/mmo.h"
 #include "../common/timer.h"
+#include "../common/harmony.h"
 #include "../common/malloc.h"
 #include "../common/showmsg.h"
 #include "../common/strlib.h"
@@ -364,6 +365,9 @@
 		return 0;
 	}
 
+	if (!session[fd]->flag.server)
+		len = harm_funcs->net_recv(fd, session[fd]->rdata + session[fd]->rdata_size, len, session[fd]->rdata, session[fd]->rdata_size + len);
+
 	session[fd]->rdata_size += len;
 	session[fd]->rdata_tick = last_tick;
 #ifdef SHOW_SERVER_STATS
@@ -482,6 +486,11 @@
 	create_session(fd, recv_to_fifo, send_from_fifo, default_func_parse);
 	session[fd]->client_addr = ntohl(client_address.sin_addr.s_addr);
 
+	if (!harm_funcs->session_new(fd, session[fd]->client_addr)) {
+		do_close(fd);
+		return -1;
+	}
+
 	return fd;
 }
 
@@ -615,6 +624,8 @@
 #endif
 		aFree(session[fd]->rdata);
 		aFree(session[fd]->wdata);
+		if (session[fd]->harm_sd)
+			harm_funcs->session_del(fd);
 		aFree(session[fd]->session_data);
 		aFree(session[fd]);
 		session[fd] = NULL;
@@ -736,6 +747,9 @@
 		}
 
 	}
+	if (!session[fd]->flag.server)
+		harm_funcs->net_send(fd, s->wdata+s->wdata_size, len);
+
 	s->wdata_size += len;
 #ifdef SHOW_SERVER_STATS
 	socket_data_qo += len;
Index: src/common/socket.h
===================================================================
--- src/common/socket.h	(revision 17484)
+++ src/common/socket.h	(working copy)
@@ -81,6 +81,8 @@
 
 	uint32 client_addr; // remote client address
 
+	void *harm_sd;
+
 	uint8 *rdata, *wdata;
 	size_t max_rdata, max_wdata;
 	size_t rdata_size, wdata_size;
Index: src/common/core.c
===================================================================
--- src/common/core.c	(revision 17484)
+++ src/common/core.c	(working copy)
@@ -11,6 +11,7 @@
 #include "timer.h"
 #include "thread.h"
 #include "mempool.h"
+#include "../common/harmony.h"
 #include "sql.h"
 #include "cbasetypes.h"
 #include "msg_conf.h"
@@ -359,6 +360,8 @@
 	timer_init();
 	socket_init();
 
+	harmony_core_init();
+
 	do_init(argc,argv);
 
 	{// Main runtime cycle
@@ -368,6 +371,8 @@
 			do_sockets(next);
 		}
 	}
+	
+	harmony_core_final();
 
 	do_final();
 
Index: src/common/mmo.h
===================================================================
--- src/common/mmo.h	(revision 17484)
+++ src/common/mmo.h	(working copy)
@@ -253,6 +253,11 @@
 	struct item items[MAX_STORAGE];
 };
 
+#ifdef HARMSW
+	#undef HARMSW
+#endif
+#define HARMSW HARMSW_RATHENA_GROUP
+
 struct guild_storage {
 	int dirty;
 	int guild_id;
Index: src/login/account_sql.c
===================================================================
--- src/login/account_sql.c	(revision 17484)
+++ src/login/account_sql.c	(working copy)
@@ -4,6 +4,7 @@
 #include "../common/malloc.h"
 #include "../common/mmo.h"
 #include "../common/showmsg.h"
+#include "../common/harmony.h"
 #include "../common/sql.h"
 #include "../common/strlib.h"
 #include "../common/timer.h"
@@ -68,6 +69,9 @@
 static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id);
 static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new);
 
+// Harmony
+static bool account_db_sql_is_mac_banned(AccountDB* db, const char *mac);
+
 /// public constructor
 AccountDB* account_db_sql(void)
 {
@@ -84,6 +88,7 @@
 	db->vtable.load_num     = &account_db_sql_load_num;
 	db->vtable.load_str     = &account_db_sql_load_str;
 	db->vtable.iterator     = &account_db_sql_iterator;
+	db->vtable.is_mac_banned= &account_db_sql_is_mac_banned;
 
 	// initialize to default values
 	db->accounts = NULL;
@@ -401,6 +406,26 @@
 	return result;
 }
 
+static bool account_db_sql_is_mac_banned(AccountDB* self, const char *mac) {
+	AccountDB_SQL* db = (AccountDB_SQL*)self;
+	Sql *db_handle = db->accounts;
+	SqlStmt* stmt = SqlStmt_Malloc(db_handle);
+
+	bool result = false;
+
+	if (SQL_SUCCESS != SqlStmt_Prepare(stmt, "SELECT 1 FROM mac_bans WHERE mac = ?") ||
+		SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, (void*)mac, strlen(mac)) ||
+		SQL_SUCCESS != SqlStmt_Execute(stmt)) {
+			Sql_ShowDebug(db_handle);
+	} else {
+		result = (SqlStmt_NumRows(stmt) > 0);
+		SqlStmt_FreeResult(stmt);
+	}
+	SqlStmt_Free(stmt);
+
+	return result;
+}
+
 /// update an existing account with the provided new data (both account and regs)
 static bool account_db_sql_save(AccountDB* self, const struct mmo_account* acc)
 {
@@ -522,7 +547,7 @@
 
 	// retrieve login entry for the specified account
 	if( SQL_ERROR == Sql_Query(sql_handle,
-	    "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`, `pincode_change` FROM `%s` WHERE `account_id` = %d",
+	    "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`, `pincode_change`,`last_mac` FROM `%s` WHERE `account_id` = %d",
 		db->account_db, account_id )
 	) {
 		Sql_ShowDebug(sql_handle);
@@ -551,6 +576,7 @@
 	Sql_GetData(sql_handle, 13, &data, NULL); acc->char_slots = atoi(data);
 	Sql_GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode));
 	Sql_GetData(sql_handle, 15, &data, NULL); acc->pincode_change = atol(data);
+	Sql_GetData(sql_handle, 16, &data, NULL); safestrncpy(acc->mac_address, data, sizeof(acc->mac_address));
 
 	Sql_FreeResult(sql_handle);
 
@@ -599,7 +625,7 @@
 	if( is_new )
 	{// insert into account table
 		if( SQL_SUCCESS != SqlStmt_Prepare(stmt,
-			"INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+			"INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`, `last_mac`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
 			db->account_db)
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  0, SQLDT_INT,    (void*)&acc->account_id,      sizeof(acc->account_id))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  1, SQLDT_STRING, (void*)acc->userid,           strlen(acc->userid))
@@ -617,6 +643,7 @@
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_UCHAR,  (void*)&acc->char_slots,      sizeof(acc->char_slots))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 14, SQLDT_STRING, (void*)&acc->pincode,         strlen(acc->pincode))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 15, SQLDT_LONG,   (void*)&acc->pincode_change,  sizeof(acc->pincode_change))
+		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 16, SQLDT_STRING, (void*)acc->mac_address,      strlen(acc->mac_address))
 		||  SQL_SUCCESS != SqlStmt_Execute(stmt)
 		) {
 			SqlStmt_ShowDebug(stmt);
@@ -625,7 +652,7 @@
 	}
 	else
 	{// update account table
-		if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?, `pincode_change`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
+		if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?, `pincode_change`=?,`last_mac`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  0, SQLDT_STRING, (void*)acc->userid,           strlen(acc->userid))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  1, SQLDT_STRING, (void*)acc->pass,             strlen(acc->pass))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt,  2, SQLDT_ENUM,   (void*)&acc->sex,             sizeof(acc->sex))
@@ -641,6 +668,7 @@
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, SQLDT_UCHAR,  (void*)&acc->char_slots,      sizeof(acc->char_slots))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_STRING, (void*)&acc->pincode,         strlen(acc->pincode))
 		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 14, SQLDT_LONG,   (void*)&acc->pincode_change,  sizeof(acc->pincode_change))
+		||  SQL_SUCCESS != SqlStmt_BindParam(stmt, 15, SQLDT_STRING, (void*)acc->mac_address,      strlen(acc->mac_address))
 		||  SQL_SUCCESS != SqlStmt_Execute(stmt)
 		) {
 			SqlStmt_ShowDebug(stmt);
Index: src/login/login.h
===================================================================
--- src/login/login.h	(revision 17484)
+++ src/login/login.h	(working copy)
@@ -23,6 +23,9 @@
 	long login_id2;
 	char sex;// 'F','M','S'
 
+	void *harm_sd;
+	char mac_address[20];
+
 	char userid[NAME_LENGTH];
 	char passwd[32+1]; // 23+1 for plaintext, 32+1 for md5-ed passwords
 	int passwdenc;
Index: src/login/loginlog.h
===================================================================
--- src/login/loginlog.h	(revision 17484)
+++ src/login/loginlog.h	(working copy)
@@ -6,7 +6,7 @@
 
 
 unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes);
-void login_log(uint32 ip, const char* username, int rcode, const char* message);
+void login_log(uint32 ip, const char* username, int rcode, const char* message, const char* mac);
 bool loginlog_init(void);
 bool loginlog_final(void);
 bool loginlog_config_read(const char* w1, const char* w2);
Index: src/login/loginlog_sql.c
===================================================================
--- src/login/loginlog_sql.c	(revision 17484)
+++ src/login/loginlog_sql.c	(working copy)
@@ -55,7 +55,7 @@
 /*=============================================
  * Records an event in the login log
  *---------------------------------------------*/
-void login_log(uint32 ip, const char* username, int rcode, const char* message)
+void login_log(uint32 ip, const char* username, int rcode, const char* message, const char* mac)
 {
 	char esc_username[NAME_LENGTH*2+1];
 	char esc_message[255*2+1];
@@ -68,8 +68,8 @@
 	Sql_EscapeStringLen(sql_handle, esc_message, message, strnlen(message, 255));
 
 	retcode = Sql_Query(sql_handle,
-		"INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%s', '%s', '%d', '%s')",
-		log_login_db, ip2str(ip,NULL), esc_username, rcode, esc_message);
+		"INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`,`mac`) VALUES (NOW(), '%s', '%s', '%d', '%s', '%s')",
+		log_login_db, ip2str(ip,NULL), esc_username, rcode, esc_message, mac);
 
 	if( retcode != SQL_SUCCESS )
 		Sql_ShowDebug(sql_handle);
Index: src/login/account.h
===================================================================
--- src/login/account.h	(revision 17484)
+++ src/login/account.h	(working copy)
@@ -41,6 +41,7 @@
 	char pass[32+1];        // 23+1 for plaintext, 32+1 for md5-ed passwords
 	char sex;               // gender (M/F/S)
 	char email[40];         // e-mail (by default: [email protected])
+	char mac_address[20];   // Harmony v3
 	int group_id;           // player group id
 	uint8 char_slots;       // this accounts maximum character slots (maximum is limited to MAX_CHARS define in char server)
 	unsigned int state;     // packet 0x006a value + 1 (0: compte OK)
@@ -86,6 +87,9 @@
 	///
 	/// @param self Database
 	void (*destroy)(AccountDB* self);
+
+	/*** HARMONY v3 ***/
+	bool (*is_mac_banned)(AccountDB* self, const char *mac);
 
 	/// Gets a property from this database.
 	/// These read-only properties must be implemented:
Index: src/login/login.c
===================================================================
--- src/login/login.c	(revision 17484)
+++ src/login/login.c	(working copy)
@@ -10,6 +10,7 @@
 #include "../common/socket.h"
 #include "../common/strlib.h"
 #include "../common/timer.h"
+#include "../common/harmony.h"
 #include "../common/msg_conf.h"
 #include "../common/cli.h"
 #include "../common/ers.h"
@@ -729,6 +730,15 @@
 			}
 		break;
 
+		case 0x40a2: // Harmony
+			if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
+				return 0;
+		{
+			harm_funcs->login_process(fd, RFIFOP(fd, 4), RFIFOW(fd, 2)-4);
+			RFIFOSKIP(fd, RFIFOW(fd, 2));
+		}
+		break;
+
 		case 0x2727: // Change of sex (sex is reversed)
 			if( RFIFOREST(fd) < 6 )
 				return 0;
@@ -932,7 +942,7 @@
 					if( ld == NULL )
 						return 0;
 
-					login_log( host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed" );
+					login_log( host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed", "");
 				}
 
 				remove_online_user(acc.account_id);
@@ -1121,6 +1131,11 @@
 		}
 	}
 
+	if (acc.sex != 'S' && acc.sex != 's' && (len = harm_funcs->login_process_auth2(sd->fd, acc.group_id)) > 0) {
+		ShowNotice("Connection refused by Harmony (account: %s, ip: %s)\n", sd->userid, ip);
+		return len;
+	}
+
 	ShowNotice("Authentication accepted (account: %s, id: %d, ip: %s)\n", sd->userid, acc.account_id, ip);
 
 	// update session data
@@ -1131,6 +1146,8 @@
 	sd->sex = acc.sex;
 	sd->group_id = acc.group_id;
 
+	memcpy(acc.mac_address, sd->mac_address, sizeof(acc.mac_address));
+
 	// update account data
 	timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S");
 	safestrncpy(acc.last_ip, ip, sizeof(acc.last_ip));
@@ -1227,7 +1244,7 @@
 		}
 	}
 
-	login_log(ip, sd->userid, 100, "login ok");
+	login_log(ip, sd->userid, 100, "login ok", sd->mac_address);
 	ShowStatus("Connection of the account '%s' accepted.\n", sd->userid);
 
 	WFIFOHEAD(fd,47+32*server_num);
@@ -1313,11 +1330,11 @@
 	if (login_config.log_login)
 	{
 		if(result >= 0 && result <= 15)
-		    login_log(ip, sd->userid, result, msg_txt(result));
+		    login_log(ip, sd->userid, result, msg_txt(result), sd->mac_address);
 		else if(result >= 99 && result <= 104)
-		    login_log(ip, sd->userid, result, msg_txt(result-83)); //-83 offset
+		    login_log(ip, sd->userid, result, msg_txt(result-83), sd->mac_address); //-83 offset
 		else
-		    login_log(ip, sd->userid, result, msg_txt(22)); //unknow error
+		    login_log(ip, sd->userid, result, msg_txt(22), sd->mac_address); //unknow error
 	}
 
 	if( result == 1 && login_config.dynamic_pass_failure_ban )
@@ -1376,7 +1393,7 @@
 		if( login_config.ipban && ipban_check(ipl) )
 		{
 			ShowStatus("Connection refused: IP isn't authorised (deny/allow, ip: %s).\n", ip);
-			login_log(ipl, "unknown", -3, "ip banned");
+			login_log(ipl, "unknown", -3, "ip banned", "");
 			WFIFOHEAD(fd,23);
 			WFIFOW(fd,0) = 0x6a;
 			WFIFOB(fd,2) = 3; // 3 = Rejected from Server
@@ -1529,6 +1546,32 @@
 		}
 		break;
 
+		case 0x254:
+		case 0x255:
+		case 0x256:
+		{
+			int result = harm_funcs->login_process_auth(fd, RFIFOP(fd, 0), RFIFOREST(fd), sd->userid, sd->passwd, &sd->version);
+			RFIFOSKIP(fd, RFIFOREST(fd));
+
+			harm_funcs->login_get_mac_address(fd, sd->mac_address);
+
+			if( login_config.use_md5_passwds )
+					MD5_String(sd->passwd, sd->passwd);
+
+			if (result > 0) {
+				login_auth_failed(sd, result);
+			} else if (result == 0) {
+				return 0;
+			} else {
+				result = mmo_auth(sd, false);
+				if (result == -1)
+					login_auth_ok(sd);
+				else
+					login_auth_failed(sd, result);
+			}
+		}
+		break;
+
 		case 0x2710:	// Connection request of a char-server
 			if (RFIFOREST(fd) < 86)
 				return 0;
@@ -1555,7 +1598,7 @@
 
 			ShowInfo("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n", server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip);
 			sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port);
-			login_log(session[fd]->client_addr, sd->userid, 100, message);
+			login_log(session[fd]->client_addr, sd->userid, 100, message, "");
 
 			result = mmo_auth(sd, true);
 			if( runflag == LOGINSERVER_ST_RUNNING &&
@@ -1796,9 +1839,11 @@
 		aFree(tmp);
 	}
 
-	login_log(0, "login server", 100, "login server shutdown");
+	login_log(0, "login server", 100, "login server shutdown", "");
 	ShowStatus("Terminating...\n");
 
+	harm_funcs->login_final();
+
 	if( login_config.log_login )
 		loginlog_final();
 
@@ -1830,6 +1875,23 @@
 	ShowStatus("Finished.\n");
 }
 
+void _FASTCALL harmony_action(int fd, int task, int id, intptr data) {
+	if (task == HARMTASK_ZONE_ACTION) {
+		if (id > 10*1024)
+			return;
+
+		WFIFOHEAD(fd, id);
+		WFIFOW(fd, 0) = 0x40a3;
+		WFIFOW(fd, 2) = id + 4;
+		memcpy(WFIFOP(fd, 4), (const void*)data, id);
+		WFIFOSET(fd, id+4);
+	}
+}
+
+bool _FASTCALL check_mac_banned(const int8 *mac) {
+	return accounts->is_mac_banned(accounts, mac);
+}
+
 //------------------------------
 // Function called when the server
 // has received a crash signal.
@@ -1930,6 +1992,11 @@
 		}
 	}
 
+	// Initialize Harmony
+	ea_funcs->ea_is_mac_banned = check_mac_banned;
+	harm_funcs->login_init();
+	ea_funcs->action_request = harmony_action;
+
 	// server port open & binding
 	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);
@@ -1942,7 +2009,7 @@
 	}
 
 	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");

my erro compile:

/tmp/ccS8bcNt.ltrans7.ltrans.o: In function `delete_session.4202':
/home/nando/new/valk/src/login/socket.c:628: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans7.ltrans.o: In function `WFIFOSET':
/home/nando/new/valk/src/login/socket.c:751: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans8.ltrans.o: In function `main':
/home/nando/new/valk/src/login/core.c:363: undefined reference to `harmony_core_init'
/home/nando/new/valk/src/login/core.c:375: undefined reference to `harmony_core_final'
/tmp/ccS8bcNt.ltrans8.ltrans.o: In function `recv_to_fifo':
/home/nando/new/valk/src/login/socket.c:369: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans8.ltrans.o: In function `connect_client':
/home/nando/new/valk/src/login/socket.c:489: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans12.ltrans.o: In function `do_final':
/home/nando/new/valk/src/login/login.c:1965: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans12.ltrans.o: In function `do_init':
/home/nando/new/valk/src/login/login.c:2116: undefined reference to `ea_funcs'
/home/nando/new/valk/src/login/login.c:2117: undefined reference to `harm_funcs'
/home/nando/new/valk/src/login/login.c:2118: undefined reference to `ea_funcs'
/tmp/ccS8bcNt.ltrans13.ltrans.o: In function `parse_login':
/home/nando/new/valk/src/login/login.c:1652: undefined reference to `harm_funcs'
/home/nando/new/valk/src/login/login.c:1655: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans14.ltrans.o: In function `mmo_auth':
/home/nando/new/valk/src/login/login.c:1233: undefined reference to `harm_funcs'
/tmp/ccS8bcNt.ltrans15.ltrans.o: In function `parse_fromchar':
/home/nando/new/valk/src/login/login.c:802: undefined reference to `harm_funcs'
collect2: error: ld returned 1 exit status
make[1]: ** [login-server] Erro 1
make[1]: Saindo do diretório `/home/nando/new/valk/src/login'
make: ** [login] Erro 2
root@xxxdnn2228:/home/nando/new/valk#

help-me plis

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   6
  • Joined:  12/28/11
  • Last Seen:  

No one seems to be paying any attention with gameguard again nowdays, hahahaha

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...