summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c42
-rw-r--r--src/char_sql/char.c19
-rw-r--r--src/common/mmo.h5
-rw-r--r--src/login/login.c2
-rw-r--r--src/login_sql/login.c2
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/clif.h8
7 files changed, 46 insertions, 50 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 19b13e5a8..ab4572af4 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -97,6 +97,7 @@ int char_name_option = 0; // Option to know which letters/symbols are authorised
//The following are characters that are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]
#define TRIM_CHARS "\032\t\x0A\x0D "
char char_name_letters[1024] = ""; // list of letters/symbols authorised (or not) in a character name. by [Yor]
+bool char_rename = true;
int log_char = 1; // loggin char or not [devil]
int log_inter = 1; // loggin inter or not [devil]
@@ -1697,25 +1698,20 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus *p)
WBUFW(buf,68) = p->head_mid;
WBUFW(buf,70) = p->hair_color;
WBUFW(buf,72) = p->clothes_color;
-
memcpy(WBUFP(buf,74), p->name, NAME_LENGTH);
-
WBUFB(buf,98) = min(p->str, UCHAR_MAX);
WBUFB(buf,99) = min(p->agi, UCHAR_MAX);
WBUFB(buf,100) = min(p->vit, UCHAR_MAX);
WBUFB(buf,101) = min(p->int_, UCHAR_MAX);
WBUFB(buf,102) = min(p->dex, UCHAR_MAX);
WBUFB(buf,103) = min(p->luk, UCHAR_MAX);
- //Updated packet structure with rename-button included. Credits to Sara-chan
-#if PACKETVER > 7
WBUFW(buf,104) = p->char_num;
- WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
- return 108;
-#else
- WBUFB(buf,104) = p->char_num;
- return 106;
-#endif
-
+ if (char_rename) {
+ WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
+ return 108;
+ } else {
+ return 106;
+ }
}
//----------------------------------------
@@ -1738,18 +1734,14 @@ int mmo_char_send006b(int fd, struct char_session_data *sd)
for(i = found_num; i < MAX_CHARS; i++)
sd->found_char[i] = -1;
-
j = 24;// offset
- {
- WFIFOHEAD(fd,j + found_num*108);
- WFIFOW(fd,0) = 0x6b;
- memset(WFIFOP(fd,4), 0, 20);// unknown bytes
-
- for(i = 0; i < found_num; i++)
- j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status);
- WFIFOW(fd,2) = j;// packet len
- WFIFOSET(fd,j);
- }
+ WFIFOHEAD(fd,j + found_num*108); // or 106(!)
+ WFIFOW(fd,0) = 0x6b;
+ memset(WFIFOP(fd,4), 0, 20);// unknown bytes
+ for(i = 0; i < found_num; i++)
+ j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status);
+ WFIFOW(fd,2) = j;// packet len
+ WFIFOSET(fd,j);
return 0;
}
@@ -3390,7 +3382,7 @@ int parse_char(int fd)
for(i = 0; i < AUTH_FIFO_SIZE && !(
auth_fifo[i].account_id == sd->account_id &&
auth_fifo[i].login_id1 == sd->login_id1 &&
- auth_fifo[i].login_id2 == sd->login_id2 && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == sd->login_id2 &&
auth_fifo[i].ip == session[fd]->client_addr &&
auth_fifo[i].delflag == 2)
; i++);
@@ -3404,7 +3396,7 @@ int parse_char(int fd)
WFIFOW(login_fd,0) = 0x2712; // ask login-server to authentify an account
WFIFOL(login_fd,2) = sd->account_id;
WFIFOL(login_fd,6) = sd->login_id1;
- WFIFOL(login_fd,10) = sd->login_id2; // relate to the versions higher than 18
+ WFIFOL(login_fd,10) = sd->login_id2;
WFIFOB(login_fd,14) = sd->sex;
WFIFOL(login_fd,15) = htonl(session[fd]->client_addr);
WFIFOSET(login_fd,19);
@@ -4158,6 +4150,8 @@ int char_config_read(const char *cfgName)
char_name_option = atoi(w2);
} else if (strcmpi(w1, "char_name_letters") == 0) {
strcpy(char_name_letters, w2);
+ } else if (strcmpi(w1, "char_rename") == 0) {
+ char_rename = config_switch(w2);
// online files options
} else if (strcmpi(w1, "online_txt_filename") == 0) {
strcpy(online_txt_filename, w2);
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index b9abe1038..34883ca83 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -103,6 +103,7 @@ char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the request
char char_name_letters[1024] = ""; // list of letters/symbols used to authorise or not a name of a character. by [Yor]
//The following are characters that are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]
#define TRIM_CHARS "\032\t\x0A\x0D "
+bool char_rename = true;
int char_per_account = 0; //Maximum charas per account (default unlimited) [Sirius]
int char_del_level = 0; //From which level u can delete character [Lupus]
@@ -1605,15 +1606,13 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p)
WBUFB(buf,101) = min(p->int_, UCHAR_MAX);
WBUFB(buf,102) = min(p->dex, UCHAR_MAX);
WBUFB(buf,103) = min(p->luk, UCHAR_MAX);
- //Updated packet structure with rename-button included. Credits to Sara-chan
-#if PACKETVER > 7
WBUFW(buf,104) = p->char_num;
- WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
- return 108;
-#else
- WBUFB(buf,104) = p->char_num;
- return 106;
-#endif
+ if (char_rename) {
+ WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
+ return 108;
+ } else {
+ return 106;
+ }
}
int mmo_char_send006b(int fd, struct char_session_data* sd)
@@ -3083,7 +3082,7 @@ int parse_char(int fd)
for(i = 0; i < AUTH_FIFO_SIZE && !(
auth_fifo[i].account_id == sd->account_id &&
auth_fifo[i].login_id1 == sd->login_id1 &&
- auth_fifo[i].login_id2 == sd->login_id2 && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == sd->login_id2 &&
auth_fifo[i].ip == session[fd]->client_addr &&
auth_fifo[i].delflag == 2)
; i++);
@@ -3908,6 +3907,8 @@ int char_config_read(const char* cfgName)
char_name_option = atoi(w2);
} else if (strcmpi(w1, "char_name_letters") == 0) {
strcpy(char_name_letters, w2);
+ } else if (strcmpi(w1, "char_rename") == 0) {
+ char_rename = config_switch(w2);
} else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]
char_per_account = atoi(w2);
} else if (strcmpi(w1, "char_del_level") == 0) { //disable/enable char deletion by its level condition [Lupus]
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 6012ebbcb..2a42c017c 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -8,11 +8,6 @@
#include "cbasetypes.h"
#include "utils.h" // _WIN32
-// server protocol version
-#ifndef PACKETVER
- #define PACKETVER 8
-#endif
-
#define FIFOSIZE_SERVERLINK 256*1024
//Remove/Comment this line to disable sc_data saving. [Skotlex]
diff --git a/src/login/login.c b/src/login/login.c
index 435ca9073..5940571b9 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1418,7 +1418,7 @@ int parse_fromchar(int fd)
{
if (auth_fifo[i].account_id == RFIFOL(fd,2) &&
auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
- auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == RFIFOL(fd,10) &&
auth_fifo[i].sex == RFIFOB(fd,14) &&
auth_fifo[i].ip == ntohl(RFIFOL(fd,15)) &&
!auth_fifo[i].delflag)
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index d593ce6ca..c8c9496ec 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -782,7 +782,7 @@ int parse_fromchar(int fd)
for(i = 0; i < AUTH_FIFO_SIZE; i++) {
if( auth_fifo[i].account_id == account_id &&
auth_fifo[i].login_id1 == RFIFOL(fd,6) &&
- auth_fifo[i].login_id2 == RFIFOL(fd,10) && // relate to the versions higher than 18
+ auth_fifo[i].login_id2 == RFIFOL(fd,10) &&
auth_fifo[i].sex == RFIFOB(fd,14) &&
auth_fifo[i].ip == ntohl(RFIFOL(fd,15)) &&
!auth_fifo[i].delflag)
diff --git a/src/map/clif.c b/src/map/clif.c
index f9fc08a56..72295dc4c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -776,7 +776,7 @@ static int clif_set0078(struct block_list* bl, unsigned char* buf)
struct map_session_data* sd;
BL_CAST(BL_PC, bl, sd);
-#if PACKETVER > 6
+#if PACKETVER >= 7
memset(buf,0,packet_len(0x22a));
WBUFW(buf,0)=0x22a;
@@ -943,7 +943,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
struct map_session_data* sd;
BL_CAST(BL_PC, bl, sd);
-#if PACKETVER > 6
+#if PACKETVER >= 7
memset(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
@@ -1054,7 +1054,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
#endif
}
//Non-player sprites only require a few fields.
-#if PACKETVER > 6
+#if PACKETVER >= 7
memset(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
@@ -1132,7 +1132,7 @@ static void clif_setdisguise(struct map_session_data *sd, unsigned char *buf,int
{
if (flag) {
WBUFL(buf,2)=sd->bl.id;
-#if PACKETVER > 6
+#if PACKETVER >= 7
switch (WBUFW(buf,0)) {
case 0x22c:
case 0x22b:
@@ -1144,7 +1144,7 @@ static void clif_setdisguise(struct map_session_data *sd, unsigned char *buf,int
#endif
WBUFW(buf,12)=OPTION_INVISIBLE;
WBUFW(buf,14)=sd->status.class_;
-#if PACKETVER > 6
+#if PACKETVER >= 7
break;
}
#endif
@@ -1301,7 +1301,7 @@ int clif_spawn(struct block_list *bl)
clif_setdisguise((TBL_PC*)bl, buf, packet_len(0x1d9), 0);
break;
#endif
-#if PACKETVER > 6
+#if PACKETVER >= 7
case 0x22a: //Convert to 0x22b
WBUFW(buf, 0) = 0x22b;
WBUFW(buf,55) = WBUFW(buf,56); //Lv is placed on offset 56
@@ -3071,7 +3071,7 @@ int clif_changeoption(struct block_list* bl)
sc = status_get_sc(bl);
if (!sc) return 0; //How can an option change if there's no sc?
-#if PACKETVER > 6
+#if PACKETVER >= 7
WBUFW(buf,0) = 0x229;
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = sc->opt1;
@@ -3709,7 +3709,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
ud = unit_bl2ud(bl);
if (ud && ud->walktimer != -1)
{
-#if PACKETVER > 6
+#if PACKETVER >= 7
WFIFOHEAD(fd, packet_len(0x22c));
#elif PACKETVER > 3
WFIFOHEAD(fd, packet_len(0x1da));
@@ -3719,7 +3719,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
len = clif_set007b(bl,vd,ud,WFIFOP(fd,0));
WFIFOSET(fd,len);
} else {
-#if PACKETVER > 6
+#if PACKETVER >= 7
WFIFOHEAD(fd,packet_len(0x22a));
#elif PACKETVER > 3
WFIFOHEAD(fd,packet_len(0x1d8));
diff --git a/src/map/clif.h b/src/map/clif.h
index b91b8d9a7..159c1546a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -6,9 +6,15 @@
#include "map.h"
+// server->client protocol version
+// v7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
+#ifndef PACKETVER
+ #define PACKETVER 7
+#endif
+
// packet DB
#define MAX_PACKET_DB 0x300
-#define MAX_PACKET_VER 21
+#define MAX_PACKET_VER 22
struct packet_db_t {
short len;