summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-04-03 00:16:52 +0200
committerGitHub <noreply@github.com>2018-04-03 00:16:52 +0200
commit2bd8bcf86931f2dce4df3d2fef4836657543ca50 (patch)
treeb86f7a5807ac6d6037fef60a792e5c4289b05114 /src/char
parentb5bd99a39aee9b555fbe90fe1c839c7cfffed9c0 (diff)
parent6518dd8702421c0ff614ae3f771f56950269a77b (diff)
downloadhercules-2bd8bcf86931f2dce4df3d2fef4836657543ca50.tar.gz
hercules-2bd8bcf86931f2dce4df3d2fef4836657543ca50.tar.bz2
hercules-2bd8bcf86931f2dce4df3d2fef4836657543ca50.tar.xz
hercules-2bd8bcf86931f2dce4df3d2fef4836657543ca50.zip
Merge pull request #1986 from Megasantos/login_date_guild
Implemented login date for guild members.
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_guild.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 0102f11a0..3f34e883b 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -417,8 +417,8 @@ struct guild * inter_guild_fromsql(int guild_id)
}
// load guild member info
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name` "
- "FROM `%s` WHERE `guild_id`='%d' ORDER BY `position`", guild_member_db, guild_id) )
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT g.`account_id`,g.`char_id`,g.`hair`,g.`hair_color`,g.`gender`,g.`class`,g.`lv`,g.`exp`,g.`exp_payper`,g.`online`,g.`position`,g.`name`,c.`last_login`"
+ "FROM `%s` g LEFT JOIN `%s` c ON c.`char_id` = g.`char_id` WHERE g.`guild_id`='%d' ORDER BY `position`", guild_member_db, char_db, guild_id) )
{
Sql_ShowDebug(inter->sql_handle);
aFree(g);
@@ -442,6 +442,7 @@ struct guild * inter_guild_fromsql(int guild_id)
if( m->position >= MAX_GUILDPOSITION ) // Fix reduction of MAX_GUILDPOSITION [PoW]
m->position = MAX_GUILDPOSITION - 1;
SQL->GetData(inter->sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH));
+ SQL->GetData(inter->sql_handle, 12, &data, NULL); m->last_login = atoi(data);
m->modified = GS_MEMBER_UNMODIFIED;
}
@@ -975,7 +976,7 @@ int mapif_guild_withdraw(int guild_id,int account_id,int char_id,int flag, const
// Send short member's info
int mapif_guild_memberinfoshort(struct guild *g, int idx)
{
- unsigned char buf[19];
+ unsigned char buf[23];
nullpo_ret(g);
Assert_ret(idx >= 0 && idx < MAX_GUILD);
WBUFW(buf, 0)=0x3835;
@@ -985,7 +986,8 @@ int mapif_guild_memberinfoshort(struct guild *g, int idx)
WBUFB(buf,14)=(unsigned char)g->member[idx].online;
WBUFW(buf,15)=g->member[idx].lv;
WBUFW(buf,17)=g->member[idx].class;
- mapif->sendall(buf,19);
+ WBUFL(buf,19)=g->member[idx].last_login;
+ mapif->sendall(buf,23);
return 0;
}
@@ -1366,6 +1368,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id,
g->member[i].online = online;
g->member[i].lv = lv;
g->member[i].class = class;
+ g->member[i].last_login = (uint32)time(NULL);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfoshort(g,i);
}