summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-06-28 00:00:13 +0300
committerAndrei Karas <akaras@inbox.ru>2018-06-29 19:47:42 +0300
commita6f6b34df65d36fb7609b93c2305c8507dc79e8d (patch)
tree565ad0b38e5a1ce9228e57b735777debf26fc747 /src/map
parent6fa931559839564a3ddf21587c2d4322cc28fda4 (diff)
downloadhercules-a6f6b34df65d36fb7609b93c2305c8507dc79e8d.tar.gz
hercules-a6f6b34df65d36fb7609b93c2305c8507dc79e8d.tar.bz2
hercules-a6f6b34df65d36fb7609b93c2305c8507dc79e8d.tar.xz
hercules-a6f6b34df65d36fb7609b93c2305c8507dc79e8d.zip
Add support for new auth error packet in zero.
Add support for known auth error packets in map server (before was used only old packet).
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c23
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h17
3 files changed, 37 insertions, 4 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 7ba070409..dfd49914a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -713,6 +713,7 @@ void clif_authok(struct map_session_data *sd)
clif->send(&p,sizeof(p),&sd->bl,SELF);
}
+/// [4144] Packet not using error_code anymore. Works for fixed error only (MsgString: 9 - Rejected from Server)
/// Notifies the client, that it's connection attempt was refused (ZC_REFUSE_ENTER).
/// 0074 <error code>.B
/// error code:
@@ -9524,6 +9525,22 @@ void clif_channel_msg2(struct channel_data *chan, char *msg)
dbi_destroy(iter);
}
+// TODO: [4144] same packet with login server. need somehow use one function for both servers
+// 3 - Rejected by server
+void clif_auth_error(int fd, int errorCode)
+{
+ struct packet_ZC_REFUSE_LOGIN p;
+ const int len = sizeof(p);
+
+ p.PacketType = authError;
+ p.error_code = errorCode;
+ p.block_date[0] = '\0';
+
+ WFIFOHEAD(fd, len);
+ memcpy(WFIFOP(fd, 0), &p, len);
+ WFIFOSET(fd, len);
+}
+
// ------------
// clif_parse_*
// ------------
@@ -9562,10 +9579,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
bl = map->id2bl(account_id);
if(bl && bl->type != BL_PC) {
ShowError("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n", account_id);
- WFIFOHEAD(fd,packet_len(0x6a));
- WFIFOW(fd,0) = 0x6a;
- WFIFOB(fd,2) = 3; // Rejected by server
- WFIFOSET(fd,packet_len(0x6a));
+ clif->auth_error(fd, 3); // Rejected by server
sockt->eof(fd);
return;
@@ -21365,6 +21379,7 @@ void clif_defaults(void) {
clif->packet = clif_packet;
/* auth */
clif->authok = clif_authok;
+ clif->auth_error = clif_auth_error;
clif->authrefuse = clif_authrefuse;
clif->authfail_fd = clif_authfail_fd;
clif->charselectok = clif_charselectok;
diff --git a/src/map/clif.h b/src/map/clif.h
index e7db9a9b8..63eaeff49 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -698,6 +698,7 @@ struct clif_interface {
unsigned short (*decrypt_cmd) ( int cmd, struct map_session_data *sd );
/* auth */
void (*authok) (struct map_session_data *sd);
+ void (*auth_error) (int fd, int errorCode);
void (*authrefuse) (int fd, uint8 error_code);
void (*authfail_fd) (int fd, int type);
void (*charselectok) (int id, uint8 ok);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index bcdf1061a..f1cb408ba 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -373,6 +373,13 @@ enum packet_headers {
#elif PACKETVER >= 20150128
openUiType = 0xA38,
#endif
+#if PACKETVER_ZERO_NUM >= 20180627
+ authError = 0xb02,
+#elif PACKETVER >= 20101123
+ authError = 0x83e,
+#else
+ authError = 0x6a,
+#endif
};
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
@@ -1774,6 +1781,16 @@ struct PACKET_CZ_PET_EVOLUTION {
// struct pet_evolution_items items[];
} __attribute__((packed));
+struct packet_ZC_REFUSE_LOGIN {
+ int16 PacketType;
+#if PACKETVER >= 20101123
+ uint32 error_code;
+#else
+ uint8 error_code;
+#endif
+ char block_date[20];
+} __attribute__((packed));
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris