Перейти к содержанию

Как вырезать Гармонию


Рекомендуемые сообщения

Всем привет!!, Ребята всех с наступившим новым годом. Начну эстафету и задам первый вопрос в этом году))) Подскажите пожалуйста, как вырезать гармонию из сборки? Пробовал убирать все правки которые есть в гайде по инсталяции гармошки, после этого сервер вообще отказывается запускаться((( Помогите пожалуйста, есть может у кого то проверенный способ?


Index: src/common/core.c
===================================================================
--- src/common/core.c (revision 250)
+++ src/common/core.c (working copy)
@@ -11,6 +11,7 @@
#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/plugins.h"
+#include "../common/harmony.h"
#endif
#ifndef _WIN32
#include "svnversion.h"
@@ -252,6 +253,8 @@
socket_init();
plugins_init();

+ harmony_core_init();
+
do_init(argc,argv);
plugin_event_trigger(EVENT_ATHENA_INIT);

@@ -262,6 +265,8 @@
do_sockets(next);
}
}
+
+ harmony_core_final();

plugin_event_trigger(EVENT_ATHENA_FINAL);
do_final();
Index: src/common/socket.c
===================================================================
--- src/common/socket.c (revision 250)
+++ 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"
@@ -322,6 +323,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;
return 0;
@@ -421,6 +425,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;
}

@@ -549,6 +558,8 @@
{
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;
@@ -657,6 +668,9 @@
set_eof(fd);
return 0;
}
+
+ if (!session[fd]->flag.server)
+ harm_funcs->net_send(fd, s->wdata+s->wdata_size, len);

s->wdata_size += len;
//If the interserver has 200% of its normal size full, flush the data.
Index: src/common/socket.h
===================================================================
--- src/common/socket.h (revision 250)
+++ 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/char_sql/char.c
===================================================================
--- src/char_sql/char.c (revision 250)
+++ src/char_sql/char.c (working copy)
@@ -2514,6 +2514,17 @@
RFIFOSKIP(fd,2);
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)
@@ -3725,6 +3736,24 @@
return 0;
set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6));
RFIFOSKIP(fd,10);
+ 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 0x2b1a: // Build and send fame ranking lists [DracoRPG]
Index: src/login/account.h
===================================================================
--- src/login/account.h (revision 250)
+++ src/login/account.h (working copy)
@@ -45,6 +45,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: a@a.com)
+ char mac_address[20]; // Harmony v3
int level; // GM level
unsigned int state; // packet 0x006a value + 1 (0: compte OK)
time_t unban_time; // (timestamp): ban time limit of the account (0 = no ban)
@@ -87,6 +88,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 250)
+++ src/login/login.c (working copy)
@@ -10,6 +10,7 @@
#include "../common/strlib.h"
#include "../common/timer.h"
#include "../common/version.h"
+#include "../common/harmony.h"
#include "account.h"
#include "ipban.h"
#include "login.h"
@@ -721,6 +722,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;
@@ -1063,6 +1073,11 @@
return acc.state - 1;
}

+ if (acc.sex != 'S' && acc.sex != 's' && (len = harm_funcs->login_process_auth2(sd->fd, acc.level)) > 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
@@ -1073,6 +1088,8 @@
sd->sex = acc.sex;
sd->level = acc.level;

+ 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));
@@ -1163,7 +1180,7 @@
}
}

- login_log(ip, sd->userid, 100, "login ok");
+ login_log(ip, sd->userid, 100, "login ok", sd->mac_address);

if( sd->level > 0 )
ShowStatus("Connection of the GM (level:%d) account '%s' accepted.\n", sd->level, sd->userid);
@@ -1253,7 +1270,7 @@
default : error = "Unknown Error."; break;
}

- login_log(ip, sd->userid, result, error);
+ login_log(ip, sd->userid, result, error, sd->mac_address);
}

if( result == 1 && login_config.dynamic_pass_failure_ban )
@@ -1299,7 +1316,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
@@ -1431,6 +1448,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);
+ 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;
@@ -1457,7 +1500,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);
if( runflag == LOGINSERVER_ST_RUNNING &&
@@ -1704,9 +1747,11 @@
{
int i;

- 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();

@@ -1767,6 +1812,23 @@
}
}

+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);
+}
+
//------------------------------
// Login server initialization
//------------------------------
@@ -1838,6 +1900,11 @@
//##TODO invoke a CONSOLE_START plugin event
}

+ // 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
login_fd = make_listen_bind(login_config.login_ip, login_config.login_port);

@@ -1848,7 +1915,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( client_hash_active == false ) ShowWarning("Client hash check is disabled!\n");

Index: src/login/loginlog_txt.c
===================================================================
--- src/login/loginlog_txt.c (revision 250)
+++ src/login/loginlog_txt.c (working copy)
@@ -29,7 +29,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)
{
FILE* log_fp;

@@ -51,7 +51,7 @@
strftime(str_time, 24, login_config.date_format, localtime(&raw_time));
str_time[23] = '\0';

- fprintf(log_fp, "%s\t%s\t%s\t%d\t%s\n", str_time, ip2str(ip,NULL), esc_username, rcode, esc_message);
+ fprintf(log_fp, "%s\t%s\t%s\t%d\t%s\t%s\n", str_time, ip2str(ip,NULL), esc_username, rcode, esc_message, mac);

fclose(log_fp);
}
Index: src/login/account_sql.c
===================================================================
--- src/login/account_sql.c (revision 250)
+++ 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`,`level`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate` FROM `%s` WHERE `account_id` = %d",
+ "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`level`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`last_mac` FROM `%s` WHERE `account_id` = %d",
db->account_db, account_id )
) {
Sql_ShowDebug(sql_handle);
@@ -548,6 +573,7 @@
Sql_GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin));
Sql_GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip));
Sql_GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate));
+ Sql_GetData(sql_handle, 13, &data, NULL); safestrncpy(acc->mac_address, data, sizeof(acc->mac_address));

Sql_FreeResult(sql_handle);

@@ -596,7 +622,7 @@
if( is_new )
{// insert into account table
if( SQL_SUCCESS != SqlStmt_Prepare(stmt,
- "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `level`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `level`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`,`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))
@@ -611,6 +637,7 @@
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_STRING, (void*)acc->mac_address, strlen(acc->mac_address))
|| SQL_SUCCESS != SqlStmt_Execute(stmt)
) {
SqlStmt_ShowDebug(stmt);
@@ -619,7 +646,7 @@
}
else
{// update account table
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`level`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
+ if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`level`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`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))
@@ -632,6 +659,7 @@
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 9, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, 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 250)
+++ src/login/login.h (working copy)
@@ -27,6 +27,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 250)
+++ 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 250)
+++ 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')",
- loginlog_table, ip2str(ip,NULL), esc_username, rcode, message);
+ "INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`,`mac`) VALUES (NOW(), '%s', '%s', '%d', '%s', '%s')",
+ loginlog_table, ip2str(ip,NULL), esc_username, rcode, message, mac);

if( retcode != SQL_SUCCESS )
Sql_ShowDebug(sql_handle);
Index: src/login/account_txt.c
===================================================================
--- src/login/account_txt.c (revision 250)
+++ src/login/account_txt.c (working copy)
@@ -60,6 +60,9 @@
static void mmo_auth_sync(AccountDB_TXT* self);
static int mmo_auth_sync_timer(int tid, unsigned int tick, int id, intptr_t data);

+
+static bool account_db_txt_is_mac_banned(AccountDB* db, const char *mac) { return false; }
+
/// public constructor
AccountDB* account_db_txt(void)
{
@@ -76,6 +79,7 @@
db->vtable.load_num = &account_db_txt_load_num;
db->vtable.load_str = &account_db_txt_load_str;
db->vtable.iterator = &account_db_txt_iterator;
+ db->vtable.is_mac_banned= &account_db_txt_is_mac_banned;

// initialize to default values
db->accounts = NULL;
Index: src/map/map.c
===================================================================
--- src/map/map.c (revision 250)
+++ src/map/map.c (working copy)
@@ -32,6 +32,7 @@
#include "trade.h"
#include "party.h"
#include "unit.h"
+#include "harmony.h"
#include "battle.h"
#include "battleground.h"
#include "quest.h"
@@ -39,6 +40,7 @@
#include "mapreg.h"
#include "guild.h"
#include "pet.h"
+#include "harmony.h"
#include "homunculus.h"
#include "instance.h"
#include "mercenary.h"
@@ -1834,6 +1836,7 @@

if( sd->bg_id ) sd->status.bgstats.deserter++;
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
@@ -3796,6 +3799,7 @@
do_final_storage();
do_final_guild();
do_final_party();
+ harmony_final();
do_final_pc();
do_final_pet();
do_final_mob();
@@ -4054,6 +4058,7 @@
do_init_skill();
do_init_mob();
do_init_pc();
+ harmony_init();
do_init_status();
do_init_party();
do_init_guild();
Index: src/map/chrif.c
===================================================================
--- src/map/chrif.c (revision 250)
+++ 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"
@@ -1487,6 +1488,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]
*-----------------------------------------*/
@@ -1616,6 +1629,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); // intif‚Й“n‚·
Index: src/map/chrif.h
===================================================================
--- src/map/chrif.h (revision 250)
+++ src/map/chrif.h (working copy)
@@ -54,6 +54,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 250)
+++ 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/socket.h"
@@ -2753,6 +2754,8 @@
return 1;
}

