summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.c8
-rw-r--r--src/char/config.c12
-rw-r--r--src/char/config.h4
-rw-r--r--src/char/init.c2
4 files changed, 26 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 38c5f42..b0328c6 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -59,6 +59,13 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd)
return;
}
look = RFIFOW(fd, 34);
+ if (look < min_look || look > max_look)
+ {
+ chr->creation_failed(fd, -12);
+ RFIFOSKIP(fd, 31 + 5);
+ hookStop();
+ return;
+ }
}
const int result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd, 2), 1, 1, 1, 1, 1, 1, RFIFOB(fd, 26), RFIFOW(fd, 27), RFIFOW(fd, 29));
@@ -110,6 +117,7 @@ void echar_creation_failed(int *fdPtr, int *result)
case -5: WFIFOB(fd, 2) = 0x02; break; // 'Symbols in Character Names are forbidden'
case -10: WFIFOB(fd, 2) = 0x50; break; // Wrong class
case -11: WFIFOB(fd, 2) = 0x51; break; // Wrong sex
+ case -12: WFIFOB(fd, 2) = 0x52; break; // Wrong look
default:
ShowWarning("chr->parse_char: Unknown result received from chr->make_new_char_sql: %d!\n", *result);
diff --git a/src/char/config.c b/src/char/config.c
index 8665fa6..3454a74 100644
--- a/src/char/config.c
+++ b/src/char/config.c
@@ -16,6 +16,8 @@
char *inter_server_ip = NULL;
int min_char_class = 0;
int max_char_class = 0;
+int min_look = 0;
+int max_look = 0;
void config_inter_server_ip(const char *val)
{
@@ -40,6 +42,16 @@ void config_max_char_class(const char *val)
max_char_class = atoi(val);
}
+void config_min_look(const char *val)
+{
+ min_look = atoi(val);
+}
+
+void config_max_look(const char *val)
+{
+ max_look = atoi(val);
+}
+
void config_final(void)
{
if (inter_server_ip)
diff --git a/src/char/config.h b/src/char/config.h
index fd3792d..d60abc0 100644
--- a/src/char/config.h
+++ b/src/char/config.h
@@ -8,9 +8,13 @@ void config_final(void);
void config_inter_server_ip(const char *val);
void config_min_char_class(const char *val);
void config_max_char_class(const char *val);
+void config_min_look(const char *val);
+void config_max_look(const char *val);
extern char *inter_server_ip;
extern int min_char_class;
extern int max_char_class;
+extern int min_look;
+extern int max_look;
#endif // EVOL_CHAR_CONFIG
diff --git a/src/char/init.c b/src/char/init.c
index 440b81c..e4b5f84 100644
--- a/src/char/init.c
+++ b/src/char/init.c
@@ -74,6 +74,8 @@ HPExport void server_preinit (void)
addCharInterConf("inter_server_ip", config_inter_server_ip);
addCharConf("min_char_class", config_min_char_class);
addCharConf("max_char_class", config_max_char_class);
+ addCharConf("min_cloth_color", config_min_look);
+ addCharConf("max_cloth_color", config_max_look);
}
HPExport void server_online (void)