summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/chrif.c17
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/map.h1
4 files changed, 24 insertions, 2 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 189b54f71..13e2ccee5 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -15,6 +15,7 @@
#include "../common/core.h"
#include "../common/showmsg.h"
+#include "atcommand.h"
#include "log.h"
#include "clif.h"
#include "chrif.h"
@@ -29,7 +30,6 @@
#include "battle.h"
#include "party.h"
#include "guild.h"
-#include "atcommand.h"
#include "script.h"
#include "npc.h"
#include "trade.h"
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 70dad71ab..485cffbf4 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -38,13 +38,14 @@
//Free Packets: F->2af8
struct dbt *auth_db;
+char *map_server_dns = NULL;
static const int packet_len_table[0x3d] = {
60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff
6,-1,18, 7,-1,49,30,10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07
6,30,-1,10,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, U->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f
0,-1,10, 6,11,-1, 0, 0, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17
- -1,-1,-1,-1,-1,-1,-1, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, F->2b1e, U->2b1f
+ -1,-1,-1,-1,-1,-1,2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, F->2b1e, U->2b1f
-1,-1,-1,-1,-1,-1,-1,-1, // 2b20-2b27: U->2b20, F->2b21, F->2b22, F->2b23, F->2b24, F->2b25, F->2b26, F->2b27
};
@@ -1413,6 +1414,19 @@ int chrif_disconnect(int fd) {
return 0;
}
+void chrif_update_ip(int fd){
+ struct hostent *h = map_server_dns?gethostbyname(map_server_dns):NULL;
+ ShowInfo("IP Sync in progress...\n");
+ if(h){
+ WFIFOW(fd, 0) = 0x2736;
+ WFIFOB(fd, 2) = h->h_addr[0];
+ WFIFOB(fd, 3) = h->h_addr[1];
+ WFIFOB(fd, 4) = h->h_addr[2];
+ WFIFOB(fd, 5) = h->h_addr[3];
+ WFIFOSET(fd, 6);
+ }
+}
+
/*==========================================
*
*------------------------------------------
@@ -1476,6 +1490,7 @@ int chrif_parse(int fd)
case 0x2b15: chrif_recvgmaccounts(fd); break;
case 0x2b1b: chrif_recvfamelist(fd); break;
case 0x2b1d: chrif_load_scdata(fd); break;
+ case 0x2b1e: chrif_update_ip(fd); break;
case 0x2b1f: chrif_disconnectplayer(fd); break;
case 0x2b20: chrif_removemap(fd); break; //Remove maps of a server [Sirius]
diff --git a/src/map/map.c b/src/map/map.c
index 70b9d290e..569c32f26 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3297,6 +3297,10 @@ int map_config_read(char *cfgName) {
} else if (strcmpi(w1, "map_ip") == 0) {
map_ip_set_ = 1;
h = gethostbyname (w2);
+ if(map_server_dns)
+ aFree(map_server_dns);
+ map_server_dns = aCalloc(strlen(w2)+1,1);
+ strcpy(map_server_dns, w2);
if (h != NULL) {
ShowInfo("Map Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'.\n", w2, (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
sprintf(w2, "%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
@@ -3709,6 +3713,8 @@ void do_final(void) {
pc_db->destroy(pc_db, NULL);
charid_db->destroy(charid_db, NULL);
+ if(map_server_dns) aFree(map_server_dns);
+
//#endif
#ifndef TXT_ONLY
diff --git a/src/map/map.h b/src/map/map.h
index 6babe9883..a67a977cc 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1354,6 +1354,7 @@ extern char *GRF_PATH_FILENAME;
extern int charsave_method; //needed ..
+extern char *map_server_dns;
#ifndef TXT_ONLY