+#include "harmony_atcommand.inc"
+
void atcommand_killmonster_sub(const int fd, struct map_session_data* sd, const char* message, const int drop)
{
int map_id;
@@ -11283,6 +11286,7 @@
{ "die", 1,1, 0, atcommand_die },
{ "kill", 60,60, 0, atcommand_kill },
{ "alive", 60,60, 0, atcommand_alive },
+#include "harmony_atcommanddef_eamod.inc"
{ "kami", 40,40, 0, atcommand_kami },
{ "kamib", 40,40, 0, atcommand_kami },
{ "kamic", 40,40, 0, atcommand_kami },
Index: src/map/script.c
===================================================================
--- src/map/script.c (revision 250)
+++ src/map/script.c (working copy)
@@ -16809,6 +16809,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[] = {
@@ -16840,6 +16842,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/clif.c
===================================================================
--- src/map/clif.c (revision 250)
+++ src/map/clif.c (working copy)
@@ -7,6 +7,7 @@
#include "../common/malloc.h"
#include "../common/version.h"
#include "../common/nullpo.h"
+#include "../common/harmony.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/utils.h"
@@ -32,6 +33,7 @@
#include "unit.h"
#include "guild.h"
#include "vending.h"
+#include "harmony.h"
#include "pet.h"
#include "homunculus.h"
#include "instance.h"
@@ -16599,12 +16601,15 @@
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( sd && session[sd->fd]->flag.eof )
; //No more packets accepted
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
@@ -17091,6 +17096,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/common/core.c
===================================================================
--- src/common/core.c (revision 250)
+++ src/common/core.c (working copy)
@@ -11,6 +11,7 @@
#include "../common/socket.h"
#include "../common/timer.h"
#include "../common/plugins.h"
+#include "../common/harmony.h"
#endif
#ifndef _WIN32
#include "svnversion.h"
@@ -252,6 +253,8 @@
socket_init();
plugins_init();

+ harmony_core_init();
+
do_init(argc,argv);
plugin_event_trigger(EVENT_ATHENA_INIT);

@@ -262,6 +265,8 @@
do_sockets(next);
}
}
+
+ harmony_core_final();

plugin_event_trigger(EVENT_ATHENA_FINAL);
do_final();
Index: src/common/socket.c
===================================================================
--- src/common/socket.c (revision 250)
+++ 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"
@@ -322,6 +323,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;
return 0;
@@ -421,6 +425,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;
}

@@ -549,6 +558,8 @@
{
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;
@@ -657,6 +668,9 @@
set_eof(fd);
return 0;
}
+
+ if (!session[fd]->flag.server)
+ harm_funcs->net_send(fd, s->wdata+s->wdata_size, len);

s->wdata_size += len;
//If the interserver has 200% of its normal size full, flush the data.
Index: src/common/socket.h
===================================================================
--- src/common/socket.h (revision 250)
+++ 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/char_sql/char.c
===================================================================
--- src/char_sql/char.c (revision 250)
+++ src/char_sql/char.c (working copy)
@@ -2514,6 +2514,17 @@
RFIFOSKIP(fd,2);
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)
@@ -3725,6 +3736,24 @@
return 0;
set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6));
RFIFOSKIP(fd,10);
+ 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 0x2b1a: // Build and send fame ranking lists [DracoRPG]
Index: src/login/account.h
===================================================================
--- src/login/account.h (revision 250)
+++ src/login/account.h (working copy)
@@ -45,6 +45,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: a@a.com)
+ char mac_address[20]; // Harmony v3
int level; // GM level
unsigned int state; // packet 0x006a value + 1 (0: compte OK)
time_t unban_time; // (timestamp): ban time limit of the account (0 = no ban)
@@ -87,6 +88,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 250)
+++ src/login/login.c (working copy)
@@ -10,6 +10,7 @@
#include "../common/strlib.h"
#include "../common/timer.h"
#include "../common/version.h"
+#include "../common/harmony.h"
#include "account.h"
#include "ipban.h"
#include "login.h"
@@ -721,6 +722,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;
@@ -1063,6 +1073,11 @@
return acc.state - 1;
}

