summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c26
-rw-r--r--src/map/chrif.c20
-rw-r--r--src/map/chrif.h2
3 files changed, 29 insertions, 19 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ce05f32f4..f1b95474e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1004,7 +1004,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
struct mmo_charstatus p;
int j = 0, i;
char last_map[MAP_NAME_LENGTH_EXT];
- size_t unban_time;
+ time_t unban_time;
stmt = SQL->StmtMalloc(sql_handle);
if( stmt == NULL ) {
@@ -1949,9 +1949,9 @@ void mmo_char_send099d(int fd, struct char_session_data *sd) {
void mmo_char_send020d(int fd, struct char_session_data *sd) {
int i;
time_t now = time(NULL);
-
- ARR_FIND(0, MAX_CHARS, i, sd->unban_time[i] > now);
-
+
+ ARR_FIND(0, MAX_CHARS, i, sd->unban_time[i]);
+
if( i != MAX_CHARS ) {
int c;
@@ -1960,9 +1960,19 @@ void mmo_char_send020d(int fd, struct char_session_data *sd) {
WFIFOW(fd, 0) = 0x20d;
for(i = 0, c = 0; i < MAX_CHARS; i++) {
- if( sd->unban_time[i] > now ) {
- WFIFOL(fd, 4 + (24*c)) = sd->found_char[i];
+ if( sd->unban_time[i] ) {
timestamp2string((char*)WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S");
+
+ if( sd->unban_time[i] > now )
+ WFIFOL(fd, 4 + (24*c)) = sd->found_char[i];
+ else {
+ /* reset -- client keeps this information even if you logout so we need to clear */
+ WFIFOL(fd, 4 + (24*c)) = 0;
+ /* also update on mysql */
+ sd->unban_time[i] = 0;
+ if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) )
+ Sql_ShowDebug(sql_handle);
+ }
c++;
}
}
@@ -2338,7 +2348,7 @@ int parse_fromlogin(int fd) {
#else
mmo_char_send006b(i, sd);
#endif
- #if PACKETVER >= 20080000
+ #if PACKETVER >= 20060819
mmo_char_send020d(i, sd);
#endif
#if PACKETVER >= 20110309
@@ -3301,7 +3311,7 @@ int parse_frommap(int fd)
unsigned char buf[11];
WBUFW(buf,0) = 0x2b14;
- WBUFL(buf,2) = account_id;
+ WBUFL(buf,2) = char_id;
WBUFB(buf,6) = 2;
WBUFL(buf,7) = (unsigned int)timestamp;
mapif_sendall(buf, 11);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 56572d492..5927e31bf 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -966,21 +966,21 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) {
}
/*==========================================
- * Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
+ * Disconnection of a player (account or char has been banned of has a status, from login or char server) by [Yor]
*------------------------------------------*/
-int chrif_accountban(int fd) {
- int acc;
+int chrif_idbanned(int fd) {
+ int id;
struct map_session_data *sd;
- acc = RFIFOL(fd,2);
+ id = RFIFOL(fd,2);
if ( battle_config.etc_log )
- ShowNotice("chrif_accountban %d.\n", acc);
+ ShowNotice("chrif_idbanned %d.\n", id);
- sd = map->id2sd(acc);
+ sd = ( RFIFOB(fd,6) == 2 ) ? map->charid2sd(id) : map->id2sd(id);
- if ( acc < 0 || sd == NULL ) {
- ShowError("chrif_accountban failed - player not online.\n");
+ if ( id < 0 || sd == NULL ) {
+ /* player not online or unknown id, either way no error is necessary (since if you try to ban a offline char it still works) */
return 0;
}
@@ -1453,7 +1453,7 @@ int chrif_parse(int fd) {
case 0x2b0d: chrif->changedsex(fd); break;
case 0x2b0f: chrif->char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break;
case 0x2b12: chrif->divorceack(RFIFOL(fd,2), RFIFOL(fd,6)); break;
- case 0x2b14: chrif->accountban(fd); break;
+ case 0x2b14: chrif->idbanned(fd); break;
case 0x2b1b: chrif->recvfamelist(fd); break;
case 0x2b1d: chrif->load_scdata(fd); break;
case 0x2b1e: chrif->update_ip(fd); break;
@@ -1748,7 +1748,7 @@ void chrif_defaults(void) {
chrif->changemapserverack = chrif_changemapserverack;
chrif->changedsex = chrif_changedsex;
chrif->divorceack = chrif_divorceack;
- chrif->accountban = chrif_accountban;
+ chrif->idbanned = chrif_idbanned;
chrif->recvfamelist = chrif_recvfamelist;
chrif->load_scdata = chrif_load_scdata;
chrif->update_ip = chrif_update_ip;
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 56aa569a3..b69d34210 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -127,7 +127,7 @@ struct chrif_interface {
int (*changemapserverack) (int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port);
int (*changedsex) (int fd);
int (*divorceack) (int char_id, int partner_id);
- int (*accountban) (int fd);
+ int (*idbanned) (int fd);
int (*recvfamelist) (int fd);
int (*load_scdata) (int fd);
void (*update_ip) (int fd);