summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorwizputer <wizputer@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-28 00:01:39 +0000
committerwizputer <wizputer@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-28 00:01:39 +0000
commit6a079edada5a1abdbba3be15d0a8ac5f72fda0a9 (patch)
tree0ac2cf6071f6154f48f3816750cb9c56875cd4fa /src/map
parentee2e4d8299abc3723b43ba915b01a7577a75c6cf (diff)
downloadhercules-6a079edada5a1abdbba3be15d0a8ac5f72fda0a9.tar.gz
hercules-6a079edada5a1abdbba3be15d0a8ac5f72fda0a9.tar.bz2
hercules-6a079edada5a1abdbba3be15d0a8ac5f72fda0a9.tar.xz
hercules-6a079edada5a1abdbba3be15d0a8ac5f72fda0a9.zip
Fixed online system, online column works and prevent double login at the login server
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@392 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chrif.c36
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/map.c32
3 files changed, 42 insertions, 28 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index adb26868d..a0706f594 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -904,11 +904,45 @@ int chrif_char_offline(struct map_session_data *sd)
WFIFOW(char_fd,0) = 0x2b17;
WFIFOL(char_fd,2) = sd->status.char_id;
- WFIFOSET(char_fd,6);
+ WFIFOL(char_fd,6) = sd->status.account_id;
+ WFIFOSET(char_fd,10);
+
+ return 0;
+}
+
+/*=========================================
+ * Tell char-server to reset all chars offline [Wizputer]
+ *-----------------------------------------
+ */
+int chrif_char_reset_offline(void) {
+ if (char_fd < 0)
+ return -1;
+
+ WFIFOW(char_fd,0) = 0x2b18;
+ WFIFOSET(char_fd,2);
return 0;
}
+/*=========================================
+ * Tell char-server charcter is online [Wizputer]
+ *-----------------------------------------
+ */
+
+int chrif_char_online(struct map_session_data *sd)
+{
+ if (char_fd < 0)
+ return -1;
+
+ WFIFOW(char_fd,0) = 0x2b19;
+ WFIFOL(char_fd,2) = sd->status.char_id;
+ WFIFOL(char_fd,6) = sd->status.account_id;
+ WFIFOSET(char_fd,10);
+
+ return 0;
+}
+
+
/*==========================================
*
*------------------------------------------
diff --git a/src/map/chrif.h b/src/map/chrif.h
index de20c3086..ab4f9580b 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -23,6 +23,8 @@ int chrif_saveaccountreg2(struct map_session_data *sd);
int chrif_reloadGMdb(void);
int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
int chrif_char_offline(struct map_session_data *sd);
+int chrif_char_reset_offline(void);
+int chrif_char_online(struct map_session_data *sd);
int chrif_changesex(int id, int sex);
int chrif_chardisconnect(struct map_session_data *sd);
diff --git a/src/map/map.c b/src/map/map.c
index 254883e93..4a7c111b8 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1570,8 +1570,8 @@ static int map_readmap(int m,char *fn, char *alias) {
if(gat==NULL)
return -1;
-// printf("\rLoading Maps [%d/%d]: %-50s ",m,map_num,fn);
-// fflush(stdout);
+ printf("\rLoading Maps [%d/%d]: %-50s ",m,map_num,fn);
+ fflush(stdout);
map[m].m=m;
xs=map[m].xs=*(int*)(gat+6);
@@ -2054,25 +2054,6 @@ int sql_config_read(char *cfgName)
return 0;
}
-// sql online status checking [Valaris]
-void char_offline(struct map_session_data *sd)
-{
- if(sd && sd->status.char_id) {
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `char_id`='%d'", char_db, sd->status.char_id);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
- }
-}
-
-void do_reset_online(void)
-{
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `online`='1'", char_db);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (reset_online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
-}
-
int online_timer(int tid,unsigned int tick,int id,int data)
{
if(check_online_timer != tid)
@@ -2090,16 +2071,13 @@ void char_online_check(void)
int i;
struct map_session_data *sd=NULL;
- do_reset_online();
+ chrif_char_reset_offline();
for(i=0;i<fd_max;i++){
if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
!(battle_config.hide_GM_session && pc_isGM(sd)))
if(sd->status.char_id) {
- sprintf(tmp_sql,"UPDATE `%s` SET `online`='1' WHERE `char_id`='%d'", char_db, sd->status.char_id);
- if(mysql_query(&mmysql_handle, tmp_sql) ) {
- printf("DB server Error (update online `%s`)- %s\n", char_db, mysql_error(&mmysql_handle) );
- }
+ chrif_char_online(sd);
}
}
@@ -2199,7 +2177,7 @@ void do_final(void) {
do_final_storage();
do_final_guild();
#ifndef TXT_ONLY
- do_reset_online();
+ chrif_char_reset_offline();
map_sql_close();
#endif /* not TXT_ONLY */
}