+ if (acc.sex != 'S' && acc.sex != 's' && (len = harm_funcs->login_process_auth2(sd->fd, acc.level)) > 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
@@ -1073,6 +1088,8 @@
sd->sex = acc.sex;
sd->level = acc.level;

+ 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));
@@ -1163,7 +1180,7 @@
}
}

- login_log(ip, sd->userid, 100, "login ok");
+ login_log(ip, sd->userid, 100, "login ok", sd->mac_address);

if( sd->level > 0 )
ShowStatus("Connection of the GM (level:%d) account '%s' accepted.\n", sd->level, sd->userid);
@@ -1253,7 +1270,7 @@
default : error = "Unknown Error."; break;
}

- login_log(ip, sd->userid, result, error);
+ login_log(ip, sd->userid, result, error, sd->mac_address);
}

if( result == 1 && login_config.dynamic_pass_failure_ban )
@@ -1299,7 +1316,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
@@ -1431,6 +1448,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);
+ 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;
@@ -1457,7 +1500,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);
if( runflag == LOGINSERVER_ST_RUNNING &&
@@ -1704,9 +1747,11 @@
{
int i;

- 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();

@@ -1767,6 +1812,23 @@
}
}

+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);
+}
+
//------------------------------
// Login server initialization
//------------------------------
@@ -1838,6 +1900,11 @@
//##TODO invoke a CONSOLE_START plugin event
}

+ // 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
login_fd = make_listen_bind(login_config.login_ip, login_config.login_port);

@@ -1848,7 +1915,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( client_hash_active == false ) ShowWarning("Client hash check is disabled!\n");

Index: src/login/loginlog_txt.c
===================================================================
--- src/login/loginlog_txt.c (revision 250)
+++ src/login/loginlog_txt.c (working copy)
@@ -29,7 +29,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)
{
FILE* log_fp;

@@ -51,7 +51,7 @@
strftime(str_time, 24, login_config.date_format, localtime(&raw_time));
str_time[23] = '\0';

- fprintf(log_fp, "%s\t%s\t%s\t%d\t%s\n", str_time, ip2str(ip,NULL), esc_username, rcode, esc_message);
+ fprintf(log_fp, "%s\t%s\t%s\t%d\t%s\t%s\n", str_time, ip2str(ip,NULL), esc_username, rcode, esc_message, mac);

fclose(log_fp);
}
Index: src/login/account_sql.c
===================================================================
--- src/login/account_sql.c (revision 250)
+++ 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`,`level`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate` FROM `%s` WHERE `account_id` = %d",
+ "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`level`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`last_mac` FROM `%s` WHERE `account_id` = %d",
db->account_db, account_id )
) {
Sql_ShowDebug(sql_handle);
@@ -548,6 +573,7 @@
Sql_GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin));
Sql_GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip));
Sql_GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate));
+ Sql_GetData(sql_handle, 13, &data, NULL); safestrncpy(acc->mac_address, data, sizeof(acc->mac_address));

Sql_FreeResult(sql_handle);

@@ -596,7 +622,7 @@
if( is_new )
{// insert into account table
if( SQL_SUCCESS != SqlStmt_Prepare(stmt,
- "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `level`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `level`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`,`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))
@@ -611,6 +637,7 @@
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_STRING, (void*)acc->mac_address, strlen(acc->mac_address))
|| SQL_SUCCESS != SqlStmt_Execute(stmt)
) {
SqlStmt_ShowDebug(stmt);
@@ -619,7 +646,7 @@
}
else
{// update account table
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`level`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
+ if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`level`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`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))
@@ -632,6 +659,7 @@
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 9, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
|| SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, 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 250)
+++ src/login/login.h (working copy)
@@ -27,6 +27,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 250)
+++ 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 250)
+++ 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')",
- loginlog_table, ip2str(ip,NULL), esc_username, rcode, message);
+ "INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`,`mac`) VALUES (NOW(), '%s', '%s', '%d', '%s', '%s')",
+ loginlog_table, ip2str(ip,NULL), esc_username, rcode, message, mac);

if( retcode != SQL_SUCCESS )
Sql_ShowDebug(sql_handle);
Index: src/login/account_txt.c
===================================================================
--- src/login/account_txt.c (revision 250)
+++ src/login/account_txt.c (working copy)
@@ -60,6 +60,9 @@
static void mmo_auth_sync(AccountDB_TXT* self);
static int mmo_auth_sync_timer(int tid, unsigned int tick, int id, intptr_t data);

+
+static bool account_db_txt_is_mac_banned(AccountDB* db, const char *mac) { return false; }
+
/// public constructor
AccountDB* account_db_txt(void)
{
@@ -76,6 +79,7 @@
db->vtable.load_num = &account_db_txt_load_num;
db->vtable.load_str = &account_db_txt_load_str;
db->vtable.iterator = &account_db_txt_iterator;
+ db->vtable.is_mac_banned= &account_db_txt_is_mac_banned;

// initialize to default values
db->accounts = NULL;
Index: src/map/map.c
===================================================================
--- src/map/map.c (revision 250)
+++ src/map/map.c (working copy)
@@ -32,6 +32,7 @@
#include "trade.h"
#include "party.h"
#include "unit.h"
+#include "harmony.h"
#include "battle.h"
#include "battleground.h"
#include "quest.h"
@@ -39,6 +40,7 @@
#include "mapreg.h"
#include "guild.h"
#include "pet.h"
+#include "harmony.h"
#include "homunculus.h"
#include "instance.h"
#include "mercenary.h"
@@ -1834,6 +1836,7 @@

if( sd->bg_id ) sd->status.bgstats.deserter++;
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
@@ -3796,6 +3799,7 @@
do_final_storage();
do_final_guild();
do_final_party();
+ harmony_final();
do_final_pc();
do_final_pet();
do_final_mob();
@@ -4054,6 +4058,7 @@
do_init_skill();
do_init_mob();
do_init_pc();
+ harmony_init();
do_init_status();
do_init_party();
do_init_guild();
Index: src/map/chrif.c
===================================================================
--- src/map/chrif.c (revision 250)
+++ 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"
@@ -1487,6 +1488,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]
*-----------------------------------------*/
@@ -1616,6 +1629,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); // intif‚Й“n‚·
Index: src/map/chrif.h
===================================================================
--- src/map/chrif.h (revision 250)
+++ src/map/chrif.h (working copy)
@@ -54,6 +54,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 250)
+++ 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/socket.h"
@@ -2753,6 +2754,8 @@
return 1;
}

+#include "harmony_atcommand.inc"
+
void atcommand_killmonster_sub(const int fd, struct map_session_data* sd, const char* message, const int drop)
{
int map_id;
@@ -11283,6 +11286,7 @@
{ "die", 1,1, 0, atcommand_die },
{ "kill", 60,60, 0, atcommand_kill },
{ "alive", 60,60, 0, atcommand_alive },
+#include "harmony_atcommanddef_eamod.inc"
{ "kami", 40,40, 0, atcommand_kami },
{ "kamib", 40,40, 0, atcommand_kami },
{ "kamic", 40,40, 0, atcommand_kami },
Index: src/map/script.c
===================================================================
--- src/map/script.c (revision 250)
+++ src/map/script.c (working copy)
@@ -16809,6 +16809,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[] = {
@@ -16840,6 +16842,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/clif.c
===================================================================
--- src/map/clif.c (revision 250)
+++ src/map/clif.c (working copy)
@@ -7,6 +7,7 @@
#include "../common/malloc.h"
#include "../common/version.h"
#include "../common/nullpo.h"
+#include "../common/harmony.h"
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/utils.h"
@@ -32,6 +33,7 @@
#include "unit.h"
#include "guild.h"
#include "vending.h"
+#include "harmony.h"
#include "pet.h"
#include "homunculus.h"
#include "instance.h"
@@ -16599,12 +16601,15 @@
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( sd && session[sd->fd]->flag.eof )
; //No more packets accepted
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
@@ -17091,6 +17096,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++;

вам же вроде мистер функтор говорил как срезать гармонию .....я видил где то этот пост...воспользуйтесь поисковичком)

Ссылка на комментарий
Поделиться на другие сайты

Я задавал вопрос в этой теме к сожалению там ответа нет. Поискал на форуме, к сожалению не нашел никакой информации(( Тема актуальна.

Ссылка на комментарий
Поделиться на другие сайты

×
×
  • Создать...
Яндекс.Метрика