diff options
Diffstat (limited to 'src')
161 files changed, 2999 insertions, 2804 deletions
diff --git a/src/char/Makefile.in b/src/char/Makefile.in index fe40621fb..7806ce2bb 100644 --- a/src/char/Makefile.in +++ b/src/char/Makefile.in @@ -51,7 +51,7 @@ CHAR_PH = HAVE_MYSQL=@HAVE_MYSQL@ ifeq ($(HAVE_MYSQL),yes) - CHAR_SERVER_SQL_DEPENDS=$(CHAR_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(SYSINFO_INC) + CHAR_SERVER_SQL_DEPENDS=$(CHAR_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(SYSINFO_INC) else CHAR_SERVER_SQL_DEPENDS=needs_mysql endif @@ -110,8 +110,8 @@ char-server: ../../char-server@EXEEXT@ ../../char-server@EXEEXT@: $(CHAR_SERVER_SQL_DEPENDS) Makefile @echo " LD $(notdir $@)" - @$(CC) @STATIC@ @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) $(COMMON_D)/obj_sql/common_sql.a \ - $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ + @$(CC) @STATIC@ @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a \ + $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ # missing object files $(COMMON_D)/obj_all/common.a: diff --git a/src/char/char.c b/src/char/char.c index 952c3d781..9314e8c81 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -519,7 +519,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) if ( (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || - (p->class_ != cp->class_) || + (p->class != cp->class) || (p->partner_id != cp->partner_id) || (p->father != cp->father) || (p->mother != cp->mother) || (p->child != cp->child) || (p->karma != cp->karma) || (p->manner != cp->manner) || @@ -531,7 +531,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," "`karma`='%d', `manner`='%d', `fame`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", - char_db, p->class_, + char_db, p->class, p->hair, p->hair_color, p->clothes_color, p->body, p->partner_id, p->father, p->mother, p->child, p->karma, p->manner, p->fame, @@ -961,7 +961,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, NULL, NULL) @@ -1072,7 +1072,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, 0, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, NULL, NULL) @@ -1544,7 +1544,7 @@ int char_check_char_name(char * name, char * esc_name) * -5: 'Symbols in Character Names are forbidden' * char_id: Success **/ -int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; @@ -1557,9 +1557,17 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); flag = chr->check_char_name(name,esc_name); - if( flag < 0 ) + if (flag < 0) return flag; + switch (starting_class) { + case JOB_SUMMONER: + case JOB_NOVICE: + break; + default: + return -2; // Char Creation Denied + } + //check other inputs #if PACKETVER >= 20120307 if(slot < 0 || slot >= sd->char_slots) @@ -1580,11 +1588,11 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int return -2; /* character account limit exceeded */ #if PACKETVER >= 20120307 - //Insert the new char entry to the database - if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + // Insert the new char entry to the database + if (SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" - "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", - char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, starting_class, start_zeny, 48, str, agi, vit, int_, dex, luk, (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) ) { @@ -1593,10 +1601,10 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int } #else //Insert the new char entry to the database - if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" - "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", - char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk, + "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, starting_class, start_zeny, str, agi, vit, int_, dex, luk, (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) ) { @@ -1613,9 +1621,9 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int // Validation success, log result if (chr->enable_logs) { if (SQL_ERROR == SQL->Query(inter->sql_handle, - "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" - "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", - charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color)) + "INSERT INTO `%s` (`time`, `char_msg`, `account_id`, `char_id`, `char_num`, `class`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, starting_class, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color)) Sql_ShowDebug(inter->sql_handle); } @@ -1882,7 +1890,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { WBUFW(buf,46) = min(p->sp, INT16_MAX); WBUFW(buf,48) = min(p->max_sp, INT16_MAX); WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed; - WBUFW(buf,52) = p->class_; + WBUFW(buf,52) = p->class; WBUFW(buf,54) = p->hair; #if PACKETVER >= 20141022 WBUFW(buf,56) = p->body; @@ -1945,11 +1953,15 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { } /* Made Possible by Yommy~! <3 */ -void char_mmo_char_send099d(int fd, struct char_session_data *sd) { +void char_mmo_char_send099d(int fd, struct char_session_data *sd) +{ +// support added for client between 20121010 and 20130320 +#if PACKETVER > 20120418 WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF)); WFIFOW(fd,0) = 0x99d; WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; WFIFOSET(fd,WFIFOW(fd,2)); +#endif } /* Sends character ban list */ @@ -2314,33 +2326,33 @@ void char_changesex(int account_id, int sex) * @param sex The new sex (SEX_MALE or SEX_FEMALE). * @param acc The character's account ID. * @param char_id The character ID. - * @param class_ The character's current job class. + * @param class The character's current job class. * @param guild_id The character's guild ID. */ -void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) { // job modification - if (class_ == JOB_BARD || class_ == JOB_DANCER) - class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); - else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) - class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); - else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) - class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); - else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) - class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); - else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) - class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); - else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) - class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); - else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) - class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + if (class == JOB_BARD || class == JOB_DANCER) + class = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class == JOB_CLOWN || class == JOB_GYPSY) + class = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class == JOB_BABY_BARD || class == JOB_BABY_DANCER) + class = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class == JOB_MINSTREL || class == JOB_WANDERER) + class = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class == JOB_MINSTREL_T || class == JOB_WANDERER_T) + class = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class == JOB_BABY_MINSTREL || class == JOB_BABY_WANDERER) + class = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class == JOB_KAGEROU || class == JOB_OBORO) + class = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) Sql_ShowDebug(inter->sql_handle); if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", - char_db, class_, char_id)) + char_db, class, char_id)) Sql_ShowDebug(inter->sql_handle); if (guild_id) // If there is a guild, update the guild_member data [Skotlex] inter_guild->sex_changed(guild_id, acc, char_id, sex); @@ -2348,7 +2360,7 @@ void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id int char_parse_fromlogin_changesex_reply(int fd) { - int char_id = 0, class_ = 0, guild_id = 0; + int char_id = 0, class = 0, guild_id = 0; int i; struct char_auth_node *node; struct SqlStmt *stmt; @@ -2377,11 +2389,11 @@ int char_parse_fromlogin_changesex_reply(int fd) SQL->StmtFree(stmt); } SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, NULL, NULL); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class, 0, NULL, NULL); SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL); for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) { - char_change_sex_sub(sex, acc, char_id, class_, guild_id); + char_change_sex_sub(sex, acc, char_id, class, guild_id); } SQL->StmtFree(stmt); @@ -3359,7 +3371,7 @@ void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) */ int char_changecharsex(int char_id, int sex) { - int class_ = 0, guild_id = 0, account_id = 0; + int class = 0, guild_id = 0, account_id = 0; char *data; // get character data @@ -3372,7 +3384,7 @@ int char_changecharsex(int char_id, int sex) return 1; } SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); - SQL->GetData(inter->sql_handle, 1, &data, NULL); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); class = atoi(data); SQL->GetData(inter->sql_handle, 2, &data, NULL); guild_id = atoi(data); SQL->FreeResult(inter->sql_handle); @@ -3380,7 +3392,7 @@ int char_changecharsex(int char_id, int sex) Sql_ShowDebug(inter->sql_handle); return 1; } - char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + char_change_sex_sub(sex, account_id, char_id, class, guild_id); // disconnect player if online on char-server chr->disconnect_player(account_id); @@ -4621,10 +4633,12 @@ void char_parse_char_create_new_char(int fd, struct char_session_data* sd) //turn character creation on/off [Kevin] result = -2; } else { - #if PACKETVER >= 20120307 - result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + #if PACKETVER >= 20151001 + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26), RFIFOW(fd,27), RFIFOW(fd,29), RFIFOW(fd, 31)); + #elif PACKETVER >= 20120307 + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26), RFIFOW(fd,27), RFIFOW(fd,29), JOB_NOVICE); #else - result = chr->make_new_char_sql(sd, RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), RFIFOB(fd,26), RFIFOB(fd,27), RFIFOB(fd,28), RFIFOB(fd,29), RFIFOB(fd,30), RFIFOB(fd,31), RFIFOB(fd,32), RFIFOW(fd,33), RFIFOW(fd,35), JOB_NOVICE); #endif } @@ -4640,11 +4654,13 @@ void char_parse_char_create_new_char(int fd, struct char_session_data* sd) // add new entry to the chars list sd->found_char[char_dat.slot] = result; // the char_id of the new char } - #if PACKETVER >= 20120307 - RFIFOSKIP(fd,31); - #else - RFIFOSKIP(fd,37); - #endif +#if PACKETVER >= 20151001 + RFIFOSKIP(fd, 36); +#elif PACKETVER >= 20120307 + RFIFOSKIP(fd, 31); +#else + RFIFOSKIP(fd, 37); +#endif } // flag: @@ -5022,17 +5038,22 @@ int char_parse_char(int fd) break; // create new char - #if PACKETVER >= 20120307 +#if PACKETVER >= 20151001 + // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job class ID>.W <Unknown>.(W or 2 B's)??? <sex>.B + case 0xa39: + { + FIFOSD_CHECK(36); +#elif PACKETVER >= 20120307 // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W case 0x970: { FIFOSD_CHECK(31); - #else +#else // S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W case 0x67: { FIFOSD_CHECK(37); - #endif +#endif chr->parse_char_create_new_char(fd, sd); } @@ -5919,7 +5940,7 @@ bool char_config_read_player_new(const char *filename, const struct config_t *co #else const char *start_point_setting = "start_point_pre"; #endif - long long int i64 = 0; // TODO: Temporary until the signature of libconfig->setting_lookup_int64 is changed to take a defined-size int (int64) + int64 i64 = 0; nullpo_retr(false, filename); nullpo_retr(false, config); diff --git a/src/char/char.h b/src/char/char.h index 4dbdfd9db..d7bc96e13 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -147,7 +147,7 @@ struct char_interface { bool (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); int (*rename_char_sql) (struct char_session_data *sd, int char_id); int (*check_char_name) (char * name, char * esc_name); - int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); int (*divorce_char_sql) (int partner_id1, int partner_id2); int (*count_users) (void); int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); diff --git a/src/char/geoip.c b/src/char/geoip.c index 002045850..0b84d2b09 100644 --- a/src/char/geoip.c +++ b/src/char/geoip.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/geoip.h b/src/char/geoip.h index 61ebb535f..c5d71f5e1 100644 --- a/src/char/geoip.h +++ b/src/char/geoip.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 51acb32a6..bf690327c 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_auction.h b/src/char/int_auction.h index ccd5bfbf5..9f0ccbd09 100644 --- a/src/char/int_auction.h +++ b/src/char/int_auction.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h index 9cdd63e7f..8a046b0f8 100644 --- a/src/char/int_elemental.h +++ b/src/char/int_elemental.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_guild.c b/src/char/int_guild.c index dcc1ed7cb..b4b4bdde4 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -251,7 +251,7 @@ int inter_guild_tosql(struct guild *g,int flag) "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%"PRIu64"','%d','%d','%d','%s')", guild_member_db, g->guild_id, m->account_id, m->char_id, m->hair, m->hair_color, m->gender, - m->class_, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) + m->class, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) Sql_ShowDebug(inter->sql_handle); if (m->modified&GS_MEMBER_NEW || new_guild == 1) { @@ -433,7 +433,7 @@ struct guild * inter_guild_fromsql(int guild_id) SQL->GetData(inter->sql_handle, 2, &data, NULL); m->hair = atoi(data); SQL->GetData(inter->sql_handle, 3, &data, NULL); m->hair_color = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); m->gender = atoi(data); - SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class = atoi(data); SQL->GetData(inter->sql_handle, 6, &data, NULL); m->lv = atoi(data); SQL->GetData(inter->sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10); SQL->GetData(inter->sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data); @@ -984,7 +984,7 @@ int mapif_guild_memberinfoshort(struct guild *g, int idx) WBUFL(buf,10)=g->member[idx].char_id; WBUFB(buf,14)=(unsigned char)g->member[idx].online; WBUFW(buf,15)=g->member[idx].lv; - WBUFW(buf,17)=g->member[idx].class_; + WBUFW(buf,17)=g->member[idx].class; mapif->sendall(buf,19); return 0; } @@ -1349,7 +1349,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in } // Change member info -int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) +int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class) { // Could speed up by manipulating only guild_member struct guild * g; @@ -1365,7 +1365,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, { g->member[i].online = online; g->member[i].lv = lv; - g->member[i].class_ = class_; + g->member[i].class = class; g->member[i].modified = GS_MEMBER_MODIFIED; mapif->guild_memberinfoshort(g,i); } @@ -1602,7 +1602,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int } case GMI_CLASS: { - g->member[i].class_ = *(const short *)data; + g->member[i].class = *(const int16 *)data; g->member[i].modified = GS_MEMBER_MODIFIED; mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 252c2dc47..93bf6c699 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_homun.h b/src/char/int_homun.h index e070cccb6..7ea7331f2 100644 --- a/src/char/int_homun.h +++ b/src/char/int_homun.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_mail.c b/src/char/int_mail.c index bf3403b5f..10f905a0d 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_mail.h b/src/char/int_mail.h index 346adeea7..cb72db504 100644 --- a/src/char/int_mail.h +++ b/src/char/int_mail.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h index 17cc97fda..3b1623438 100644 --- a/src/char/int_mercenary.h +++ b/src/char/int_mercenary.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_party.c b/src/char/int_party.c index e2be9f3ca..2fc39c328 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -89,7 +89,7 @@ static void inter_party_calc_state(struct party_data *p) // FIXME[Haru]: What if the occupied positions aren't the first three? It can happen if some party members leave. This is the reason why family sharing some times stops working until you recreate your party if( p->size == 2 && ( chr->char_child(p->party.member[0].char_id,p->party.member[1].char_id) || chr->char_child(p->party.member[1].char_id,p->party.member[0].char_id) ) ) { //Child should be able to share with either of their parents [RoM] - if(p->party.member[0].class_&JOBL_BABY) //first slot is the child? + if (p->party.member[0].class >= JOB_BABY && p->party.member[0].class <= JOB_SUPER_BABY) //first slot is the child? p->family = p->party.member[0].char_id; else p->family = p->party.member[1].char_id; @@ -252,7 +252,7 @@ struct party_data *inter_party_fromsql(int party_id) SQL->GetData(inter->sql_handle, 3, &data, NULL); m->lv = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); m->map = mapindex->name2id(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0); - SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class = atoi(data); m->leader = (m->account_id == leader_id && m->char_id == leader_char ? 1 : 0); } SQL->FreeResult(inter->sql_handle); diff --git a/src/char/int_party.h b/src/char/int_party.h index 62fef4192..77363dd45 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_pet.h b/src/char/int_pet.h index 3eb19d656..13291e226 100644 --- a/src/char/int_pet.h +++ b/src/char/int_pet.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_quest.c b/src/char/int_quest.c index 7b3d746dd..bd49cb7d4 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_quest.h b/src/char/int_quest.h index 8d5cd5807..737213fff 100644 --- a/src/char/int_quest.h +++ b/src/char/int_quest.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_storage.c b/src/char/int_storage.c index e46a1c80f..8e3ebdff3 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 3c48c00ec..8c6341e85 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/inter.c b/src/char/inter.c index 05f2bf4f6..d076bb657 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -168,9 +168,9 @@ void inter_do_final_msg(void) aFree(msg_table[i]); } /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */ -const char* inter_job_name(int class_) +const char* inter_job_name(int class) { - switch (class_) { + switch (class) { case JOB_NOVICE: // 550 case JOB_SWORDMAN: // 551 case JOB_MAGE: // 552 @@ -178,7 +178,7 @@ const char* inter_job_name(int class_) case JOB_ACOLYTE: // 554 case JOB_MERCHANT: // 555 case JOB_THIEF: // 556 - return inter->msg_txt(550 - JOB_NOVICE+class_); + return inter->msg_txt(550 - JOB_NOVICE + class); case JOB_KNIGHT: // 557 case JOB_PRIEST: // 558 @@ -186,7 +186,7 @@ const char* inter_job_name(int class_) case JOB_BLACKSMITH: // 560 case JOB_HUNTER: // 561 case JOB_ASSASSIN: // 562 - return inter->msg_txt(557 - JOB_KNIGHT+class_); + return inter->msg_txt(557 - JOB_KNIGHT + class); case JOB_KNIGHT2: return inter->msg_txt(557); @@ -198,7 +198,7 @@ const char* inter_job_name(int class_) case JOB_ALCHEMIST: // 567 case JOB_BARD: // 568 case JOB_DANCER: // 569 - return inter->msg_txt(563 - JOB_CRUSADER+class_); + return inter->msg_txt(563 - JOB_CRUSADER + class); case JOB_CRUSADER2: return inter->msg_txt(563); @@ -208,7 +208,7 @@ const char* inter_job_name(int class_) case JOB_GUNSLINGER: // 572 case JOB_NINJA: // 573 case JOB_XMAS: // 574 - return inter->msg_txt(570 - JOB_WEDDING+class_); + return inter->msg_txt(570 - JOB_WEDDING + class); case JOB_SUMMER: return inter->msg_txt(621); @@ -220,7 +220,7 @@ const char* inter_job_name(int class_) case JOB_ACOLYTE_HIGH: // 579 case JOB_MERCHANT_HIGH: // 580 case JOB_THIEF_HIGH: // 581 - return inter->msg_txt(575 - JOB_NOVICE_HIGH+class_); + return inter->msg_txt(575 - JOB_NOVICE_HIGH + class); case JOB_LORD_KNIGHT: // 582 case JOB_HIGH_PRIEST: // 583 @@ -228,7 +228,7 @@ const char* inter_job_name(int class_) case JOB_WHITESMITH: // 585 case JOB_SNIPER: // 586 case JOB_ASSASSIN_CROSS: // 587 - return inter->msg_txt(582 - JOB_LORD_KNIGHT+class_); + return inter->msg_txt(582 - JOB_LORD_KNIGHT + class); case JOB_LORD_KNIGHT2: return inter->msg_txt(582); @@ -240,7 +240,7 @@ const char* inter_job_name(int class_) case JOB_CREATOR: // 592 case JOB_CLOWN: // 593 case JOB_GYPSY: // 594 - return inter->msg_txt(588 - JOB_PALADIN + class_); + return inter->msg_txt(588 - JOB_PALADIN + class); case JOB_PALADIN2: return inter->msg_txt(588); @@ -252,7 +252,7 @@ const char* inter_job_name(int class_) case JOB_BABY_ACOLYTE: // 599 case JOB_BABY_MERCHANT: // 600 case JOB_BABY_THIEF: // 601 - return inter->msg_txt(595 - JOB_BABY + class_); + return inter->msg_txt(595 - JOB_BABY + class); case JOB_BABY_KNIGHT: // 602 case JOB_BABY_PRIEST: // 603 @@ -260,7 +260,7 @@ const char* inter_job_name(int class_) case JOB_BABY_BLACKSMITH: // 605 case JOB_BABY_HUNTER: // 606 case JOB_BABY_ASSASSIN: // 607 - return inter->msg_txt(602 - JOB_BABY_KNIGHT + class_); + return inter->msg_txt(602 - JOB_BABY_KNIGHT + class); case JOB_BABY_KNIGHT2: return inter->msg_txt(602); @@ -272,7 +272,7 @@ const char* inter_job_name(int class_) case JOB_BABY_ALCHEMIST: // 612 case JOB_BABY_BARD: // 613 case JOB_BABY_DANCER: // 614 - return inter->msg_txt(608 - JOB_BABY_CRUSADER + class_); + return inter->msg_txt(608 - JOB_BABY_CRUSADER + class); case JOB_BABY_CRUSADER2: return inter->msg_txt(608); @@ -291,7 +291,7 @@ const char* inter_job_name(int class_) case JOB_GANGSI: // 622 case JOB_DEATH_KNIGHT: // 623 case JOB_DARK_COLLECTOR: // 624 - return inter->msg_txt(622 - JOB_GANGSI+class_); + return inter->msg_txt(622 - JOB_GANGSI + class); case JOB_RUNE_KNIGHT: // 625 case JOB_WARLOCK: // 626 @@ -299,7 +299,7 @@ const char* inter_job_name(int class_) case JOB_ARCH_BISHOP: // 628 case JOB_MECHANIC: // 629 case JOB_GUILLOTINE_CROSS: // 630 - return inter->msg_txt(625 - JOB_RUNE_KNIGHT+class_); + return inter->msg_txt(625 - JOB_RUNE_KNIGHT + class); case JOB_RUNE_KNIGHT_T: // 656 case JOB_WARLOCK_T: // 657 @@ -307,7 +307,7 @@ const char* inter_job_name(int class_) case JOB_ARCH_BISHOP_T: // 659 case JOB_MECHANIC_T: // 660 case JOB_GUILLOTINE_CROSS_T: // 661 - return inter->msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); + return inter->msg_txt(656 - JOB_RUNE_KNIGHT_T + class); case JOB_ROYAL_GUARD: // 631 case JOB_SORCERER: // 632 @@ -316,7 +316,7 @@ const char* inter_job_name(int class_) case JOB_SURA: // 635 case JOB_GENETIC: // 636 case JOB_SHADOW_CHASER: // 637 - return inter->msg_txt(631 - JOB_ROYAL_GUARD+class_); + return inter->msg_txt(631 - JOB_ROYAL_GUARD + class); case JOB_ROYAL_GUARD_T: // 662 case JOB_SORCERER_T: // 663 @@ -325,7 +325,7 @@ const char* inter_job_name(int class_) case JOB_SURA_T: // 666 case JOB_GENETIC_T: // 667 case JOB_SHADOW_CHASER_T: // 668 - return inter->msg_txt(662 - JOB_ROYAL_GUARD_T+class_); + return inter->msg_txt(662 - JOB_ROYAL_GUARD_T + class); case JOB_RUNE_KNIGHT2: return inter->msg_txt(625); @@ -364,7 +364,7 @@ const char* inter_job_name(int class_) case JOB_BABY_SURA: // 648 case JOB_BABY_GENETIC: // 649 case JOB_BABY_CHASER: // 650 - return inter->msg_txt(638 - JOB_BABY_RUNE+class_); + return inter->msg_txt(638 - JOB_BABY_RUNE + class); case JOB_BABY_RUNE2: return inter->msg_txt(638); @@ -380,15 +380,18 @@ const char* inter_job_name(int class_) case JOB_SUPER_NOVICE_E: // 651 case JOB_SUPER_BABY_E: // 652 - return inter->msg_txt(651 - JOB_SUPER_NOVICE_E+class_); + return inter->msg_txt(651 - JOB_SUPER_NOVICE_E + class); case JOB_KAGEROU: // 653 case JOB_OBORO: // 654 - return inter->msg_txt(653 - JOB_KAGEROU+class_); + return inter->msg_txt(653 - JOB_KAGEROU + class); case JOB_REBELLION: return inter->msg_txt(655); + case JOB_SUMMONER: + return inter->msg_txt(669); + default: return inter->msg_txt(620); // "Unknown Job" } @@ -474,18 +477,18 @@ void mapif_parse_accinfo(int fd) } else {// more than one, listing... [Dekamaster/Nightroad] inter->msg_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(inter->sql_handle)); while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { - int class_; + int class; int base_level, job_level, online; char name[NAME_LENGTH]; SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - SQL->GetData(inter->sql_handle, 2, &data, NULL); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); class = atoi(data); SQL->GetData(inter->sql_handle, 3, &data, NULL); base_level = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); job_level = atoi(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); online = atoi(data); - inter->msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class_), base_level, job_level, online?"Online":"Offline"); + inter->msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class), base_level, job_level, online?"Online":"Offline"); } SQL->FreeResult(inter->sql_handle); return; @@ -546,19 +549,19 @@ void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int acc } else { while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char *data; - int char_id, class_; + int char_id, class; int char_num, base_level, job_level, online; char name[NAME_LENGTH]; SQL->GetData(inter->sql_handle, 0, &data, NULL); char_id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); SQL->GetData(inter->sql_handle, 2, &data, NULL); char_num = atoi(data); - SQL->GetData(inter->sql_handle, 3, &data, NULL); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); class = atoi(data); SQL->GetData(inter->sql_handle, 4, &data, NULL); base_level = atoi(data); SQL->GetData(inter->sql_handle, 5, &data, NULL); job_level = atoi(data); SQL->GetData(inter->sql_handle, 6, &data, NULL); online = atoi(data); - inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class_), base_level, job_level, online?"On":"Off"); + inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class), base_level, job_level, online?"On":"Off"); } } SQL->FreeResult(inter->sql_handle); diff --git a/src/char/inter.h b/src/char/inter.h index dbbc6f4e8..796f89a96 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -39,7 +39,7 @@ struct inter_interface { const char* (*msg_txt) (int msg_number); bool (*msg_config_read) (const char *cfg_name, bool allow_override); void (*do_final_msg) (void); - const char* (*job_name) (int class_); + const char* (*job_name) (int class); void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string); diff --git a/src/char/loginif.c b/src/char/loginif.c index 1e457fcca..b0e18eb1f 100644 --- a/src/char/loginif.c +++ b/src/char/loginif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/loginif.h b/src/char/loginif.h index d1bfe5c3c..daafdf4ac 100644 --- a/src/char/loginif.h +++ b/src/char/loginif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/char/mapif.c b/src/char/mapif.c index 91bfd884c..1dafb79c3 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -89,7 +89,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const stru int mapif_parse_GuildInfo(int fd, int guild_id); int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m); int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); -int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); +int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class); int mapif_parse_BreakGuild(int fd, int guild_id); int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len); int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len); diff --git a/src/char/mapif.h b/src/char/mapif.h index 37d9444e2..ebbddead0 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +83,7 @@ struct mapif_interface { int (*parse_GuildInfo) (int fd, int guild_id); int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); - int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class); int (*parse_BreakGuild) (int fd, int guild_id); int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); diff --git a/src/common/HPM.c b/src/common/HPM.c index dbe121940..c84b447e8 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -103,6 +103,7 @@ void hplugin_export_symbol(void *value, const char *name) void *hplugin_import_symbol(char *name, unsigned int pID) { int i; + nullpo_retr(NULL, name); ARR_FIND(0, VECTOR_LENGTH(HPM->symbols), i, strcmp(VECTOR_INDEX(HPM->symbols, i)->name, name) == 0); if (i != VECTOR_LENGTH(HPM->symbols)) @@ -133,6 +134,7 @@ bool hplugin_iscompatible(char* version) { bool hplugin_exists(const char *filename) { int i; + nullpo_retr(false, filename); for (i = 0; i < VECTOR_LENGTH(HPM->plugins); i++) { if (strcmpi(VECTOR_INDEX(HPM->plugins, i)->filename,filename) == 0) return true; @@ -259,6 +261,7 @@ void hplugins_addToHPData(enum HPluginDataTypes type, uint32 pluginID, struct hp return; } store = *storeptr; + nullpo_retv(store); /* duplicate check */ ARR_FIND(0, VECTOR_LENGTH(store->entries), i, VECTOR_INDEX(store->entries, i)->pluginID == pluginID && VECTOR_INDEX(store->entries, i)->classid == classid); @@ -447,7 +450,8 @@ bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *na return true; } -struct hplugin *hplugin_load(const char* filename) { +struct hplugin *hplugin_load(const char* filename) +{ struct hplugin *plugin; struct hplugin_info *info; struct HPMi_interface **HPMi; @@ -563,6 +567,7 @@ struct hplugin *hplugin_load(const char* filename) { /* id */ plugin->hpi->pid = plugin->idx; /* core */ + plugin->hpi->memmgr = HPMiMalloc; #ifdef CONSOLE_INPUT plugin->hpi->addCPCommand = console->input->addCommand; #endif // CONSOLE_INPUT @@ -596,6 +601,7 @@ struct hplugin *hplugin_load(const char* filename) { void hplugin_unload(struct hplugin* plugin) { int i; + nullpo_retv(plugin); if (plugin->filename) aFree(plugin->filename); if (plugin->dll) @@ -622,7 +628,8 @@ CMDLINEARG(loadplugin) /** * Reads the plugin configuration and loads the plugins as necessary. */ -void hplugins_config_read(void) { +void hplugins_config_read(void) +{ struct config_t plugins_conf; struct config_setting_t *plist = NULL; const char *config_filename = "conf/plugins.conf"; // FIXME hardcoded name @@ -788,6 +795,7 @@ const char *HPM_file2ptr(const char *file) { int i; + nullpo_retr(NULL, file); ARR_FIND(0, HPM->filenames.count, i, HPM->filenames.data[i].addr == file); if (i != HPM->filenames.count) { return HPM->filenames.data[i].name; @@ -801,19 +809,29 @@ const char *HPM_file2ptr(const char *file) return HPM->filenames.data[i].name; } -void* HPM_mmalloc(size_t size, const char *file, int line, const char *func) { + +void* HPM_mmalloc(size_t size, const char *file, int line, const char *func) +{ return iMalloc->malloc(size,HPM_file2ptr(file),line,func); } -void* HPM_calloc(size_t num, size_t size, const char *file, int line, const char *func) { + +void* HPM_calloc(size_t num, size_t size, const char *file, int line, const char *func) +{ return iMalloc->calloc(num,size,HPM_file2ptr(file),line,func); } -void* HPM_realloc(void *p, size_t size, const char *file, int line, const char *func) { + +void* HPM_realloc(void *p, size_t size, const char *file, int line, const char *func) +{ return iMalloc->realloc(p,size,HPM_file2ptr(file),line,func); } -void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char *func) { + +void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char *func) +{ return iMalloc->reallocz(p,size,HPM_file2ptr(file),line,func); } -char* HPM_astrdup(const char *p, const char *file, int line, const char *func) { + +char* HPM_astrdup(const char *p, const char *file, int line, const char *func) +{ return iMalloc->astrdup(p,HPM_file2ptr(file),line,func); } @@ -849,6 +867,7 @@ bool hplugins_get_battle_conf(const char *w1, int *value) { int i; + nullpo_retr(false, w1); nullpo_retr(false, value); ARR_FIND(0, VECTOR_LENGTH(HPM->config_listeners[HPCT_BATTLE]), i, strcmpi(w1, VECTOR_INDEX(HPM->config_listeners[HPCT_BATTLE], i).key) == 0); @@ -880,7 +899,7 @@ bool hplugins_parse_conf(const struct config_t *config, const char *filename, en for (i = 0; i < VECTOR_LENGTH(HPM->config_listeners[point]); i++) { const struct HPConfListenStorage *entry = &VECTOR_INDEX(HPM->config_listeners[point], i); const char *config_name = entry->key; - const char *str = buf; + const char *str = NULL; if ((setting = libconfig->lookup(config, config_name)) == NULL) { if (!imported && entry->required) { ShowWarning("Missing configuration '%s' in file %s!\n", config_name, filename); @@ -1012,9 +1031,11 @@ void hplugin_data_store_create(struct hplugin_data_store **storeptr, enum HPlugi /** * Called by HPM->DataCheck on a plugins incoming data, ensures data structs in use are matching! **/ -bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, char *name) { +bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, char *name) +{ unsigned int i, j; + nullpo_retr(false, src); if (version != datacheck_version) { ShowError("HPMDataCheck:%s: DataCheck API version mismatch %d != %d\n", name, datacheck_version, version); return false; @@ -1039,7 +1060,8 @@ bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, c return true; } -void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, int version) { +void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, int version) +{ unsigned int i; datacheck_version = version; @@ -1055,11 +1077,13 @@ void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, i } } -void HPM_datacheck_final(void) { +void HPM_datacheck_final(void) +{ db_destroy(datacheck_db); } -void hpm_init(void) { +void hpm_init(void) +{ int i; datacheck_db = NULL; datacheck_data = NULL; @@ -1070,8 +1094,8 @@ void hpm_init(void) { HPM->off = false; - memcpy(&iMalloc_HPM, iMalloc, sizeof(struct malloc_interface)); HPMiMalloc = &iMalloc_HPM; + *HPMiMalloc = *iMalloc; HPMiMalloc->malloc = HPM_mmalloc; HPMiMalloc->calloc = HPM_calloc; HPMiMalloc->realloc = HPM_realloc; @@ -1151,6 +1175,7 @@ void hpm_final(void) return; } + void hpm_defaults(void) { HPM = &HPM_s; diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index d0e23811c..0a4af75dd 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2016 Hercules Dev Team + * Copyright (C) 2014-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 7ccb960de..d4a103b88 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,9 +155,6 @@ struct loginif_interface *loginif; #ifdef MAP_MAIL_H /* mail */ struct mail_interface *mail; #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -struct malloc_interface *iMalloc; -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ struct map_interface *map; #endif // MAP_MAP_H @@ -405,9 +402,6 @@ if ((server_type&(SERVER_TYPE_CHAR)) && !HPM_SYMBOL("loginif", loginif)) return #ifdef MAP_MAIL_H /* mail */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mail", mail)) return "mail"; #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("iMalloc", iMalloc)) return "iMalloc"; -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("map", map)) return "map"; #endif // MAP_MAP_H diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 19b9b20a5..143c325c1 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -231,6 +231,7 @@ struct HPMi_interface { /* Hooking */ struct HPMHooking_interface *hooking; + struct malloc_interface *memmgr; }; #ifdef HERCULES_CORE #define HPM_SYMBOL(n, s) (HPM->share((s), (n)), true) diff --git a/src/common/atomic.h b/src/common/atomic.h index 82d579bf4..b370052a9 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) rAthena Project (www.rathena.org) * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 98c3552c4..2c36c23bc 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,6 +109,14 @@ # define __attribute__(x) #endif +/// Feature/extension checking macros +#ifndef __has_extension /* Available in clang and gcc >= 3 */ +#define __has_extension(x) 0 +#endif +#ifndef __has_feature /* Available in clang and gcc >= 5 */ +#define __has_feature(x) __has_extension(x) +#endif + ////////////////////////////////////////////////////////////////////////// // portable printf/scanf format macros and integer definitions // NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty @@ -441,4 +449,23 @@ typedef char bool; /** Support macros for marking structs as unavailable */ #define UNAVAILABLE_STRUCT int8 HERC__unavailable_struct +/** Static assertion (only on compilers that support it) */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +// C11 version +#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg) +#elif __has_feature(c_static_assert) +// Clang support (as per http://clang.llvm.org/docs/LanguageExtensions.html) +#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg) +#elif defined(__GNUC__) && GCC_VERSION >= 40700 +// GCC >= 4.7 is known to support it +#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg) +#elif defined(_MSC_VER) +// MSVC doesn't support it, but it accepts the C++ style version +#define STATIC_ASSERT(ex, msg) static_assert(ex, msg) +#else +// Otherise just ignore it until it's supported +#define STATIC_ASSERT(ex, msg) +#endif + + #endif /* COMMON_CBASETYPES_H */ diff --git a/src/common/conf.c b/src/common/conf.c index 9188affa4..96b9bff9f 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -373,6 +373,80 @@ int config_lookup_mutable_string(const struct config_t *config, const char *name return CONFIG_FALSE; } +/** + * Wrapper for config_setting_get_int64() using defined-size variables + * + * @see config_setting_get_int64_real() + */ +int64 config_setting_get_int64_real(const struct config_setting_t *setting) +{ + return (int64)config_setting_get_int64(setting); +} + +/** + * Wrapper for config_setting_lookup_int64() using defined-size variables + * + * @see config_setting_lookup_int64() + */ +int config_setting_lookup_int64_real(const struct config_setting_t *setting, const char *name, int64 *value) +{ + long long int lli = 0; + + if (config_setting_lookup_int64(setting, name, &lli) != CONFIG_TRUE) + return CONFIG_FALSE; + + *value = (int64)lli; + + return CONFIG_TRUE; +} + +/** + * Wrapper for config_setting_set_int64() using defined-size variables + * + * @see config_setting_set_int64() + */ +int config_setting_set_int64_real(struct config_setting_t *setting, int64 value) +{ + return config_setting_set_int64(setting, (long long int)value); +} + +/** + * Wrapper for config_setting_get_int64_elem() using defined-size variables + * + * @see config_setting_get_int64_elem() + */ +int64 config_setting_get_int64_elem_real(const struct config_setting_t *setting, int idx) +{ + return (int64)config_setting_get_int64_elem(setting, idx); +} + +/** + * Wrapper for config_setting_set_int64_elem() using defined-size variables + * + * @see config_setting_set_int64_elem() + */ +struct config_setting_t *config_setting_set_int64_elem_real(struct config_setting_t *setting, int idx, int64 value) +{ + return config_setting_set_int64_elem(setting, idx, (long long int)value); +} + +/** + * Wrapper for config_lookup_int64() using defined-size variables + * + * @see config_lookup_int64() + */ +int config_lookup_int64_real(const struct config_t *config, const char *filepath, int64 *value) +{ + long long int lli = 0; + + if (config_lookup_int64(config, filepath, &lli) != CONFIG_TRUE) + return CONFIG_FALSE; + + *value = (int64)lli; + + return CONFIG_TRUE; +} + void libconfig_defaults(void) { libconfig = &libconfig_s; @@ -393,20 +467,20 @@ void libconfig_defaults(void) { libconfig->destroy = config_destroy; /* */ libconfig->setting_get_int = config_setting_get_int; - libconfig->setting_get_int64 = config_setting_get_int64; + libconfig->setting_get_int64 = config_setting_get_int64_real; libconfig->setting_get_float = config_setting_get_float; libconfig->setting_get_bool = config_setting_get_bool; libconfig->setting_get_string = config_setting_get_string; /* */ libconfig->setting_lookup = config_setting_lookup; libconfig->setting_lookup_int = config_setting_lookup_int; - libconfig->setting_lookup_int64 = config_setting_lookup_int64; + libconfig->setting_lookup_int64 = config_setting_lookup_int64_real; libconfig->setting_lookup_float = config_setting_lookup_float; libconfig->setting_lookup_bool = config_setting_lookup_bool; libconfig->setting_lookup_string = config_setting_lookup_string; /* */ libconfig->setting_set_int = config_setting_set_int; - libconfig->setting_set_int64 = config_setting_set_int64; + libconfig->setting_set_int64 = config_setting_set_int64_real; libconfig->setting_set_float = config_setting_set_float; libconfig->setting_set_bool = config_setting_set_bool; libconfig->setting_set_string = config_setting_set_string; @@ -415,13 +489,13 @@ void libconfig_defaults(void) { libconfig->setting_get_format = config_setting_get_format; /* */ libconfig->setting_get_int_elem = config_setting_get_int_elem; - libconfig->setting_get_int64_elem = config_setting_get_int64_elem; + libconfig->setting_get_int64_elem = config_setting_get_int64_elem_real; libconfig->setting_get_float_elem = config_setting_get_float_elem; libconfig->setting_get_bool_elem = config_setting_get_bool_elem; libconfig->setting_get_string_elem = config_setting_get_string_elem; /* */ libconfig->setting_set_int_elem = config_setting_set_int_elem; - libconfig->setting_set_int64_elem = config_setting_set_int64_elem; + libconfig->setting_set_int64_elem = config_setting_set_int64_elem_real; libconfig->setting_set_float_elem = config_setting_set_float_elem; libconfig->setting_set_bool_elem = config_setting_set_bool_elem; libconfig->setting_set_string_elem = config_setting_set_string_elem; @@ -441,7 +515,7 @@ void libconfig_defaults(void) { libconfig->lookup = config_lookup; /* */ libconfig->lookup_int = config_lookup_int; - libconfig->lookup_int64 = config_lookup_int64; + libconfig->lookup_int64 = config_lookup_int64_real; libconfig->lookup_float = config_lookup_float; libconfig->lookup_bool = config_lookup_bool; libconfig->lookup_string = config_lookup_string; diff --git a/src/common/conf.h b/src/common/conf.h index f2bfcac62..bd6acc4be 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ struct libconfig_interface { void (*destroy) (struct config_t *config); int (*setting_get_int) (const struct config_setting_t *setting); - long long (*setting_get_int64) (const struct config_setting_t *setting); + int64 (*setting_get_int64) (const struct config_setting_t *setting); double (*setting_get_float) (const struct config_setting_t *setting); int (*setting_get_bool) (const struct config_setting_t *setting); @@ -55,12 +55,12 @@ struct libconfig_interface { struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); - int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, int64 *value); int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); - int (*setting_set_int) (struct config_setting_t *setting ,int value); - int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_int) (struct config_setting_t *setting, int value); + int (*setting_set_int64) (struct config_setting_t *setting, int64 value); int (*setting_set_float) (struct config_setting_t *setting, double value); int (*setting_set_bool) (struct config_setting_t *setting, int value); int (*setting_set_string) (struct config_setting_t *setting, const char *value); @@ -69,12 +69,12 @@ struct libconfig_interface { short (*setting_get_format) (const struct config_setting_t *setting); int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); - long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + int64 (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); - struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, int64 value); struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); @@ -93,7 +93,7 @@ struct libconfig_interface { struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); - int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, int64 *value); int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); diff --git a/src/common/console.c b/src/common/console.c index f1b4523e2..0f79b9494 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -68,7 +68,8 @@ struct { /*====================================== * CORE : Display title *--------------------------------------*/ -void display_title(void) { +void display_title(void) +{ const char *vcstype = sysinfo->vcstype(); ShowMessage("\n"); @@ -99,7 +100,7 @@ void display_title(void) { */ void display_gplnotice(void) { - ShowInfo("Hercules, Copyright (C) 2012-2015, Hercules Dev Team and others.\n"); + ShowInfo("Hercules, Copyright (C) 2012-2016, Hercules Dev Team and others.\n"); ShowInfo("Licensed under the GNU General Public License, version 3 or later.\n"); } @@ -130,21 +131,24 @@ int console_parse_key_pressed(void) /** * Stops server **/ -CPCMD_C(exit,server) { +CPCMD_C(exit, server) +{ core->runflag = 0; } /** * Displays ERS-related statistics (Entry Reusage System) **/ -CPCMD_C(ers_report,server) { +CPCMD_C(ers_report, server) +{ ers_report(); } /** * Displays memory usage **/ -CPCMD_C(mem_report,server) { +CPCMD_C(mem_report, server) +{ #ifdef USE_MEMMGR memmgr_report(line?atoi(line):0); #endif @@ -171,7 +175,8 @@ CPCMD(help) * [Ind/Hercules] * Displays current malloc usage */ -CPCMD_C(malloc_usage,server) { +CPCMD_C(malloc_usage, server) +{ unsigned int val = (unsigned int)iMalloc->usage(); ShowInfo("malloc_usage: %.2f MB\n",(double)(val)/1024); } @@ -180,7 +185,8 @@ CPCMD_C(malloc_usage,server) { * Skips an sql update * Usage: sql update skip UPDATE-FILE.sql **/ -CPCMD_C(skip,update) { +CPCMD_C(skip, update) +{ if( !line ) { ShowDebug("usage example: sql update skip 2013-02-14--16-15.sql\n"); return; @@ -311,6 +317,7 @@ void console_parse_create(char *name, CParseFunc func) char sublist[CP_CMD_LENGTH * 5]; struct CParseEntry *cmd; + nullpo_retv(name); safestrncpy(sublist, name, CP_CMD_LENGTH * 5); tok = strtok(sublist,":"); @@ -364,6 +371,7 @@ void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) { int i; char msg[CP_CMD_LENGTH * 2]; + nullpo_retv(cmd); Assert_retv(cmd->type == CPET_CATEGORY); for (i = 0; i < VECTOR_LENGTH(cmd->u.children); i++) { struct CParseEntry *child = VECTOR_INDEX(cmd->u.children, i); @@ -391,6 +399,7 @@ void console_parse_sub(char *line) char sublist[CP_CMD_LENGTH * 5]; int i; + nullpo_retv(line); memcpy(bline, line, 200); tok = strtok(line, " "); @@ -444,9 +453,12 @@ void console_parse_sub(char *line) } ShowError("Is only a category, type '"CL_WHITE"%s help"CL_RESET"' to list its subcommands\n",sublist); } -void console_parse(char* line) { + +void console_parse(char *line) +{ int c, i = 0, len = MAX_CONSOLE_INPUT - 1;/* we leave room for the \0 :P */ + nullpo_retv(line); while( (c = fgetc(stdin)) != EOF ) { if( --len == 0 ) break; @@ -458,7 +470,9 @@ void console_parse(char* line) { line[i++] = '\0'; } -void *cThread_main(void *x) { + +void *cThread_main(void *x) +{ while( console->input->ptstate ) {/* loopx */ if( console->input->key_pressed() ) { char input[MAX_CONSOLE_INPUT]; @@ -483,7 +497,9 @@ void *cThread_main(void *x) { return NULL; } -int console_parse_timer(int tid, int64 tick, int id, intptr_t data) { + +int console_parse_timer(int tid, int64 tick, int id, intptr_t data) +{ int i; EnterSpinLock(console->input->ptlock); for(i = 0; i < cinput.count; i++) { @@ -494,7 +510,9 @@ int console_parse_timer(int tid, int64 tick, int id, intptr_t data) { mutex->cond_signal(console->input->ptcond); return 0; } -void console_parse_final(void) { + +void console_parse_final(void) +{ if( console->input->ptstate ) { InterlockedDecrement(&console->input->ptstate); mutex->cond_signal(console->input->ptcond); @@ -506,7 +524,9 @@ void console_parse_final(void) { mutex->destroy(console->input->ptmutex); } } -void console_parse_init(void) { + +void console_parse_init(void) +{ cinput.count = 0; console->input->ptstate = 1; @@ -524,6 +544,7 @@ void console_parse_init(void) { timer->add_func_list(console->input->parse_timer, "console_parse_timer"); timer->add_interval(timer->gettick() + 1000, console->input->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */ } + void console_setSQL(struct Sql *SQL_handle) { console->input->SQL = SQL_handle; diff --git a/src/common/core.c b/src/common/core.c index 63123dfea..9a131d042 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -100,7 +100,8 @@ struct core_interface *core = &core_s; #ifndef POSIX #define compat_signal(signo, func) signal((signo), (func)) #else -sigfunc *compat_signal(int signo, sigfunc *func) { +sigfunc *compat_signal(int signo, sigfunc *func) +{ struct sigaction sact, oact; sact.sa_handler = func; @@ -121,7 +122,8 @@ sigfunc *compat_signal(int signo, sigfunc *func) { * CORE : Console events for Windows *--------------------------------------*/ #ifdef _WIN32 -static BOOL WINAPI console_handler(DWORD c_event) { +static BOOL WINAPI console_handler(DWORD c_event) +{ switch(c_event) { case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: @@ -137,7 +139,8 @@ static BOOL WINAPI console_handler(DWORD c_event) { return TRUE; } -static void cevents_init(void) { +static void cevents_init(void) +{ if (SetConsoleCtrlHandler(console_handler,TRUE)==FALSE) ShowWarning ("Unable to install the console handler!\n"); } @@ -146,7 +149,8 @@ static void cevents_init(void) { /*====================================== * CORE : Signal Sub Function *--------------------------------------*/ -static void sig_proc(int sn) { +static void sig_proc(int sn) +{ static int is_called = 0; switch (sn) { @@ -179,7 +183,8 @@ static void sig_proc(int sn) { } } -void signals_init (void) { +void signals_init (void) +{ compat_signal(SIGTERM, sig_proc); compat_signal(SIGINT, sig_proc); #ifndef _DEBUG // need unhandled exceptions to debug on Windows @@ -245,7 +250,8 @@ bool usercheck(void) return true; } -void core_defaults(void) { +void core_defaults(void) +{ nullpo_defaults(); #ifndef MINICORE hpm_defaults(); @@ -271,16 +277,20 @@ void core_defaults(void) { thread_defaults(); #endif } + /** * Returns the source (core or plugin name) for the given command-line argument */ -const char *cmdline_arg_source(struct CmdlineArgData *arg) { +const char *cmdline_arg_source(struct CmdlineArgData *arg) +{ #ifdef MINICORE return "core"; #else // !MINICORE + nullpo_retr(NULL, arg); return HPM->pid2name(arg->pluginID); #endif // MINICORE } + /** * Defines a command line argument. * @@ -292,9 +302,11 @@ const char *cmdline_arg_source(struct CmdlineArgData *arg) { * @param options options associated to the command-line argument. @see enum cmdline_options. * @return the success status. */ -bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options) { +bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options) +{ struct CmdlineArgData *data = NULL; + nullpo_retr(false, name); VECTOR_ENSURE(cmdline->args_data, 1, 1); VECTOR_PUSHZEROED(cmdline->args_data); data = &VECTOR_LAST(cmdline->args_data); @@ -310,6 +322,7 @@ bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, Cm return true; } + /** * Help screen to be displayed by '--help'. */ @@ -333,6 +346,7 @@ static CMDLINEARG(help) } return false; } + /** * Info screen to be displayed by '--version'. */ @@ -343,6 +357,7 @@ static CMDLINEARG(version) ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n"); return false; } + /** * Checks if there is a value available for the current argument * @@ -360,6 +375,7 @@ bool cmdline_arg_next_value(const char *name, int current_arg, int argc) return true; } + /** * Executes the command line arguments handlers. * @@ -381,11 +397,15 @@ bool cmdline_arg_next_value(const char *name, int current_arg, int argc) int cmdline_exec(int argc, char **argv, unsigned int options) { int count = 0, i; + + nullpo_ret(argv); for (i = 1; i < argc; i++) { int j; struct CmdlineArgData *data = NULL; const char *arg = argv[i]; if (arg[0] != '-') { // All arguments must begin with '-' + if ((options&(CMDLINE_OPT_SILENT|CMDLINE_OPT_PREINIT)) != 0) + continue; ShowError("Invalid option '%s'.\n", argv[i]); exit(EXIT_FAILURE); } @@ -423,6 +443,7 @@ int cmdline_exec(int argc, char **argv, unsigned int options) } return count; } + /** * Defines the global command-line arguments. */ @@ -466,10 +487,12 @@ void cmdline_defaults(void) cmdline->arg_next_value = cmdline_arg_next_value; cmdline->arg_source = cmdline_arg_source; } + /*====================================== * CORE : MAINROUTINE *--------------------------------------*/ -int main (int argc, char **argv) { +int main (int argc, char **argv) +{ int retval = EXIT_SUCCESS; {// initialize program arguments char *p1 = SERVER_NAME = argv[0]; diff --git a/src/common/core.h b/src/common/core.h index 4aaa6cfac..a8726fcef 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/db.c b/src/common/db.c index 0c7bc2ae0..91592fdac 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -93,6 +93,7 @@ #include "common/ers.h" #include "common/memmgr.h" #include "common/mmo.h" +#include "common/nullpo.h" #include "common/showmsg.h" #include "common/strlib.h" @@ -2795,7 +2796,8 @@ void *db_data2ptr(struct DBData *data) * @public * @see #db_final(void) */ -void db_init(void) { +void db_init(void) +{ db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); ers_chunk_size(db_alloc_ers, 50); @@ -2907,7 +2909,7 @@ void db_final(void) } // Link DB System - jAthena -void linkdb_insert( struct linkdb_node** head, void *key, void* data) +void linkdb_insert(struct linkdb_node **head, void *key, void *data) { struct linkdb_node *node; if( head == NULL ) return ; @@ -2928,7 +2930,8 @@ void linkdb_insert( struct linkdb_node** head, void *key, void* data) node->data = data; } -void linkdb_vforeach( struct linkdb_node** head, LinkDBFunc func, va_list ap) { +void linkdb_vforeach(struct linkdb_node **head, LinkDBFunc func, va_list ap) +{ struct linkdb_node *node; if( head == NULL ) return; node = *head; @@ -2941,14 +2944,15 @@ void linkdb_vforeach( struct linkdb_node** head, LinkDBFunc func, va_list ap) { } } -void linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ...) { +void linkdb_foreach(struct linkdb_node **head, LinkDBFunc func, ...) +{ va_list ap; va_start(ap, func); linkdb_vforeach(head, func, ap); va_end(ap); } -void* linkdb_search( struct linkdb_node** head, void *key) +void* linkdb_search(struct linkdb_node **head, void *key) { int n = 0; struct linkdb_node *node; @@ -2973,7 +2977,7 @@ void* linkdb_search( struct linkdb_node** head, void *key) return NULL; } -void* linkdb_erase( struct linkdb_node** head, void *key) +void* linkdb_erase(struct linkdb_node **head, void *key) { struct linkdb_node *node; if( head == NULL ) return NULL; @@ -2995,7 +2999,7 @@ void* linkdb_erase( struct linkdb_node** head, void *key) return NULL; } -void linkdb_replace( struct linkdb_node** head, void *key, void *data ) +void linkdb_replace(struct linkdb_node **head, void *key, void *data) { int n = 0; struct linkdb_node *node; @@ -3022,7 +3026,7 @@ void linkdb_replace( struct linkdb_node** head, void *key, void *data ) linkdb_insert( head, key, data ); } -void linkdb_final( struct linkdb_node** head ) +void linkdb_final(struct linkdb_node **head) { struct linkdb_node *node, *node2; if( head == NULL ) return ; @@ -3034,7 +3038,9 @@ void linkdb_final( struct linkdb_node** head ) } *head = NULL; } -void db_defaults(void) { + +void db_defaults(void) +{ DB = &DB_s; DB->alloc = db_alloc; DB->custom_release = db_custom_release; @@ -3055,5 +3061,4 @@ void db_defaults(void) { DB->ui2key = db_ui2key; DB->i642key = db_i642key; DB->ui642key = db_ui642key; - } diff --git a/src/common/db.h b/src/common/db.h index 1c0955221..2918e5acb 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1114,7 +1114,11 @@ HPShared struct db_interface *DB; * @param _vec Vector. */ #define VECTOR_INIT(_vec) \ - memset(&(_vec), 0, sizeof(_vec)) + do { \ + VECTOR_DATA(_vec) = NULL; \ + VECTOR_CAPACITY(_vec) = 0; \ + VECTOR_LENGTH(_vec) = 0; \ + } while(false) /** * Returns the internal array of values. @@ -1220,12 +1224,11 @@ HPShared struct db_interface *DB; */ #define VECTOR_ENSURE(_vec, _n, _step) \ do { \ - int _empty_ = VECTOR_CAPACITY(_vec)-VECTOR_LENGTH(_vec); \ - if ((_n) > _empty_) { \ - while ((_n) > _empty_) \ - _empty_ += (_step); \ - VECTOR_RESIZE(_vec, _empty_+VECTOR_LENGTH(_vec)); \ - } \ + int _newcapacity_ = VECTOR_CAPACITY(_vec); \ + while ((_n) + VECTOR_LENGTH(_vec) > _newcapacity_) \ + _newcapacity_ += (_step); \ + if (_newcapacity_ > VECTOR_CAPACITY(_vec)) \ + VECTOR_RESIZE(_vec, _newcapacity_); \ } while(false) /** diff --git a/src/common/des.c b/src/common/des.c index c680610e9..73297ab70 100644 --- a/src/common/des.c +++ b/src/common/des.c @@ -23,6 +23,7 @@ #include "des.h" #include "common/cbasetypes.h" +#include "common/nullpo.h" /** @file * Implementation of the des interface. @@ -54,6 +55,7 @@ static void des_IP(struct des_bit64 *src) struct des_bit64 tmp = {{0}}; int i; + nullpo_retv(src); for(i = 0; i < ARRAYLENGTH(ip_table); ++i) { uint8_t j = ip_table[i] - 1; if (src->b[(j >> 3) & 7] & mask[j & 7]) @@ -81,6 +83,7 @@ static void des_FP(struct des_bit64 *src) struct des_bit64 tmp = {{0}}; int i; + nullpo_retv(src); for (i = 0; i < ARRAYLENGTH(fp_table); ++i) { uint8_t j = fp_table[i] - 1; if (src->b[(j >> 3) & 7] & mask[j & 7]) @@ -119,6 +122,7 @@ static void des_E(struct des_bit64 *src) tmp.b[i / 6 + 0] |= mask[i % 6]; } #endif + nullpo_retv(src); // optimized tmp.b[0] = ((src->b[7]<<5) | (src->b[4]>>3)) & 0x3f; // ..0 vutsr tmp.b[1] = ((src->b[4]<<1) | (src->b[5]>>7)) & 0x3f; // ..srqpo n @@ -150,6 +154,7 @@ static void des_TP(struct des_bit64 *src) struct des_bit64 tmp = {{0}}; int i; + nullpo_retv(src); for (i = 0; i < ARRAYLENGTH(tp_table); ++i) { uint8_t j = tp_table[i] - 1; if (src->b[(j >> 3) + 0] & mask[j & 7]) @@ -194,6 +199,7 @@ static void des_SBOX(struct des_bit64 *src) struct des_bit64 tmp = {{0}}; int i; + nullpo_retv(src); for (i = 0; i < ARRAYLENGTH(s_table); ++i) { tmp.b[i] = (s_table[i][src->b[i*2+0]] & 0xf0) | (s_table[i][src->b[i*2+1]] & 0x0f); @@ -214,6 +220,7 @@ static void des_RoundFunction(struct des_bit64 *src) des_SBOX(&tmp); des_TP(&tmp); + nullpo_retv(src); src->b[0] ^= tmp.b[4]; src->b[1] ^= tmp.b[5]; src->b[2] ^= tmp.b[6]; diff --git a/src/common/ers.c b/src/common/ers.c index 8970fefc2..f2256cf30 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -149,7 +149,8 @@ static struct ers_instance_t *InstanceList = NULL; /** * @param Options the options from the instance seeking a cache, we use it to give it a cache with matching configuration **/ -static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) { +static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) +{ ers_cache_t *cache; for (cache = CacheList; cache; cache = cache->Next) @@ -187,6 +188,7 @@ static void ers_free_cache(ers_cache_t *cache, bool remove) { unsigned int i; + nullpo_retv(cache); for (i = 0; i < cache->Used; i++) aFree(cache->Blocks[i]); @@ -307,7 +309,8 @@ static void ers_obj_destroy(ERS *self) aFree(instance); } -void ers_cache_size(ERS *self, unsigned int new_size) { +void ers_cache_size(ERS *self, unsigned int new_size) +{ struct ers_instance_t *instance = (struct ers_instance_t *)self; nullpo_retv(instance); @@ -319,10 +322,11 @@ void ers_cache_size(ERS *self, unsigned int new_size) { instance->Cache->ChunkSize = new_size; } - ERS *ers_new(uint32 size, char *name, enum ERSOptions options) { struct ers_instance_t *instance; + + nullpo_retr(NULL, name); CREATE(instance,struct ers_instance_t, 1); size += sizeof(struct ers_list); @@ -359,7 +363,8 @@ ERS *ers_new(uint32 size, char *name, enum ERSOptions options) return &instance->VTable; } -void ers_report(void) { +void ers_report(void) +{ ers_cache_t *cache; unsigned int cache_c = 0, blocks_u = 0, blocks_a = 0, memory_b = 0, memory_t = 0; #ifdef DEBUG @@ -403,7 +408,8 @@ void ers_report(void) { /** * Call on shutdown to clear remaining entries **/ -void ers_final(void) { +void ers_final(void) +{ struct ers_instance_t *instance = InstanceList, *next; while( instance ) { diff --git a/src/common/ers.h b/src/common/ers.h index 1689345dc..5f9516ad6 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/grfio.c b/src/common/grfio.c index 0a9708f17..fba3dda86 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -86,11 +86,13 @@ struct grfio_interface *grfio; // little endian char array to uint conversion static unsigned int getlong(unsigned char *p) { + nullpo_ret(p); return (p[0] << 0 | p[1] << 8 | p[2] << 16 | p[3] << 24); } static void NibbleSwap(unsigned char *src, int len) { + nullpo_retv(src); while (len > 0) { *src = (*src >> 4) | (*src << 4); ++src; @@ -135,6 +137,7 @@ static void grf_shuffle_enc(struct des_bit64 *src) { struct des_bit64 out; + nullpo_retv(src); out.b[0] = src->b[3]; out.b[1] = src->b[4]; out.b[2] = src->b[5]; @@ -152,6 +155,7 @@ static void grf_shuffle_dec(struct des_bit64 *src) { struct des_bit64 out; + nullpo_retv(src); out.b[0] = src->b[3]; out.b[1] = src->b[4]; out.b[2] = src->b[6]; @@ -175,6 +179,7 @@ static void grf_decode_header(unsigned char *buf, size_t len) struct des_bit64 *p = (struct des_bit64 *)buf; size_t nblocks = len / sizeof(struct des_bit64); size_t i; + nullpo_retv(buf); // first 20 blocks are all des-encrypted for (i = 0; i < 20 && i < nblocks; ++i) @@ -197,6 +202,7 @@ static void grf_decode_full(unsigned char *buf, size_t len, int cycle) int dcycle, scycle; size_t i, j; + nullpo_retv(buf); // first 20 blocks are all des-encrypted for (i = 0; i < 20 && i < nblocks; ++i) des->decrypt_block(&p[i]); @@ -314,6 +320,7 @@ static void hashinit(void) static int grf_filehash(const char *fname) { uint32 hash = 0; + nullpo_ret(fname); while (*fname != '\0') { hash = (hash<<1) + (hash>>7)*9 + TOLOWER(*fname); fname++; @@ -396,7 +403,9 @@ static struct grf_filelist *grfio_filelist_add(struct grf_filelist *entry) */ static struct grf_filelist *grfio_filelist_modify(struct grf_filelist *entry) { - struct grf_filelist *fentry = grfio_filelist_find(entry->fn); + struct grf_filelist *fentry; + nullpo_retr(NULL, entry); + fentry = grfio_filelist_find(entry->fn); if (fentry != NULL) { int tmp = fentry->next; memcpy(fentry, entry, sizeof(struct grf_filelist)); @@ -434,6 +443,7 @@ static void grfio_localpath_create(char *buffer, size_t size, const char *filena int i; size_t len; + nullpo_retv(buffer); len = strlen(data_dir); if (data_dir[0] == '\0' || data_dir[len-1] == '/' || data_dir[len-1] == '\\') @@ -553,6 +563,7 @@ void *grfio_reads(const char *fname, int *size) static char *grfio_decode_filename(unsigned char *buf, int len) { int i; + nullpo_retr(NULL, buf); for (i = 0; i < len; i += 8) { NibbleSwap(&buf[i],8); des->decrypt(&buf[i],8); @@ -568,7 +579,9 @@ static char *grfio_decode_filename(unsigned char *buf, int len) */ static bool grfio_is_full_encrypt(const char *fname) { - const char *ext = strrchr(fname, '.'); + const char *ext; + nullpo_retr(false, fname); + ext = strrchr(fname, '.'); if (ext != NULL) { static const char *extensions[] = { ".gnd", ".gat", ".act", ".str" }; int i; @@ -594,8 +607,10 @@ static int grfio_entryread(const char *grfname, int gentry) unsigned char grf_header[0x2e] = { 0 }; int entry,entrys,ofs,grf_version; unsigned char *grf_filelist; + FILE *fp; - FILE *fp = fopen(grfname, "rb"); + nullpo_retr(1, grfname); + fp = fopen(grfname, "rb"); if (fp == NULL) { ShowWarning("GRF data file not found: '%s'\n", grfname); return 1; // 1:not found error @@ -764,6 +779,7 @@ static bool grfio_parse_restable_row(const char *row) char local[256]; struct grf_filelist *entry = NULL; + nullpo_retr(false, row); if (sscanf(row, "%255[^#\r\n]#%255[^#\r\n]#", w1, w2) != 2) return false; @@ -854,6 +870,7 @@ static void grfio_resourcecheck(void) */ static int grfio_add(const char *fname) { + nullpo_retr(1, fname); if (gentry_entrys >= gentry_maxentry) { #define GENTRY_ADDS 4 // The number increment of gentry_table entries gentry_maxentry += GENTRY_ADDS; @@ -899,6 +916,7 @@ void grfio_init(const char *fname) FILE *data_conf; int grf_num = 0; + nullpo_retv(fname); hashinit(); // hash table initialization data_conf = fopen(fname, "r"); diff --git a/src/common/mapindex.c b/src/common/mapindex.c index 5b0f6169b..e16eb4216 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ #include "common/cbasetypes.h" #include "common/db.h" #include "common/mmo.h" +#include "common/nullpo.h" #include "common/showmsg.h" #include "common/strlib.h" @@ -37,11 +38,14 @@ struct mapindex_interface *mapindex; /// Retrieves the map name from 'string' (removing .gat extension if present). /// Result gets placed either into 'buf' or in a static local buffer. -const char* mapindex_getmapname(const char* string, char* output) { +const char* mapindex_getmapname(const char* string, char* output) +{ static char buf[MAP_NAME_LENGTH]; char* dest = (output != NULL) ? output : buf; - size_t len = strnlen(string, MAP_NAME_LENGTH_EXT); + size_t len; + nullpo_retr(buf, string); + len = strnlen(string, MAP_NAME_LENGTH_EXT); if (len == MAP_NAME_LENGTH_EXT) { ShowWarning("(mapindex_normalize_name) Map name '%*s' is too long!\n", 2*MAP_NAME_LENGTH_EXT, string); len--; @@ -58,12 +62,15 @@ const char* mapindex_getmapname(const char* string, char* output) { /// Retrieves the map name from 'string' (adding .gat extension if not already present). /// Result gets placed either into 'buf' or in a static local buffer. -const char* mapindex_getmapname_ext(const char* string, char* output) { +const char* mapindex_getmapname_ext(const char* string, char* output) +{ static char buf[MAP_NAME_LENGTH_EXT]; char* dest = (output != NULL) ? output : buf; size_t len; + nullpo_retr(buf, string); + safestrncpy(buf,string, sizeof(buf)); sscanf(string, "%*[^#]%*[#]%15s", buf); @@ -87,7 +94,8 @@ const char* mapindex_getmapname_ext(const char* string, char* output) { /// Adds a map to the specified index /// Returns 1 if successful, 0 otherwise -int mapindex_addmap(int index, const char* name) { +int mapindex_addmap(int index, const char* name) +{ char map_name[MAP_NAME_LENGTH]; if (index == -1){ @@ -128,7 +136,8 @@ int mapindex_addmap(int index, const char* name) { return index; } -unsigned short mapindex_name2id(const char* name) { +unsigned short mapindex_name2id(const char* name) +{ int i; char map_name[MAP_NAME_LENGTH]; @@ -141,7 +150,8 @@ unsigned short mapindex_name2id(const char* name) { return 0; } -const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const char *func) { +const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const char *func) +{ if (id >= MAX_MAPINDEX || !mapindex_exists(id)) { ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line); return mapindex->list[0].name; // dummy empty string so that the callee doesn't crash @@ -149,7 +159,8 @@ const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const ch return mapindex->list[id].name; } -int mapindex_init(void) { +int mapindex_init(void) +{ FILE *fp; char line[1024]; int last_index = -1; @@ -196,16 +207,20 @@ bool mapindex_check_default(void) return true; } -void mapindex_removemap(int index){ +void mapindex_removemap(int index) +{ + Assert_retv(index < MAX_MAPINDEX); strdb_remove(mapindex->db, mapindex->list[index].name); mapindex->list[index].name[0] = '\0'; } -void mapindex_final(void) { +void mapindex_final(void) +{ db_destroy(mapindex->db); } -void mapindex_defaults(void) { +void mapindex_defaults(void) +{ mapindex = &mapindex_s; /* TODO: place it in inter-server.conf? */ diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 0ebbeb04b..91f59aeaf 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/md5calc.c b/src/common/md5calc.c index bd6b48f10..d2fc32371 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -168,16 +168,15 @@ static void md5_Round_Calculate(const unsigned char *block, } /// @copydoc md5_interface::binary() -static void md5_string2binary(const char *string, unsigned char *output) +static void md5_buf2binary(const uint8 *buf, const int buf_size, uint8 *output) { //var /*8bit*/ unsigned char padding_message[64]; //Extended message 512bit 64byte - const unsigned char *pstring; // The position of string in the present scanning notes is held. + const uint8 *pbuf; // The position of string in the present scanning notes is held. /*32bit*/ - unsigned int string_byte_len, //The byte chief of string is held. - string_bit_len, //The bit length of string is held. + unsigned int buf_bit_len, //The bit length of string is held. copy_len, //The number of bytes which is used by 1-3 and which remained msg_digest[4]; //Message digest 128bit 4byte unsigned int *A = &msg_digest[0], //The message digest in accordance with RFC (reference) @@ -195,16 +194,15 @@ static void md5_string2binary(const char *string, unsigned char *output) //Step 1.Append Padding Bits (extension of a mark bit) //1-1 - string_byte_len = (unsigned int)strlen(string); //The byte chief of a character sequence is acquired. - pstring = (const unsigned char *)string; // The position of the present character sequence is set. + pbuf = buf; // The position of the present character sequence is set. //1-2 Repeat calculation until length becomes less than 64 bytes. - for (i=string_byte_len; 64<=i; i-=64,pstring+=64) - md5_Round_Calculate(pstring, A,B,C,D); + for (i=buf_size; 64<=i; i-=64,pbuf+=64) + md5_Round_Calculate(pbuf, A,B,C,D); //1-3 - copy_len = string_byte_len % 64; //The number of bytes which remained is computed. - strncpy((char *)padding_message, (const char *)pstring, copy_len); // A message is copied to an extended bit sequence. + copy_len = buf_size % 64; //The number of bytes which remained is computed. + strncpy((char *)padding_message, (const char *)pbuf, copy_len); // A message is copied to an extended bit sequence. memset(padding_message+copy_len, 0, 64 - copy_len); //It buries by 0 until it becomes extended bit length. padding_message[copy_len] |= 0x80; //The next of a message is 1. @@ -216,12 +214,12 @@ static void md5_string2binary(const char *string, unsigned char *output) } //Step 2.Append Length (the information on length is added) - string_bit_len = string_byte_len * 8; //From the byte chief to bit length (32 bytes of low rank) - memcpy(&padding_message[56], &string_bit_len, 4); //32 bytes of low rank is set. + buf_bit_len = buf_size * 8; //From the byte chief to bit length (32 bytes of low rank) + memcpy(&padding_message[56], &buf_bit_len, 4); //32 bytes of low rank is set. //When bit length cannot be expressed in 32 bytes of low rank, it is a beam raising to a higher rank. - if (UINT_MAX / 8 < string_byte_len) { - unsigned int high = (string_byte_len - UINT_MAX / 8) * 8; + if (UINT_MAX / 8 < (unsigned int)buf_size) { + unsigned int high = (buf_size - UINT_MAX / 8) * 8; memcpy(&padding_message[60], &high, 4); } else { memset(&padding_message[60], 0, 4); //In this case, it is good for a higher rank at 0. @@ -237,12 +235,12 @@ static void md5_string2binary(const char *string, unsigned char *output) /// @copydoc md5_interface::string() void md5_string(const char *string, char *output) { - unsigned char digest[16]; + uint8 digest[16]; nullpo_retv(string); nullpo_retv(output); - md5->binary(string,digest); + md5->binary((const uint8 *)string, (int)strlen(string), digest); snprintf(output, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[ 0], digest[ 1], digest[ 2], digest[ 3], digest[ 4], digest[ 5], digest[ 6], digest[ 7], @@ -267,7 +265,7 @@ void md5_salt(int len, char *output) void md5_defaults(void) { md5 = &md5_s; - md5->binary = md5_string2binary; + md5->binary = md5_buf2binary; md5->string = md5_string; md5->salt = md5_salt; } diff --git a/src/common/md5calc.h b/src/common/md5calc.h index b4d4995f9..f55ebe312 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -46,7 +46,7 @@ struct md5_interface { * @param[in] string The source string. * @param[out] output Output buffer (at least 16 bytes available). */ - void (*binary) (const char *string, unsigned char *output); + void (*binary) (const uint8 *buf, const int buf_size, uint8 *output); /** * Generates a random salt. diff --git a/src/common/memmgr.c b/src/common/memmgr.c index dfea24465..b80b4d4e9 100644 --- a/src/common/memmgr.c +++ b/src/common/memmgr.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/memmgr.h b/src/common/memmgr.h index 680947466..6381c5bfa 100644 --- a/src/common/memmgr.h +++ b/src/common/memmgr.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -101,8 +101,10 @@ struct malloc_interface { void malloc_defaults(void); void memmgr_report(int extra); -#endif // HERCULES_CORE HPShared struct malloc_interface *iMalloc; +#else +#define iMalloc HPMi->memmgr +#endif // HERCULES_CORE #endif /* COMMON_MEMMGR_H */ diff --git a/src/common/mmo.h b/src/common/mmo.h index 77f706f0d..9c29b8a0e 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -131,7 +131,7 @@ #define MAX_FAME 1000000000 #define MAX_CART 100 #ifndef MAX_SKILL -#define MAX_SKILL 1478 +#define MAX_SKILL 1510 #endif #ifndef MAX_SKILL_ID #define MAX_SKILL_ID 10015 // [Ind/Hercules] max used skill ID @@ -259,12 +259,12 @@ // The following system marks a different job ID system used by the map server, // which makes a lot more sense than the normal one. [Skotlex] // These marks the "level" of the job. -#define JOBL_2_1 0x100 //256 -#define JOBL_2_2 0x200 //512 -#define JOBL_2 0x300 -#define JOBL_UPPER 0x1000 //4096 -#define JOBL_BABY 0x2000 //8192 -#define JOBL_THIRD 0x4000 //16384 +#define JOBL_2_1 0x0100 +#define JOBL_2_2 0x0200 +#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2 +#define JOBL_UPPER 0x1000 +#define JOBL_BABY 0x2000 +#define JOBL_THIRD 0x4000 #define SCRIPT_VARNAME_LENGTH 32 ///< Maximum length of a script variable @@ -566,7 +566,7 @@ struct mmo_charstatus { int zeny; int bank_vault; - short class_; + int16 class; int status_point, skill_point; int hp,max_hp,sp,max_sp; unsigned int option; @@ -670,7 +670,7 @@ struct party_member { int account_id; int char_id; char name[NAME_LENGTH]; - unsigned short class_; + int16 class; unsigned short map; unsigned short lv; unsigned leader : 1, @@ -689,7 +689,9 @@ struct party { struct map_session_data; struct guild_member { int account_id, char_id; - short hair,hair_color,gender,class_,lv; + short hair,hair_color,gender; + int16 class; + short lv; uint64 exp; int exp_payper; short online,position; @@ -777,6 +779,7 @@ struct fame_list { }; enum fame_list_type { + RANKTYPE_UNKNOWN = -1, RANKTYPE_BLACKSMITH = 0, RANKTYPE_ALCHEMIST = 1, RANKTYPE_TAEKWON = 2, @@ -993,6 +996,8 @@ enum { JOB_OBORO, JOB_REBELLION = 4215, + JOB_SUMMONER = 4218, + #ifndef JOB_MAX JOB_MAX, #endif diff --git a/src/common/mutex.c b/src/common/mutex.c index bdc2fb4dc..464a54161 100644 --- a/src/common/mutex.c +++ b/src/common/mutex.c @@ -24,6 +24,7 @@ #include "common/cbasetypes.h" // for WIN32 #include "common/memmgr.h" +#include "common/nullpo.h" #include "common/showmsg.h" #include "common/timer.h" @@ -84,6 +85,7 @@ struct mutex_data *mutex_create(void) /// @copydoc mutex_interface::destroy() void mutex_destroy(struct mutex_data *m) { + nullpo_retv(m); #ifdef WIN32 DeleteCriticalSection(&m->hMutex); #else @@ -96,6 +98,7 @@ void mutex_destroy(struct mutex_data *m) /// @copydoc mutex_interface::lock() void mutex_lock(struct mutex_data *m) { + nullpo_retv(m); #ifdef WIN32 EnterCriticalSection(&m->hMutex); #else @@ -106,6 +109,7 @@ void mutex_lock(struct mutex_data *m) /// @copydoc mutex_interface::trylock() bool mutex_trylock(struct mutex_data *m) { + nullpo_retr(false, m); #ifdef WIN32 if (TryEnterCriticalSection(&m->hMutex) != FALSE) return true; @@ -119,6 +123,7 @@ bool mutex_trylock(struct mutex_data *m) /// @copydoc mutex_interface::unlock() void mutex_unlock(struct mutex_data *m) { + nullpo_retv(m); #ifdef WIN32 LeaveCriticalSection(&m->hMutex); #else @@ -152,6 +157,7 @@ struct cond_data *cond_create(void) /// @copydoc mutex_interface::cond_destroy() void cond_destroy(struct cond_data *c) { + nullpo_retv(c); #ifdef WIN32 CloseHandle(c->events[EVENT_COND_SIGNAL]); CloseHandle(c->events[EVENT_COND_BROADCAST]); @@ -171,6 +177,7 @@ void cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) int result; bool is_last = false; + nullpo_retv(c); EnterCriticalSection(&c->waiters_lock); c->nWaiters++; LeaveCriticalSection(&c->waiters_lock); @@ -201,6 +208,7 @@ void cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) mutex->lock(m); #else + nullpo_retv(m); if (timeout_ticks < 0) { pthread_cond_wait(&c->hCond, &m->hMutex); } else { @@ -221,6 +229,7 @@ void cond_signal(struct cond_data *c) #ifdef WIN32 # if 0 bool has_waiters = false; + nullpo_retv(c); EnterCriticalSection(&c->waiters_lock); if(c->nWaiters > 0) has_waiters = true; @@ -230,6 +239,7 @@ void cond_signal(struct cond_data *c) # endif // 0 SetEvent(c->events[EVENT_COND_SIGNAL]); #else + nullpo_retv(c); pthread_cond_signal(&c->hCond); #endif } @@ -240,6 +250,7 @@ void cond_broadcast(struct cond_data *c) #ifdef WIN32 # if 0 bool has_waiters = false; + nullpo_retv(c); EnterCriticalSection(&c->waiters_lock); if(c->nWaiters > 0) has_waiters = true; @@ -249,6 +260,7 @@ void cond_broadcast(struct cond_data *c) # endif // 0 SetEvent(c->events[EVENT_COND_BROADCAST]); #else + nullpo_retv(c); pthread_cond_broadcast(&c->hCond); #endif } diff --git a/src/common/nullpo.c b/src/common/nullpo.c index 5b1be14ea..6525793bf 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 098e669f3..28d058dc0 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/showmsg.c b/src/common/showmsg.c index d8864684d..23679e762 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 303c8dd28..eee6b467b 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/socket.c b/src/common/socket.c index ea7bfab40..d4b8bb43f 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -520,7 +520,8 @@ void flush_fifos(void) /*====================================== * CORE : Connection functions *--------------------------------------*/ -int connect_client(int listen_fd) { +int connect_client(int listen_fd) +{ int fd; struct sockaddr_in client_address; socklen_t len; @@ -647,7 +648,8 @@ int make_listen_bind(uint32 ip, uint16 port) return fd; } -int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) { +int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) +{ struct sockaddr_in remote_address = { 0 }; int fd; int result; @@ -817,9 +819,12 @@ int rfifoskip(int fd, size_t len) int wfifoset(int fd, size_t len) { size_t newreserve; - struct socket_data* s = sockt->session[fd]; + struct socket_data* s; - if (!sockt->session_is_valid(fd) || s->wdata == NULL) + if (!sockt->session_is_valid(fd)) + return 0; + s = sockt->session[fd]; + if (s == NULL || s->wdata == NULL) return 0; // we have written len bytes to the buffer already before calling WFIFOSET @@ -1018,10 +1023,6 @@ int do_sockets(int next) } } -#ifdef __clang_analyzer__ - // Let Clang's static analyzer know this never happens (it thinks it might because of a NULL check in session_is_valid) - if (!sockt->session[i]) continue; -#endif // __clang_analyzer__ sockt->session[i]->func_parse(i); if(!sockt->session[i]) @@ -1199,7 +1200,8 @@ static int connect_check_(uint32 ip) /// Timer function. /// Deletes old connection history records. -static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) { +static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) +{ int clear = 0; int list = 0; struct connect_history *hist = NULL; @@ -1235,6 +1237,9 @@ int access_ipmask(const char *str, struct access_control *acc) uint32 ip; uint32 mask; + nullpo_ret(str); + nullpo_ret(acc); + if( strcmp(str,"all") == 0 ) { ip = 0; mask = 0; @@ -1736,9 +1741,11 @@ bool session_is_active(int fd) } // Resolves hostname into a numeric ip. -uint32 host2ip(const char* hostname) +uint32 host2ip(const char *hostname) { - struct hostent* h = gethostbyname(hostname); + struct hostent* h; + nullpo_ret(hostname); + h = gethostbyname(hostname); return (h != NULL) ? ntohl(*(uint32*)h->h_addr) : 0; } @@ -1771,7 +1778,8 @@ uint16 ntows(uint16 netshort) } /* [Ind/Hercules] - socket_datasync */ -void socket_datasync(int fd, bool send) { +void socket_datasync(int fd, bool send) +{ struct { unsigned int length;/* short is not enough for some */ } data_list[] = { @@ -2055,7 +2063,8 @@ void socket_net_config_read(const char *filename) return; } -void socket_defaults(void) { +void socket_defaults(void) +{ sockt = &sockt_s; sockt->fd_max = 0; diff --git a/src/common/socket.h b/src/common/socket.h index 947ea8d3e..e3a309f20 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/sql.c b/src/common/sql.c index 8da105872..c80edbce4 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -144,6 +144,7 @@ int Sql_GetColumnNames(struct Sql *self, const char *table, char *out_buf, size_ size_t len; size_t off = 0; + nullpo_retr(SQL_ERROR, out_buf); if( self == NULL || SQL_ERROR == SQL->Query(self, "EXPLAIN `%s`", table) ) return SQL_ERROR; @@ -377,7 +378,8 @@ void Sql_ShowDebug_(struct Sql *self, const char *debug_file, const unsigned lon } /// Frees a Sql handle returned by Sql_Malloc. -void Sql_Free(struct Sql *self) { +void Sql_Free(struct Sql *self) +{ if( self ) { SQL->FreeResult(self); @@ -414,6 +416,7 @@ static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz) /// @private static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, unsigned long* out_length, int8* out_is_null) { + nullpo_retr(SQL_ERROR, bind); memset(bind, 0, sizeof(MYSQL_BIND)); switch( buffer_type ) { @@ -494,7 +497,8 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, /// Prints debug information about a field (type and length). /// /// @private -static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_types type, int is_unsigned, unsigned long length, const char* length_postfix) { +static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_types type, int is_unsigned, unsigned long length, const char* length_postfix) +{ const char *sign = (is_unsigned ? "UNSIGNED " : ""); const char *type_string = NULL; switch (type) { @@ -535,6 +539,7 @@ static void SqlStmt_P_ShowDebugTruncatedColumn(struct SqlStmt *self, size_t i) MYSQL_FIELD* field; MYSQL_BIND* column; + nullpo_retv(self); meta = mysql_stmt_result_metadata(self->stmt); field = mysql_fetch_field_direct(meta, (unsigned int)i); ShowSQL("DB error - data of field '%s' was truncated.\n", field->name); @@ -874,8 +879,10 @@ void SqlStmt_Free(struct SqlStmt *self) aFree(self); } } + /* receives mysql error codes during runtime (not on first-time-connects) */ -void hercules_mysql_error_handler(unsigned int ecode) { +void hercules_mysql_error_handler(unsigned int ecode) +{ switch( ecode ) { case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */ if( mysql_reconnect_type == 1 ) { @@ -1041,10 +1048,13 @@ void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename) return; } -void Sql_Init(void) { +void Sql_Init(void) +{ Sql_inter_server_read("conf/common/inter-server.conf", false); // FIXME: Hardcoded path } -void sql_defaults(void) { + +void sql_defaults(void) +{ SQL = &sql_s; SQL->Connect = Sql_Connect; diff --git a/src/common/strlib.c b/src/common/strlib.c index b67adb63c..75ce2a272 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -629,6 +629,7 @@ int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, i svstate.delim = delim; svstate.done = false; svstate.start = 0; + svstate.end = 0; // parse count = 0; diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index aeb8d8e71..3c7e25a0c 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -31,6 +31,7 @@ #include "common/cbasetypes.h" #include "common/core.h" #include "common/memmgr.h" +#include "common/nullpo.h" #include "common/strlib.h" #include <stdio.h> // fopen @@ -237,11 +238,13 @@ enum windows_ver_suite { * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_svn_get_revision(char **out) { +bool sysinfo_svn_get_revision(char **out) +{ // Only include SVN support if detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_SVN || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN FILE *fp; + nullpo_ret(out); // subversion 1.7 uses a sqlite3 database // FIXME this is hackish at best... // - ignores database file structure @@ -291,6 +294,8 @@ bool sysinfo_svn_get_revision(char **out) { if (*out != NULL) return true; } +#else + nullpo_ret(out); #endif if (*out != NULL) aFree(*out); @@ -305,11 +310,13 @@ bool sysinfo_svn_get_revision(char **out) { * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_git_get_revision(char **out) { +bool sysinfo_git_get_revision(char **out) +{ // Only include Git support if we detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_GIT || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN char ref[128], filepath[128], line[128]; + nullpo_ret(out); strcpy(ref, "HEAD"); while (*ref) { @@ -334,6 +341,7 @@ bool sysinfo_git_get_revision(char **out) { if (*out != NULL) return true; #else + nullpo_ret(out); if (*out != NULL) aFree(*out); *out = NULL; @@ -351,7 +359,8 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); * * Once retrieved, the version string is stored into sysinfo->p->osversion. */ -void sysinfo_osversion_retrieve(void) { +void sysinfo_osversion_retrieve(void) +{ OSVERSIONINFOEX osvi; StringBuf buf; ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); @@ -602,7 +611,8 @@ typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); * System info is not stored anywhere after retrieval * @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx **/ -void sysinfo_systeminfo_retrieve( LPSYSTEM_INFO info ) { +void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) +{ PGNSI pGNSI; // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. @@ -619,7 +629,8 @@ void sysinfo_systeminfo_retrieve( LPSYSTEM_INFO info ) { * Returns number of bytes in a memory page * Only needed when compiling with MSVC **/ -long sysinfo_getpagesize( void ) { +long sysinfo_getpagesize(void) +{ SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -633,7 +644,8 @@ long sysinfo_getpagesize( void ) { * Once retrieved, the name is stored into sysinfo->p->cpu and the * number of cores in sysinfo->p->cpucores. */ -void sysinfo_cpu_retrieve(void) { +void sysinfo_cpu_retrieve(void) +{ StringBuf buf; SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -669,7 +681,8 @@ void sysinfo_cpu_retrieve(void) { * * Once retrieved, the name is stored into sysinfo->p->arch. */ -void sysinfo_arch_retrieve(void) { +void sysinfo_arch_retrieve(void) +{ SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -697,7 +710,8 @@ void sysinfo_arch_retrieve(void) { * * Once retrieved, the value is stored in sysinfo->p->vcsrevision_src. */ -void sysinfo_vcsrevision_src_retrieve(void) { +void sysinfo_vcsrevision_src_retrieve(void) +{ if (sysinfo->p->vcsrevision_src != NULL) { aFree(sysinfo->p->vcsrevision_src); sysinfo->p->vcsrevision_src = NULL; @@ -721,7 +735,8 @@ void sysinfo_vcsrevision_src_retrieve(void) { * * Once retrieved, the value is stored in sysinfo->p->vcstype_name. */ -void sysinfo_vcstype_name_retrieve(void) { +void sysinfo_vcstype_name_retrieve(void) +{ if (sysinfo->p->vcstype_name != NULL) { aFree(sysinfo->p->vcstype_name); sysinfo->p->vcstype_name = NULL; @@ -750,7 +765,8 @@ void sysinfo_vcstype_name_retrieve(void) { * * Output example: "Linux", "Darwin", "Windows", etc. */ -const char *sysinfo_platform(void) { +const char *sysinfo_platform(void) +{ return sysinfo->p->platform; } @@ -768,7 +784,8 @@ const char *sysinfo_platform(void) { * Output example: "Windows 2008 Small Business Server", "OS X 10.8 Mountain Lion", * "Gentoo Base System Release 2.2", "Debian GNU/Linux 6.0.6 (squeeze)", etc. */ -const char *sysinfo_osversion(void) { +const char *sysinfo_osversion(void) +{ return sysinfo->p->osversion; } @@ -787,7 +804,8 @@ const char *sysinfo_osversion(void) { * "Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz", "Intel Core i7", * "x86 CPU, Family 6, Model 54, Stepping 1", etc. */ -const char *sysinfo_cpu(void) { +const char *sysinfo_cpu(void) +{ return sysinfo->p->cpu; } @@ -800,7 +818,8 @@ const char *sysinfo_cpu(void) { * * @return the number of CPU cores. */ -int sysinfo_cpucores(void) { +int sysinfo_cpucores(void) +{ return sysinfo->p->cpucores; } @@ -817,7 +836,8 @@ int sysinfo_cpucores(void) { * * Output example: "x86", "x86_64", "IA-64", "ARM", etc. */ -const char *sysinfo_arch(void) { +const char *sysinfo_arch(void) +{ return sysinfo->p->arch; } @@ -827,7 +847,8 @@ const char *sysinfo_arch(void) { * @retval true if this is a 64 bit build. * @retval false if this isn't a 64 bit build (i.e. it is a 32 bit build). */ -bool sysinfo_is64bit(void) { +bool sysinfo_is64bit(void) +{ #ifdef _LP64 return true; #else @@ -845,7 +866,8 @@ bool sysinfo_is64bit(void) { * Output example: "Microsoft Visual C++ 2012 (v170050727)", * "Clang v5.0.0", "MinGW32 v3.20", "GCC v4.7.3", etc. */ -const char *sysinfo_compiler(void) { +const char *sysinfo_compiler(void) +{ return sysinfo->p->compiler; } @@ -860,7 +882,8 @@ const char *sysinfo_compiler(void) { * * Output example: "-ggdb -O2 -flto -pipe -ffast-math ..." */ -const char *sysinfo_cflags(void) { +const char *sysinfo_cflags(void) +{ return sysinfo->p->cflags; } @@ -875,7 +898,8 @@ const char *sysinfo_cflags(void) { * * @see VCSTYPE_NONE, VCSTYPE_GIT, VCSTYPE_SVN, VCSTYPE_UNKNOWN */ -int sysinfo_vcstypeid(void) { +int sysinfo_vcstypeid(void) +{ return sysinfo->p->vcstype; } @@ -892,7 +916,8 @@ int sysinfo_vcstypeid(void) { * * Output example: "Git", "SVN", "Exported" */ -const char *sysinfo_vcstype(void) { +const char *sysinfo_vcstype(void) +{ return sysinfo->p->vcstype_name; } @@ -910,7 +935,8 @@ const char *sysinfo_vcstype(void) { * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_src(void) { +const char *sysinfo_vcsrevision_src(void) +{ return sysinfo->p->vcsrevision_src; } @@ -926,7 +952,8 @@ const char *sysinfo_vcsrevision_src(void) { * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_scripts(void) { +const char *sysinfo_vcsrevision_scripts(void) +{ return sysinfo->p->vcsrevision_scripts; } @@ -934,7 +961,8 @@ const char *sysinfo_vcsrevision_scripts(void) { * Reloads the run-time (scripts) VCS revision information. To be used during * script reloads to refresh the cached version. */ -void sysinfo_vcsrevision_reload(void) { +void sysinfo_vcsrevision_reload(void) +{ if (sysinfo->p->vcsrevision_scripts != NULL) { aFree(sysinfo->p->vcsrevision_scripts); sysinfo->p->vcsrevision_scripts = NULL; @@ -956,7 +984,8 @@ void sysinfo_vcsrevision_reload(void) { * @retval false if the current process is running as regular user, or * in any case under Windows. */ -bool sysinfo_is_superuser(void) { +bool sysinfo_is_superuser(void) +{ #ifndef _WIN32 if (geteuid() == 0) return true; @@ -967,7 +996,8 @@ bool sysinfo_is_superuser(void) { /** * Interface runtime initialization. */ -void sysinfo_init(void) { +void sysinfo_init(void) +{ sysinfo->p->compiler = SYSINFO_COMPILER; #ifdef WIN32 sysinfo->p->platform = "Windows"; @@ -993,7 +1023,8 @@ void sysinfo_init(void) { /** * Interface shutdown cleanup. */ -void sysinfo_final(void) { +void sysinfo_final(void) +{ #ifdef WIN32 // Only need to be free'd in win32, they're #defined elsewhere if (sysinfo->p->osversion) @@ -1035,7 +1066,8 @@ static const char *sysinfo_time(void) /** * Interface default values initialization. */ -void sysinfo_defaults(void) { +void sysinfo_defaults(void) +{ sysinfo = &sysinfo_s; memset(&sysinfo_p, '\0', sizeof(sysinfo_p)); sysinfo->p = &sysinfo_p; diff --git a/src/common/timer.c b/src/common/timer.c index 0b28f6a06..4f2b86a32 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -258,10 +258,6 @@ int64 timer_gettick(void) { /// Adds a timer to the timer_heap static void push_timer_heap(int tid) { BHEAP_ENSURE(timer_heap, 1, 256); -#ifdef __clang_analyzer__ // Clang's static analyzer warns that BHEAP_ENSURE might set BHEAP_DATA(timer_heap) to NULL. -#include "assert.h" - assert(BHEAP_DATA(timer_heap) != NULL); -#endif // __clang_analyzer__ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap); } diff --git a/src/common/timer.h b/src/common/timer.h index 2161f5e31..88c891dff 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/utils.c b/src/common/utils.c index 73df3aae1..bcfc153e3 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -54,6 +54,9 @@ void WriteDump(FILE* fp, const void* buffer, size_t length) size_t i; char hex[48+1], ascii[16+1]; + nullpo_retv(fp); + nullpo_retv(buffer); + fprintf(fp, "--- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F 0123456789ABCDEF\n"); ascii[16] = 0; @@ -78,10 +81,12 @@ void WriteDump(FILE* fp, const void* buffer, size_t length) } /// Dumps given buffer on the console. -void ShowDump(const void *buffer, size_t length) { +void ShowDump(const void *buffer, size_t length) +{ size_t i; char hex[48+1], ascii[16+1]; + nullpo_retv(buffer); ShowDebug("--- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F 0123456789ABCDEF\n"); ascii[16] = 0; @@ -108,6 +113,7 @@ static char* checkpath(char *path, const char *srcpath) { // just make sure the char*path is not const char *p = path; + if (NULL == path || NULL == srcpath) return path; while(*srcpath) { @@ -400,7 +406,9 @@ int apply_percentrate(int value, int rate, int maxrate) //----------------------------------------------------- const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format) { - size_t len = strftime(str, size, format, localtime(×tamp)); + size_t len; + nullpo_retr(NULL, str); + len = strftime(str, size, format, localtime(×tamp)); memset(str + len, '\0', size - len); return str; } @@ -413,6 +421,7 @@ bool HCache_check(const char *file) char s_path[255], dT[1]; time_t rtime; + nullpo_retr(false, file); if (!(first = fopen(file,"rb"))) return false; @@ -456,10 +465,14 @@ bool HCache_check(const char *file) return true; } -FILE *HCache_open(const char *file, const char *opt) { +FILE *HCache_open(const char *file, const char *opt) +{ FILE *first; char s_path[255]; + nullpo_retr(NULL, file); + nullpo_retr(NULL, opt); + if( file[0] == '.' && file[1] == '/' ) file += 2; else if( file[0] == '.' ) @@ -498,15 +511,19 @@ void HCache_init(void) } /* transit to fread, shields vs warn_unused_result */ -size_t hread(void * ptr, size_t size, size_t count, FILE * stream) { +size_t hread(void *ptr, size_t size, size_t count, FILE *stream) +{ return fread(ptr, size, count, stream); } + /* transit to fwrite, shields vs warn_unused_result */ -size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream) { +size_t hwrite(const void *ptr, size_t size, size_t count, FILE *stream) +{ return fwrite(ptr, size, count, stream); } -void HCache_defaults(void) { +void HCache_defaults(void) +{ HCache = &HCache_s; HCache->init = HCache_init; diff --git a/src/common/utils.h b/src/common/utils.h index c5f64124f..9d3c323ef 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/common/winapi.h b/src/common/winapi.h index 724f052a0..b410e00cd 100644 --- a/src/common/winapi.h +++ b/src/common/winapi.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/config/classes/general.h b/src/config/classes/general.h index f1fa63179..330e6437e 100644 --- a/src/config/classes/general.h +++ b/src/config/classes/general.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/config/const.h b/src/config/const.h index 655f0f949..5c6b451db 100644 --- a/src/config/const.h +++ b/src/config/const.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/config/core.h b/src/config/core.h index afd138a43..bdc7f3eee 100644 --- a/src/config/core.h +++ b/src/config/core.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/config/renewal.h b/src/config/renewal.h index 67d216226..2b5a043d4 100644 --- a/src/config/renewal.h +++ b/src/config/renewal.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/config/secure.h b/src/config/secure.h index 3f1342b22..3d111be69 100644 --- a/src/config/secure.h +++ b/src/config/secure.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/login/Makefile.in b/src/login/Makefile.in index c74ed1e10..69cc6a897 100644 --- a/src/login/Makefile.in +++ b/src/login/Makefile.in @@ -47,7 +47,7 @@ LOGIN_PH = lclif.p.h HAVE_MYSQL=@HAVE_MYSQL@ ifeq ($(HAVE_MYSQL),yes) - LOGIN_SERVER_SQL_DEPENDS=$(LOGIN_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ $(SYSINFO_INC)) + LOGIN_SERVER_SQL_DEPENDS=$(LOGIN_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(SYSINFO_INC) else LOGIN_SERVER_SQL_DEPENDS=needs_mysql endif @@ -106,8 +106,8 @@ login-server: ../../login-server@EXEEXT@ ../../login-server@EXEEXT@: $(LOGIN_SERVER_SQL_DEPENDS) Makefile @echo " LD $(notdir $@)" - @$(CC) @STATIC@ @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) $(COMMON_D)/obj_sql/common_sql.a \ - $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ + @$(CC) @STATIC@ @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a \ + $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ # missing object files $(COMMON_D)/obj_all/common.a: diff --git a/src/map/Makefile.in b/src/map/Makefile.in index 3c6a3f806..c01826bfb 100644 --- a/src/map/Makefile.in +++ b/src/map/Makefile.in @@ -57,7 +57,7 @@ MAP_PH = HAVE_MYSQL=@HAVE_MYSQL@ ifeq ($(HAVE_MYSQL),yes) - MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ $(SYSINFO_INC)) + MAP_SERVER_SQL_DEPENDS=$(MAP_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(SYSINFO_INC) else MAP_SERVER_SQL_DEPENDS=needs_mysql endif @@ -116,8 +116,8 @@ map-server: ../../map-server@EXEEXT@ ../../map-server@EXEEXT@: $(MAP_SERVER_SQL_DEPENDS) Makefile @echo " LD $(notdir $@)" - @$(CC) @STATIC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a \ - $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ + @$(CC) @STATIC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a \ + $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ # missing object files $(COMMON_D)/obj_all/common.a: diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3f916eb42..2beb6c634 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -639,7 +639,7 @@ ACMD(who) { if (pc_get_group_id(pl_sd) > 0) // Player title, if exists StrBuf->Printf(&buf, msg_fd(fd,344), pcg->get_name(pl_sd->group)); // "(%s) " StrBuf->Printf(&buf, msg_fd(fd,347), pl_sd->status.base_level, pl_sd->status.job_level, - pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s" + pc->job_name(pl_sd->status.class)); // "| Lv:%d/%d | Job: %s" break; } case 3: { @@ -748,7 +748,7 @@ ACMD(whogm) safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,915), // BLvl: %d | Job: %s (Lvl: %d) pl_sd->status.base_level, - pc->job_name(pl_sd->status.class_), pl_sd->status.job_level); + pc->job_name(pl_sd->status.class), pl_sd->status.job_level); clif->message(fd, atcmd_output); p = party->search(pl_sd->status.party_id); @@ -937,7 +937,7 @@ ACMD(hide) { if (sd->disguise != -1 ) status->set_viewdata(&sd->bl, sd->disguise); else - status->set_viewdata(&sd->bl, sd->status.class_); + status->set_viewdata(&sd->bl, sd->status.class); clif->message(fd, msg_fd(fd,10)); // Invisible: Off // increment the number of pvp players on the map @@ -951,7 +951,7 @@ ACMD(hide) { map->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl); } else { sd->sc.option |= OPTION_INVISIBLE; - sd->vd.class_ = INVISIBLE_CLASS; + sd->vd.class = INVISIBLE_CLASS; clif->message(fd, msg_fd(fd,11)); // Invisible: On // decrement the number of pvp players on the map @@ -3975,7 +3975,7 @@ ACMD(mount_peco) return false; } - if ((sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) { + if ((sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) { if (!pc->checkskill(sd,RK_DRAGONTRAINING)) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,213), skill->get_desc(RK_DRAGONTRAINING)); // You need %s to mount! clif->message(fd, atcmd_output); @@ -3990,7 +3990,7 @@ ACMD(mount_peco) } return true; } - if ((sd->class_&MAPID_THIRDMASK) == MAPID_RANGER) { + if ((sd->job & MAPID_THIRDMASK) == MAPID_RANGER) { if (!pc->checkskill(sd,RA_WUGRIDER)) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,213), skill->get_desc(RA_WUGRIDER)); // You need %s to mount! clif->message(fd, atcmd_output); @@ -4005,7 +4005,7 @@ ACMD(mount_peco) } return true; } - if ((sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC) { + if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { if (!pc_ismadogear(sd)) { clif->message(sd->fd,msg_fd(fd,1123)); // You have mounted your Mado Gear. pc->setmadogear(sd, true); @@ -4015,7 +4015,7 @@ ACMD(mount_peco) } return true; } - if (sd->class_&MAPID_SWORDMAN && sd->class_&JOBL_2) { + if ((sd->job & MAPID_BASEMASK) == MAPID_SWORDMAN && (sd->job & JOBL_2) != 0) { if (!pc_isridingpeco(sd)) { // if actually no peco if (!pc->checkskill(sd, KN_RIDING)) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,213), skill->get_desc(KN_RIDING)); // You need %s to mount! @@ -6610,9 +6610,9 @@ ACMD(mobinfo) // stats if (monster->mexp) - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1240), monster->name, monster->jname, monster->sprite, monster->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1240), monster->name, monster->jname, monster->sprite, monster->vd.class); // MVP Monster: '%s'/'%s'/'%s' (%d) else - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1241), monster->name, monster->jname, monster->sprite, monster->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1241), monster->name, monster->jname, monster->sprite, monster->vd.class); // Monster: '%s'/'%s'/'%s' (%d) clif->message(fd, atcmd_output); safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1242), monster->lv, monster->status.max_hp, base_exp, job_exp, MOB_HIT(monster), MOB_FLEE(monster)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d @@ -8210,7 +8210,7 @@ ACMD(stats) output_table[14].value = sd->change_level_2nd; output_table[15].value = sd->change_level_3rd; - sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)"); + sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class), "(level %d)"); sprintf(output, msg_fd(fd,53), sd->status.name); // '%s' stats: clif->message(fd, output); diff --git a/src/map/atcommand.h b/src/map/atcommand.h index ef8be7807..35b3c382e 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/battle.c b/src/map/battle.c index daef8f6a8..64fda033f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -892,7 +892,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, damage += damage * ratio / 100; } - if( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ){ + if ((sd->job & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) { if((skill2_lv = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) ) damage += damage * skill2_lv / 100; @@ -1666,8 +1666,29 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block break; #endif /** - * Arch Bishop - **/ + * Summoner + **/ + case SU_BITE: + skillratio += 100; + break; + case SU_SCRATCH: + skillratio += -50 + 50 * skill_lv; + break; + case SU_SCAROFTAROU: + skillratio += -100 + 100 * skill_lv; + break; + case SU_PICKYPECK: + case SU_PICKYPECK_DOUBLE_ATK: + skillratio += 100 + 100 * skill_lv; + if ((status_get_max_hp(target) / 100) <= 50) + skillratio *= 2; + break; + case SU_LUNATICCARROTBEAT: + skillratio += 100 + 100 * skill_lv; + break; + /** + * Arch Bishop + **/ case AB_JUDEX: skillratio = 300 + 20 * skill_lv; RE_LVL_DMOD(100); @@ -1886,6 +1907,12 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block pc->del_charm(sd, sd->charm_count, sd->charm_type); } break; + case SU_SV_STEMSPEAR: + skillratio += 600; + break; + case SU_CN_METEOR: + skillratio += 100 + 100 * skill_lv; + break; default: battle->calc_skillratio_magic_unknown(&attack_type, src, target, &skill_id, &skill_lv, &skillratio, &flag); break; @@ -3068,6 +3095,9 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam damage -= 50 * damage / 100;//50% reduction to physical ranged attacks } + if (sc->data[SC_SU_STOOP]) + damage -= damage * 90 / 100; + // Compressed code, fixed by map.h [Epoque] if (src->type == BL_MOB) { const struct mob_data *md = BL_UCCAST(BL_MOB, src); @@ -3176,6 +3206,19 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam status_change_end(bl, SC_KYRIE, INVALID_TIMER); } + if ((sce = sc->data[SC_TUNAPARTY]) != NULL && damage > 0) { + clif->specialeffect(bl, 336, AREA); + sce->val2 -= (int)cap_value(damage, INT_MIN, INT_MAX); + if (sce->val2 >= 0) { + damage = 0; + } else { + damage = -sce->val2; + } + if (sce->val2 <= 0) { + status_change_end(bl, SC_TUNAPARTY, INVALID_TIMER); + } + } + if( sc->data[SC_MEIKYOUSISUI] && rnd()%100 < 40 ) // custom value damage = 0; @@ -3676,6 +3719,12 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Damage calculation from iRO wiki. [Jobbie] ad.damage = status->get_lv(src) * 10 + sstatus->int_; break; + /** + * Summoner + */ + case SU_SV_ROOTTWIST_ATK: + ad.damage = 100; + break; default: { unsigned int skillratio = 100; //Skill dmg modifiers. MATK_ADD( status->get_matk(src, 2) ); @@ -3711,10 +3760,11 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Constant/misc additions from skills if (skill_id == WZ_FIREPILLAR) MATK_ADD(100+50*skill_lv); - if( sd && ( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ) && - (i=pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && - (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) ) - MATK_ADDRATE(i); + if (sd != NULL && (sd->job & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) { + int eucharistica_level = pc->checkskill(sd,AB_EUCHARISTICA); + if (eucharistica_level > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK)) + MATK_ADDRATE(eucharistica_level); + } } } #ifndef HMAP_ZONE_DAMAGE_CAP_TYPE @@ -5199,8 +5249,16 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if (hd != NULL) ATK_ADD(hd->homunculus.spiritball * 3); } + if ((wd.flag&(BF_LONG|BF_MAGIC)) == BF_LONG) { + if (sd != NULL && pc->checkskill(sd, SU_POWEROFLIFE) > 0) { + if (pc->checkskill(sd, SU_SCAROFTAROU) == 5 && pc->checkskill(sd, SU_PICKYPECK) == 5 && pc->checkskill(sd, SU_ARCLOUSEDASH) == 5 && pc->checkskill(sd, SU_LUNATICCARROTBEAT) == 5) { + ATK_ADDRATE(20); + } + } + } } + switch (skill_id) { case AS_SONICBLOW: if (sc && sc->data[SC_SOULLINK] && @@ -5263,6 +5321,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc && sc->data[SC_MTF_RANGEATK] ) ATK_ADDRATE(sc->data[SC_MTF_RANGEATK]->val1);// temporary it should be 'bonus.long_attack_atk_rate' #endif + if (sc != NULL && sc->data[SC_ARCLOUSEDASH] != NULL && sc->data[SC_ARCLOUSEDASH]->val4 != 0) { + ATK_ADDRATE(sc->data[SC_ARCLOUSEDASH]->val4); + } if( (i=pc->checkskill(sd,AB_EUCHARISTICA)) > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) ) ATK_ADDRATE(-i); @@ -5505,13 +5566,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Dual-wield if (wd.damage) { temp = pc->checkskill(sd,AS_RIGHT) * 10; - if( (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) temp = pc->checkskill(sd,KO_RIGHT) * 10 + 20; ATK_RATER( 50 + temp ); } if (wd.damage2) { temp = pc->checkskill(sd,AS_LEFT) * 10; - if( (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) temp = pc->checkskill(sd,KO_LEFT) * 10 + 20; ATK_RATEL( 30 + temp ); } @@ -6008,20 +6069,18 @@ int battle_damage_area(struct block_list *bl, va_list ap) { if (bl->type == BL_MOB && BL_UCCAST(BL_MOB, bl)->class_ == MOBID_EMPELIUM) return 0; if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) { - struct map_session_data *sd = NULL; nullpo_ret(src); map->freeblock_lock(); - sd = BL_CAST(BL_PC, src); if (src->type == BL_PC) - battle->drain(sd, bl, damage, damage, status_get_race(bl), is_boss(bl)); + battle->drain(BL_UCAST(BL_PC, src), bl, damage, damage, status_get_race(bl), is_boss(bl)); if( amotion ) battle->delay_damage(tick, amotion,src,bl,0,CR_REFLECTSHIELD,0,damage,ATK_DEF,0,true); else status_fix_damage(src,bl,damage,0); clif->damage(bl,bl,amotion,dmotion,damage,1,BDT_ENDURE,0); - if (src->type != BL_PC || !sd->state.autocast) + if (src->type != BL_PC || !BL_UCCAST(BL_PC, src)->state.autocast) skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map->freeblock_unlock(); } @@ -6783,8 +6842,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f const struct map_session_data *s_sd = BL_UCCAST(BL_PC, s_bl); const struct map_session_data *t_sd = BL_UCCAST(BL_PC, t_bl); if ( - (s_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || - (t_sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || + (s_sd->job & MAPID_UPPERMASK) == MAPID_NOVICE || + (t_sd->job & MAPID_UPPERMASK) == MAPID_NOVICE || s_sd->status.base_level < battle_config.pk_min_level || t_sd->status.base_level < battle_config.pk_min_level || (battle_config.pk_level_range && abs(s_sd->status.base_level - t_sd->status.base_level) > battle_config.pk_level_range) @@ -7108,6 +7167,7 @@ static const struct battle_data { { "castrate_dex_scale", &battle_config.castrate_dex_scale, 150, 1, INT_MAX, }, { "vcast_stat_scale", &battle_config.vcast_stat_scale, 530, 1, INT_MAX, }, { "area_size", &battle_config.area_size, 14, 0, INT_MAX, }, + { "chat_area_size", &battle_config.chat_area_size, 9, 0, INT_MAX, }, { "zeny_from_mobs", &battle_config.zeny_from_mobs, 0, 0, 1, }, { "mobs_level_up", &battle_config.mobs_level_up, 0, 0, 1, }, { "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, }, @@ -7260,6 +7320,7 @@ static const struct battle_data { { "save_body_style", &battle_config.save_body_style, 0, 0, 1, }, { "player_warp_keep_direction", &battle_config.player_warp_keep_direction, 0, 0, 1, }, { "atcommand_levelup_events", &battle_config.atcommand_levelup_events, 0, 0, 1, }, + { "max_summoner_parameter", &battle_config.max_summoner_parameter, 120, 10, 10000, }, }; #ifndef STATS_OPT_OUT /** diff --git a/src/map/battle.h b/src/map/battle.h index ebfa0e305..c55d5ef19 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -362,6 +362,7 @@ struct Battle_Config { int castrate_dex_scale; // added by [MouseJstr] int area_size; // added by [MouseJstr] + int chat_area_size; // added by [gumi] int max_def, over_def_bonus; //added by [Skotlex] @@ -544,6 +545,8 @@ struct Battle_Config { int player_warp_keep_direction; int atcommand_levelup_events; // Enable atcommands trigger level up events for NPCs + + int max_summoner_parameter; // Summoner Max Stats }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/battleground.c b/src/map/battleground.c index 7419a1928..cd7178951 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -822,7 +822,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ if ( sd->status.base_level > arena->max_level || sd->status.base_level < arena->min_level ) return BGQA_FAIL_LEVEL_INCORRECT; - if ( !(sd->class_&JOBL_2) ) /* TODO: maybe make this a per-arena setting, so users may make custom arenas like baby-only,whatever. */ + if ((sd->job & JOBL_2) == 0) /* TODO: maybe make this a per-arena setting, so users may make custom arenas like baby-only,whatever. */ return BGQA_FAIL_CLASS_INVALID; tsec = (unsigned int)time(NULL); diff --git a/src/map/battleground.h b/src/map/battleground.h index 4c3d4878f..6bd0f2c99 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index d2e2a2c20..70e08a4b4 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index 1e277b7fa..b3756c39e 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/chat.c b/src/map/chat.c index 145d44d1e..763d98f7a 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/chat.h b/src/map/chat.h index af43d9703..bcdf674f7 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/chrif.c b/src/map/chrif.c index d641c6dd3..bf613b029 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1059,19 +1059,17 @@ int chrif_disconnectplayer(int fd) { /*========================================== * Request/Receive top 10 Fame character list *------------------------------------------*/ -int chrif_updatefamelist(struct map_session_data* sd) { - char type; +int chrif_updatefamelist(struct map_session_data *sd) +{ + int type; nullpo_retr(0, sd); chrif_check(-1); - switch(sd->class_ & MAPID_UPPERMASK) { - case MAPID_BLACKSMITH: type = RANKTYPE_BLACKSMITH; break; - case MAPID_ALCHEMIST: type = RANKTYPE_ALCHEMIST; break; - case MAPID_TAEKWON: type = RANKTYPE_TAEKWON; break; - default: - return 0; - } + type = pc->famelist_type(sd->job); + + if (type == RANKTYPE_UNKNOWN) + return 0; WFIFOHEAD(chrif->fd, 11); WFIFOW(chrif->fd,0) = 0x2b10; diff --git a/src/map/chrif.h b/src/map/chrif.h index 4a1e1da47..615521e0f 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/clif.c b/src/map/clif.c index 040f86a58..c48241898 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -276,7 +276,7 @@ unsigned char clif_bl_type(struct block_list *bl) vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - if (clif->isdisguised(bl) && !pc->db_checkid(vd->class_)) + if (clif->isdisguised(bl) && !pc->db_checkid(vd->class)) return CLUT_NPC; return CLUT_PC; case BL_ITEM: @@ -288,15 +288,15 @@ unsigned char clif_bl_type(struct block_list *bl) case BL_MOB: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_MOB; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_MOB; case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_EVENT; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_PET; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_PET; case BL_HOM: return CLUT_HOMNUCLUS; case BL_MER: @@ -451,8 +451,8 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target break; case AREA_CHAT_WOC: nullpo_retr(true, bl); - map->foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), - bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC); + map->foreachinarea(clif->send_sub, bl->m, bl->x-CHAT_AREA_SIZE, bl->y-CHAT_AREA_SIZE, + bl->x+CHAT_AREA_SIZE, bl->y+CHAT_AREA_SIZE, BL_PC, buf, len, bl, AREA_WOC); break; case CHAT: @@ -961,14 +961,15 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1005,7 +1006,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu nullpo_retv(bl); #if PACKETVER < 20091103 - if( !pc->db_checkid(vd->class_) ) { + if (!pc->db_checkid(vd->class)) { clif->set_unit_idle2(bl,tsd,target); return; } @@ -1028,7 +1029,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1037,7 +1038,8 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1082,7 +1084,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1115,11 +1117,12 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; - p.job = vd->class_; + p.job = vd->class; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1147,7 +1150,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { nullpo_retv(bl); #if PACKETVER < 20091103 - if( !pc->db_checkid(vd->class_) ) { + if (!pc->db_checkid(vd->class)) { clif->spawn_unit2(bl,target); return; } @@ -1170,7 +1173,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1179,7 +1182,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1220,10 +1224,10 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif if (clif->isdisguised(bl)) { nullpo_retv(sd); - if( sd->status.class_ != sd->disguise ) + if (sd->status.class != sd->disguise) clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1266,7 +1270,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1315,7 +1319,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1360,7 +1364,7 @@ void clif_spiritball_single(int fd, struct map_session_data *sd) { *------------------------------------------*/ void clif_charm_single(int fd, struct map_session_data *sd) { -#if PACKETVER >= 20120410 +#if PACKETVER >= 20110809 nullpo_retv(sd); WFIFOHEAD(fd, packet_len(0x08cf)); WFIFOW(fd,0) = 0x08cf; @@ -1427,7 +1431,7 @@ bool clif_spawn(struct block_list *bl) if( !vd ) return false; - if (vd->class_ == INVISIBLE_CLASS) + if (vd->class == INVISIBLE_CLASS) return true; // Doesn't need to be spawned, so everything is alright if (bl->type == BL_NPC) { @@ -1774,7 +1778,7 @@ void clif_move(struct unit_data *ud) bl = ud->bl; nullpo_retv(bl); vd = status->get_viewdata(bl); - if (!vd || vd->class_ == INVISIBLE_CLASS) + if (vd == NULL || vd->class == INVISIBLE_CLASS) return; //This performance check is needed to keep GM-hidden objects from being notified to bots. if (bl->type == BL_NPC) { @@ -3249,10 +3253,7 @@ void clif_changelook(struct block_list *bl,int type,int val) #endif break; case LOOK_BODY2: - if (val && ( - sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || - sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || - sd->sc.option&OPTION_OKTOBERFEST)) + if (sd != NULL && (sd->sc.option&OPTION_COSTUME) != OPTION_NOTHING) val = 0; vd->body_style = val; break; @@ -4234,7 +4235,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { nullpo_retv(bl); vd = status->get_viewdata(bl); - if (!vd || vd->class_ == INVISIBLE_CLASS) + if (vd == NULL || vd->class == INVISIBLE_CLASS) return; if (bl->type == BL_NPC) { @@ -4694,7 +4695,7 @@ int clif_outsight(struct block_list *bl,va_list ap) nullpo_ret(bl); switch(bl->type){ case BL_PC: - if (sd->vd.class_ != INVISIBLE_CLASS) + if (sd->vd.class != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); if (sd->chat_id != 0) { struct chat_data *cd = map->id2cd(sd->chat_id); @@ -4717,7 +4718,7 @@ int clif_outsight(struct block_list *bl,va_list ap) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; default: - if ((vd=status->get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) + if ((vd=status->get_viewdata(bl)) && vd->class != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; } @@ -4726,7 +4727,7 @@ int clif_outsight(struct block_list *bl,va_list ap) nullpo_ret(tbl); if (tbl->type == BL_SKILL) //Trap knocked out of sight clif->clearchar_skillunit(BL_UCAST(BL_SKILL, tbl), sd->fd); - else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + else if ((vd = status->get_viewdata(tbl)) != NULL && vd->class != INVISIBLE_CLASS && !(tbl->type == BL_NPC && (BL_UCAST(BL_NPC, tbl)->option&OPTION_INVISIBLE))) clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); } @@ -4802,7 +4803,7 @@ void clif_skillinfoblock(struct map_session_data *sd) } safestrncpy(WFIFOP(fd,len+12), skill->get_name(id), NAME_LENGTH); if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class))? 1:0; else WFIFOB(fd,len+36) = 0; len += 37; @@ -4853,7 +4854,7 @@ void clif_addskill(struct map_session_data *sd, int id) } safestrncpy(WFIFOP(fd,14), skill->get_name(id), NAME_LENGTH); if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class))? 1:0; else WFIFOB(fd,38) = 0; WFIFOSET(fd,packet_len(0x111)); @@ -4898,7 +4899,7 @@ void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, in WFIFOW(fd, 6) = skill->get_sp(skill_id, skill_lv); WFIFOW(fd, 8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); if( flag ) - WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class)) ? 1 : 0; else WFIFOB(fd,10) = 1; @@ -4931,7 +4932,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) WFIFOW(fd,12) = 0; } if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class))? 1:0; else WFIFOB(fd,14) = 0; WFIFOSET(fd,packet_len(0x7e1)); @@ -5752,7 +5753,7 @@ void clif_heal(int fd, int type, int val) int len = packet_len(cmd); WFIFOHEAD(fd, len); - WFIFOW(fd, 0) = 0x13d; + WFIFOW(fd, 0) = cmd; WFIFOW(fd, 2) = type; #if PACKETVER < 20150513 WFIFOW(fd, 4) = cap_value(val, 0, INT16_MAX); @@ -6421,12 +6422,12 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven } WFIFOSET(fd,WFIFOW(fd,2)); -#if PACKETVER >= 20141022 +#if PACKETVER >= 20140625 /** should go elsewhere perhaps? it has to be bundled with this however. **/ - WFIFOHEAD(fd, 3); + WFIFOHEAD(fd, packet_len(0xa28)); WFIFOW(fd, 0) = 0xa28; WFIFOB(fd, 2) = 0;/** 1 is failure. our current responses to failure are working so not yet implemented **/ - WFIFOSET(fd, 3); + WFIFOSET(fd, packet_len(0xa28)); #endif } @@ -7485,7 +7486,7 @@ void clif_guild_memberlist(struct map_session_data *sd) WFIFOW(fd,c*104+12)=m->hair; WFIFOW(fd,c*104+14)=m->hair_color; WFIFOW(fd,c*104+16)=m->gender; - WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+18)=m->class; WFIFOW(fd,c*104+20)=m->lv; WFIFOL(fd,c*104+22)=(int)cap_value(m->exp,0,INT32_MAX); WFIFOL(fd,c*104+26)=m->online; @@ -8916,7 +8917,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts safestrncpy(viewequip_list.characterName, tsd->status.name, NAME_LENGTH); - viewequip_list.job = tsd->status.class_; + viewequip_list.job = tsd->status.class; viewequip_list.head = tsd->vd.hair_style; viewequip_list.accessory = tsd->vd.head_bottom; viewequip_list.accessory2 = tsd->vd.head_mid; @@ -9631,7 +9632,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) {// Check if quest is not started if( qi->hasJob ) { // Check if quest is job-specific, check is user is said job class. - if( sd->class_ == qi->job ) + if (sd->status.class == qi->job) clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); } else { clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); @@ -9822,11 +9823,9 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((non void clif_parse_QuitGame(int fd, struct map_session_data *sd) { /* Rovert's prevent logout option fixed [Valaris] */ - if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && - (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) - { + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && !sd->sc.data[SC_SUHIDE] && + (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout)) { sockt->eof(fd); - clif->disconnect_ack(sd, 0); } else { clif->disconnect_ack(sd, 1); @@ -9875,7 +9874,7 @@ int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data * sd; if( (sd = map->id2sd(id)) ) { sd->fontcolor_tid = INVALID_TIMER; - if( sd->fontcolor && sd->disguise == sd->status.class_ ) + if (sd->fontcolor && sd->disguise == sd->status.class) pc->disguise(sd,-1); } return 0; @@ -9926,12 +9925,12 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) if (sd->disguise == -1) { sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); - pc->disguise(sd,sd->status.class_); + pc->disguise(sd,sd->status.class); if (pc_isdead(sd)) clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); if (unit->is_walking(&sd->bl)) clif->move(&sd->ud); - } else if (sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER) { + } else if (sd->disguise == sd->status.class && sd->fontcolor_tid != INVALID_TIMER) { const struct TimerData *td; if ((td = timer->get(sd->fontcolor_tid)) != NULL) timer->settick(sd->fontcolor_tid, td->tick+5000); @@ -10058,7 +10057,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) { int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (battle_config.basic_skill_check == 0 || pc->check_basicskill(sd, 2)) { if (emoticon == E_MUTE) {// prevent use of the mute emote [Valaris] clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); return; @@ -10118,7 +10117,8 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, sd->sc.data[SC_TRICKDEAD] || (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || sd->sc.data[SC_BLADESTOP] || - sd->sc.data[SC_DEEP_SLEEP] ) + sd->sc.data[SC_DEEP_SLEEP] || + sd->sc.data[SC_SUHIDE] ) ) return; @@ -10158,7 +10158,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, } break; case 0x02: // sitdown - if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + if (battle_config.basic_skill_check && !pc->check_basicskill(sd, 3)) { clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); break; } @@ -10243,7 +10243,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) { case 0x01: /* Rovert's Prevent logout option - Fixed [Valaris] */ if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] - && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && !sd->sc.data[SC_SUHIDE] && (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { //Send to char-server for character selection. @@ -10431,6 +10431,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) sd->sc.data[SC_TRICKDEAD] || sd->sc.data[SC_BLADESTOP] || sd->sc.data[SC_CLOAKINGEXCEED] || + sd->sc.data[SC_SUHIDE] || pc_ismuted(&sd->sc, MANNER_NOITEM) ) ) break; @@ -10763,7 +10764,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) if (pc_ismuted(&sd->sc, MANNER_NOROOM)) return; - if(battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 4) { + if(battle_config.basic_skill_check && !pc->check_basicskill(sd, 4)) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3); return; } @@ -10880,7 +10881,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { return; } - if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 1) { + if( battle_config.basic_skill_check && !pc->check_basicskill(sd, 1)) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,0); return; } @@ -11926,7 +11927,7 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) clif->message(fd, msg_fd(fd,227)); // Party modification is disabled in this map. return; } - if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + if (battle_config.basic_skill_check && !pc->check_basicskill(sd, 7)) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } @@ -11948,7 +11949,7 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) clif->message(fd, msg_fd(fd,227)); // Party modification is disabled in this map. return; } - if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + if (battle_config.basic_skill_check && !pc->check_basicskill(sd, 7)) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } @@ -12571,7 +12572,7 @@ void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) nullpo_retv(sd); WBUFW(buf, 0) = 0x8f2; WBUFL(buf, 2) = sd->status.account_id; - WBUFL(buf, 6) = sd->status.class_; + WBUFL(buf, 6) = sd->status.class; WBUFW(buf, 10) = sd->status.base_level; memcpy(WBUFP(buf, 12), sd->status.name, NAME_LENGTH); @@ -13827,7 +13828,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) { if (sd->state.doridori) return; - switch (sd->class_&MAPID_UPPERMASK) { + switch (sd->job & MAPID_UPPERMASK) { case MAPID_SOUL_LINKER: case MAPID_STAR_GLADIATOR: case MAPID_TAEKWON: @@ -13855,7 +13856,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /* game client is currently broken on this (not sure the packetver range) */ /* it sends the request when the criteria doesn't match (and of course we let it fail) */ /* so restoring the old parse_globalmes method. */ - if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { unsigned int next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if( next ) { @@ -14219,30 +14220,27 @@ void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { } /// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING) -void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) +{ +#if PACKETVER >= 20120502 int fd; - int mypoint = 0; - int upperMask; + int len = packet_len(0x97d); nullpo_retv(sd); fd = sd->fd; - upperMask = sd->class_&MAPID_UPPERMASK; - WFIFOHEAD(fd, 288); + WFIFOHEAD(fd, len); WFIFOW(fd, 0) = 0x97d; WFIFOW(fd, 2) = type; clif_ranklist_sub(WFIFOP(fd,4), type); - if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) - || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) - || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) - ) { - mypoint = sd->status.fame; + if (pc->famelist_type(sd->job) == type) { + WFIFOL(fd, 284) = sd->status.fame; //mypoint } else { - mypoint = 0; + WFIFOL(fd, 284) = 0; //mypoint } - WFIFOL(fd, 284) = mypoint; //mypoint - WFIFOSET(fd, 288); + WFIFOSET(fd, len); +#endif } void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -14262,8 +14260,9 @@ void clif_parse_ranklist(int fd, struct map_session_data *sd) { } // 097e <RankingType>.W <point>.L <TotalPoint>.L (ZC_UPDATE_RANKING_POINT) -void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { -#if PACKETVER < 20130710 +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) +{ +#if PACKETVER < 20120502 switch( type ) { case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; @@ -14272,15 +14271,16 @@ void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type t #else int fd; + int len = packet_len(0x97e); nullpo_retv(sd); fd = sd->fd; - WFIFOHEAD(fd, 12); + WFIFOHEAD(fd, len); WFIFOW(fd, 0) = 0x97e; WFIFOW(fd, 2) = type; WFIFOL(fd, 4) = points; WFIFOL(fd, 8) = sd->status.fame; - WFIFOSET(fd, 12); + WFIFOSET(fd, len); #endif } @@ -16248,7 +16248,7 @@ void clif_bg_xy(struct map_session_data *sd) WBUFW(buf,0)=0x2df; WBUFL(buf,2)=sd->status.account_id; memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); - WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,30)=sd->status.class; WBUFW(buf,32)=sd->bl.x; WBUFW(buf,34)=sd->bl.y; @@ -17494,7 +17494,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { *------------------------------------------*/ void clif_charm(struct map_session_data *sd) { -#if PACKETVER >= 20120410 +#if PACKETVER >= 20110809 unsigned char buf[10]; nullpo_retv(sd); @@ -17620,7 +17620,7 @@ void clif_favorite_item(struct map_session_data* sd, unsigned short index) { } void clif_snap( struct block_list *bl, short x, short y ) { -#if PACKETVER >= 20111005 +#if PACKETVER >= 20110809 unsigned char buf[10]; nullpo_retv(bl); @@ -17633,7 +17633,9 @@ void clif_snap( struct block_list *bl, short x, short y ) { #endif } -void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { +void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd) +{ +#if PACKETVER >= 20120228 struct packet_monster_hp p; nullpo_retv(md); @@ -17644,6 +17646,7 @@ void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { p.MaxHP = md->status.max_hp; clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } /* [Ind/Hercules] placeholder for unsupported incoming packets (avoids server disconnecting client) */ @@ -17672,7 +17675,9 @@ void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { } void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) +{ +#if PACKETVER >= 20110614 int i, j = 0; for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { @@ -17692,6 +17697,7 @@ void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); } +#endif } void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -17785,7 +17791,9 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* [Ind/Hercules] */ -void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) +{ +#if PACKETVER >= 20110222 short tab = RFIFOW(fd, 2); int j; @@ -17804,9 +17812,12 @@ void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { } WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +#endif } + /* [Ind/Hercules] */ -void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) +{ #if PACKETVER >= 20121010 struct packet_maptypeproperty2 p; struct map_session_data *sd = NULL; @@ -17859,6 +17870,7 @@ void clif_partytickack(struct map_session_data* sd, bool flag) { void clif_ShowScript(struct block_list *bl, const char *message) { +#if PACKETVER >= 20110111 char buf[256]; int len; nullpo_retv(bl); @@ -17878,6 +17890,7 @@ void clif_ShowScript(struct block_list *bl, const char *message) WBUFL(buf,4) = bl->id; safestrncpy(WBUFP(buf,8),message,len); clif->send(buf,WBUFW(buf,2),bl,AREA); +#endif } void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { @@ -18034,14 +18047,17 @@ void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_ clif->send(&p,sizeof(p), &sd->bl, target); } -void clif_scriptclear(struct map_session_data *sd, int npcid) { +void clif_scriptclear(struct map_session_data *sd, int npcid) +{ +#if PACKETVER >= 20110928 struct packet_script_clear p; nullpo_retv(sd); p.PacketType = script_clearType; p.NpcID = npcid; - clif->send(&p,sizeof(p), &sd->bl, SELF); + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } /* Made Possible Thanks to Yommy! */ @@ -18163,7 +18179,9 @@ void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) } void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_BankCheck(int fd, struct map_session_data* sd) { +void clif_parse_BankCheck(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20130313 struct packet_banking_check p; if (!battle_config.feature_banking) { @@ -18176,6 +18194,7 @@ void clif_parse_BankCheck(int fd, struct map_session_data* sd) { p.Reason = (short)0; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); @@ -18188,7 +18207,9 @@ void clif_parse_BankClose(int fd, struct map_session_data* sd) { return; } -void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) +{ +#if PACKETVER >= 20130313 struct packet_banking_deposit_ack p; nullpo_retv(sd); @@ -18198,9 +18219,12 @@ void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK r p.Reason = (short)reason; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } -void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) +{ +#if PACKETVER >= 20130313 struct packet_banking_withdraw_ack p; nullpo_retv(sd); @@ -18210,6 +18234,7 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK p.Reason = (short)reason; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } /* TODO: official response packet (tried 0x8cb/0x97b but the display was quite screwed up.) */ @@ -18466,6 +18491,7 @@ void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, i void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); /* Roulette System [Yommy/Hercules] */ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { +#if PACKETVER >= 20140612 struct packet_roulette_open_ack p; if( !battle_config.feature_roulette ) { @@ -18484,10 +18510,13 @@ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { p.SilverPoint = pc_readglobalreg(sd, script->add_str("TmpRouletteSilver")); clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20140612 struct packet_roulette_info_ack p; unsigned short i, j, count = 0; @@ -18510,7 +18539,7 @@ void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { } } clif->send(&p,sizeof(p), &sd->bl, SELF); - return; +#endif } void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); @@ -18584,7 +18613,9 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribut /** * Request to cash in! **/ -void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20140612 struct packet_roulette_itemrecv_ack p; if( !battle_config.feature_roulette ) { @@ -18627,7 +18658,7 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { p.Result = RECV_ITEM_FAILED; clif->send(&p,sizeof(p), &sd->bl, SELF); - return; +#endif } bool clif_parse_roulette_db(void) { @@ -18722,7 +18753,9 @@ bool clif_parse_roulette_db(void) { /** * **/ -void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) +{ +#if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; nullpo_retv(sd); @@ -18736,6 +18769,7 @@ void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char resul p.RemainSilver = pc_readglobalreg(sd, script->add_str("TmpRouletteSilver")); clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } /** @@ -18743,6 +18777,7 @@ void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char resul */ void clif_openmergeitem(int fd, struct map_session_data *sd) { +#if PACKETVER > 20120228 int i = 0, n = 0, j = 0; struct merge_item merge_items[MAX_INVENTORY]; struct merge_item *merge_items_[MAX_INVENTORY] = {0}; @@ -18785,6 +18820,7 @@ void clif_openmergeitem(int fd, struct map_session_data *sd) for ( i = 0; i < j; i++ ) WFIFOW(fd,i*2+4) = merge_items_[i]->position; WFIFOSET(fd,2*j+4); +#endif } int clif_comparemergeitem(const void *a, const void *b) @@ -18801,6 +18837,7 @@ int clif_comparemergeitem(const void *a, const void *b) void clif_ackmergeitems(int fd, struct map_session_data *sd) { +#if PACKETVER > 20120228 int i = 0, n = 0, length = 0, count = 0; int16 nameid = 0, indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; struct item item_data; @@ -18880,6 +18917,7 @@ void clif_ackmergeitems(int fd, struct map_session_data *sd) WFIFOW(fd,4) = count; WFIFOB(fd,6) = MERGEITEM_SUCCESS; WFIFOSET(fd,7); +#endif } void clif_cancelmergeitem (int fd, struct map_session_data *sd) @@ -18928,13 +18966,14 @@ void clif_selectcart(struct map_session_data *sd) /// Starts navigation to the given target on client side void clif_navigate_to(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id) { -#if PACKETVER >= 20111010 +// probably this packet with other fields present in older packet versions +#if PACKETVER >= 20120307 int fd; nullpo_retv(sd); nullpo_retv(mapname); fd = sd->fd; - WFIFOHEAD(fd, 27); + WFIFOHEAD(fd, packet_len(0x8e2)); WFIFOW(fd, 0) = 0x8e2; // How detailed will our navigation be? @@ -18962,7 +19001,7 @@ void clif_navigate_to(struct map_session_data *sd, const char* mapname, uint16 x WFIFOW(fd, 23) = y; // Target monster ID WFIFOW(fd, 25) = mob_id; - WFIFOSET(fd, 27); + WFIFOSET(fd, packet_len(0x8e2)); #endif } diff --git a/src/map/clif.h b/src/map/clif.h index 3203a3e66..b27adb5be 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/date.c b/src/map/date.c index 5579962bf..a20578e51 100644 --- a/src/map/date.c +++ b/src/map/date.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/date.h b/src/map/date.h index 831539e3c..3a109d1ad 100644 --- a/src/map/date.h +++ b/src/map/date.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/duel.c b/src/map/duel.c index 64991d39c..558dc1d9e 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/duel.h b/src/map/duel.h index 60b5b09ab..c0af04df6 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/elemental.c b/src/map/elemental.c index b6297c2cf..ae1fda0a2 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -704,7 +704,7 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s if( DIFF_TICK(tick,ed->last_spdrain_time) >= 10000 ){// Drain SP every 10 seconds int sp = 5; - switch (ed->vd->class_) { + switch (ed->vd->class) { case ELEID_EL_AGNI_M: case ELEID_EL_AQUA_M: case ELEID_EL_VENTUS_M: @@ -864,7 +864,7 @@ int read_elementaldb(void) { db->lv = atoi(str[3]); estatus = &db->status; - db->vd.class_ = db->class_; + db->vd.class = db->class_; estatus->max_hp = atoi(str[4]); estatus->max_sp = atoi(str[5]); diff --git a/src/map/elemental.h b/src/map/elemental.h index cdd83fd21..f13d095df 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/guild.c b/src/map/guild.c index 83afc9538..6e5b1c539 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -268,7 +268,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd) m->hair = sd->status.hair; m->hair_color = sd->status.hair_color; m->gender = sd->status.sex; - m->class_ = sd->status.class_; + m->class = sd->status.class; m->lv = sd->status.base_level; //m->exp = 0; //m->exp_payper = 0; @@ -977,7 +977,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) return 0; intif->guild_memberinfoshort(g->guild_id, - sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_); + sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class); if(!online){ int i = guild->getindex(g,sd->status.account_id,sd->status.char_id); @@ -996,7 +996,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) return 0; } -int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_) +int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { // cleaned up [LuzZza] int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1; struct guild *g = guild->search(guild_id); @@ -1011,7 +1011,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin oldonline=m->online; m->online=online; m->lv=lv; - m->class_=class_; + m->class = class; idx=i; } alv+=m->lv; diff --git a/src/map/guild.h b/src/map/guild.h index 4fe7106d3..cdb28a37b 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -126,7 +126,7 @@ struct guild_interface { int (*check_alliance) (int guild_id1, int guild_id2, int flag); /* */ int (*send_memberinfoshort) (struct map_session_data *sd,int online); - int (*recv_memberinfoshort) (int guild_id,int account_id,int char_id,int online,int lv,int class_); + int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int16 class); int (*change_memberposition) (int guild_id,int account_id,int char_id,short idx); int (*memberposition_changed) (struct guild *g,int idx,int pos); int (*change_position) (int guild_id,int idx,int mode,int exp_mode,const char *name); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index cc920b888..91a455416 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -1350,7 +1350,7 @@ void do_init_homunculus(bool minimal) { //Stock view data for homuncs memset(homun->dbs->viewdb, 0, sizeof(homun->dbs->viewdb)); for (class_ = 0; class_ < MAX_HOMUNCULUS_CLASS; class_++) - homun->dbs->viewdb[class_].class_ = HM_CLASS_BASE+class_; + homun->dbs->viewdb[class_].class = HM_CLASS_BASE + class_; } void do_final_homunculus(void) { diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 3dd9e4772..a80392cf6 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/instance.c b/src/map/instance.c index fa2cfec16..21ee6bf80 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/instance.h b/src/map/instance.h index 2019b1a42..141d37a8f 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/intif.c b/src/map/intif.c index 2d6d39406..10a9ea8a9 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -693,7 +693,7 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha } //Update request / Lv online status of the guild members -int intif_guild_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_) +int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { if (intif->CheckForCharServer()) return 0; @@ -704,7 +704,7 @@ int intif_guild_memberinfoshort(int guild_id,int account_id,int char_id,int onli WFIFOL(inter_fd,10) = char_id; WFIFOB(inter_fd,14) = online; WFIFOW(inter_fd,15) = lv; - WFIFOW(inter_fd,17) = class_; + WFIFOW(inter_fd,17) = class; WFIFOSET(inter_fd,19); return 0; } @@ -1359,7 +1359,7 @@ void intif_parse_GuildMemberInfoChanged(int fd) { case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break; case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break; case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break; - case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break; + case GMI_CLASS: g->member[idx].class = RFIFOW(fd,18); break; case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break; } } diff --git a/src/map/intif.h b/src/map/intif.h index 5e7f86fc2..b20acf029 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -81,7 +81,7 @@ struct intif_interface { int (*guild_request_info) (int guild_id); int (*guild_addmember) (int guild_id, struct guild_member *m); int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes); - int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int16 class); int (*guild_break) (int guild_id); int (*guild_message) (int guild_id, int account_id, const char *mes, int len); int (*guild_change_gm) (int guild_id, const char *name, int len); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 2e44393fe..445307aeb 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -352,14 +352,14 @@ const char* itemdb_typename(int type) * * @author Dastgir */ -void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) +void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable) { uint64 mask[3] = { 0 }; int i; nullpo_retv(bclass); - switch(job_id) { + switch (job_class) { // Base Classes case JOB_NOVICE: case JOB_SUPER_NOVICE: @@ -367,12 +367,22 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) mask[1] = 1ULL << MAPID_NOVICE; break; case JOB_SWORDMAN: + mask[0] = 1ULL << MAPID_SWORDMAN; + break; case JOB_MAGE: + mask[0] = 1ULL << MAPID_MAGE; + break; case JOB_ARCHER: + mask[0] = 1ULL << MAPID_ARCHER; + break; case JOB_ACOLYTE: + mask[0] = 1ULL << MAPID_ACOLYTE; + break; case JOB_MERCHANT: + mask[0] = 1ULL << MAPID_MERCHANT; + break; case JOB_THIEF: - mask[0] = 1ULL << (MAPID_NOVICE+job_id); + mask[0] = 1ULL << MAPID_THIEF; break; // 2-1 Classes case JOB_KNIGHT: @@ -437,6 +447,9 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) case JOB_REBELLION: mask[1] = 1ULL << MAPID_GUNSLINGER; break; + case JOB_SUMMONER: + mask[0] = 1ULL << MAPID_SUMMONER; + break; // Other Classes case JOB_GANGSI: //Bongun/Munak mask[0] = 1ULL << MAPID_GANGSI; @@ -468,7 +481,6 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) */ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) { - int i; nullpo_retv(bclass); bclass[0] = bclass[1] = bclass[2] = 0; //Base classes @@ -477,10 +489,18 @@ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) bclass[0] |= 1ULL<<MAPID_NOVICE; bclass[1] |= 1ULL<<MAPID_NOVICE; } - for (i = JOB_NOVICE+1; i <= JOB_THIEF; i++) { - if (jobmask & 1ULL<<i) - bclass[0] |= 1ULL<<(MAPID_NOVICE+i); - } + if (jobmask & 1ULL<<JOB_SWORDMAN) + bclass[0] |= 1ULL<<MAPID_SWORDMAN; + if (jobmask & 1ULL<<JOB_MAGE) + bclass[0] |= 1ULL<<MAPID_MAGE; + if (jobmask & 1ULL<<JOB_ARCHER) + bclass[0] |= 1ULL<<MAPID_ARCHER; + if (jobmask & 1ULL<<JOB_ACOLYTE) + bclass[0] |= 1ULL<<MAPID_ACOLYTE; + if (jobmask & 1ULL<<JOB_MERCHANT) + bclass[0] |= 1ULL<<MAPID_MERCHANT; + if (jobmask & 1ULL<<JOB_THIEF) + bclass[0] |= 1ULL<<MAPID_THIEF; //2-1 classes if (jobmask & 1ULL<<JOB_KNIGHT) bclass[1] |= 1ULL<<MAPID_SWORDMAN; @@ -538,6 +558,8 @@ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) bclass[1] |= 1ULL<<MAPID_NINJA; if (jobmask & 1ULL<<30) //Rebellion bclass[1] |= 1ULL<<MAPID_GUNSLINGER; + if (jobmask & 1ULL<<31) //Summoner + bclass[0] |= 1ULL<<MAPID_SUMMONER; } void create_dummy_data(void) @@ -1535,6 +1557,30 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { return 0; } + { + const char *c = entry->name; + while (ISALNUM(*c) || *c == '_') + ++c; + + if (*c != '\0') { + ShowWarning("itemdb_validate_entry: Invalid characters in the AegisName '%s' for item %d in '%s'. Skipping.\n", + entry->name, entry->nameid, source); + if (entry->script) { + script->free_code(entry->script); + entry->script = NULL; + } + if (entry->equip_script) { + script->free_code(entry->equip_script); + entry->equip_script = NULL; + } + if (entry->unequip_script) { + script->free_code(entry->unequip_script); + entry->unequip_script = NULL; + } + return 0; + } + } + if( entry->type < 0 || entry->type == IT_UNKNOWN || entry->type == IT_UNKNOWN2 || (entry->type > IT_DELAYCONSUME && entry->type < IT_CASH ) || entry->type >= IT_MAX ) { diff --git a/src/map/itemdb.h b/src/map/itemdb.h index d33805174..571512e49 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -54,6 +54,7 @@ enum item_itemid { ITEMID_WHITE_POTION = 504, ITEMID_BLUE_POTION = 505, ITEMID_APPLE = 512, + ITEMID_CARROT = 515, ITEMID_HOLY_WATER = 523, ITEMID_PUMPKIN = 535, ITEMID_RED_SLIM_POTION = 545, @@ -64,7 +65,7 @@ enum item_itemid { ITEMID_BRANCH_OF_DEAD_TREE = 604, ITEMID_ANODYNE = 605, ITEMID_ALOEBERA = 606, - ITEMID_MAGNIFIER = 611, + ITEMID_SPECTACLES = 611, ITEMID_POISON_BOTTLE = 678, ITEMID_EMPTY_BOTTLE = 713, ITEMID_EMPERIUM = 714, @@ -92,15 +93,15 @@ enum item_itemid { ITEMID_IRON_ORE = 1002, ITEMID_PHRACON = 1010, ITEMID_EMVERETARCON = 1011, - ITEMID_TRAP = 1065, + ITEMID_BOOBY_TRAP = 1065, ITEMID_PILEBUNCKER = 1549, ITEMID_ANGRA_MANYU = 1599, ITEMID_STRANGE_EMBRYO = 6415, ITEMID_FACE_PAINT = 6120, - ITEMID_SCARLET_POINT = 6360, - ITEMID_INDIGO_POINT = 6361, - ITEMID_YELLOW_WISH_POINT = 6362, - ITEMID_LIME_GREEN_POINT = 6363, + ITEMID_SCARLET_PTS = 6360, + ITEMID_INDIGO_PTS = 6361, + ITEMID_YELLOW_WISH_PTS = 6362, + ITEMID_LIME_GREEN_PTS = 6363, ITEMID_STONE = 7049, ITEMID_FIRE_BOTTLE = 7135, ITEMID_ACID_BOTTLE = 7136, @@ -112,7 +113,8 @@ enum item_itemid { ITEMID_TOKEN_OF_SIEGFRIED = 7621, ITEMID_GOLD_KEY77 = 7782, ITEMID_SILVER_KEY77 = 7783, - ITEMID_TRAP_ALLOY = 7940, + ITEMID_SPECIAL_ALLOY_TRAP = 7940, + ITEMID_CATNIP_FRUIT = 11602, ITEMID_RED_POUCH_OF_SURPRISE = 12024, ITEMID_BLOODY_DEAD_BRANCH = 12103, ITEMID_PORING_BOX = 12109, @@ -137,13 +139,13 @@ enum item_itemid { ITEMID_MAGIC_CASTLE = 12308, ITEMID_BULGING_HEAD = 12309, ITEMID_THICK_MANUAL50 = 12312, - ITEMID_NOVICE_MAGNIFIER = 12325, - ITEMID_ANCILLA = 12333, - ITEMID_REPAIR_A = 12392, - ITEMID_REPAIR_B = 12393, - ITEMID_REPAIR_C = 12394, + ITEMID_N_MAGNIFIER = 12325, + ITEMID_ANSILA = 12333, + ITEMID_REPAIRA = 12392, + ITEMID_REPAIRB = 12393, + ITEMID_REPAIRC = 12394, ITEMID_BLACK_THING = 12435, - ITEMID_REINS_OF_MOUNT = 12622, + ITEMID_BOARDING_HALTER = 12622, ITEMID_NOBLE_NAMEPLATE = 12705, ITEMID_DUN_TELE_SCROLL1 = 14527, ITEMID_BATTLE_MANUAL25 = 14532, @@ -548,7 +550,7 @@ struct item_data { #define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine) #define itemdb_is_rune(n) (((n) >= ITEMID_NAUTHIZ && (n) <= ITEMID_HAGALAZ) || (n) == ITEMID_LUX_ANIMA) -#define itemdb_is_element(n) ((n) >= ITEMID_SCARLET_POINT && (n) <= ITEMID_LIME_GREEN_POINT) +#define itemdb_is_element(n) ((n) >= ITEMID_SCARLET_PTS && (n) <= ITEMID_LIME_GREEN_PTS) #define itemdb_is_spellbook(n) ((n) >= ITEMID_MAGIC_BOOK_FB && (n) <= ITEMID_MAGIC_BOOK_DL) #define itemdb_is_poison(n) ((n) >= ITEMID_POISON_PARALYSIS && (n) <= ITEMID_POISON_FATIGUE) #define itemid_isgemstone(n) ((n) >= ITEMID_YELLOW_GEMSTONE && (n) <= ITEMID_BLUE_GEMSTONE) @@ -617,7 +619,7 @@ struct itemdb_interface { int (*searchrandomid) (struct item_group *group); const char* (*typename) (int type); void (*jobmask2mapid) (uint64 *bclass, uint64 jobmask); - void (*jobid2mapid) (uint64 *bclass, int job_id, bool enable); + void (*jobid2mapid) (uint64 *bclass, int job_class, bool enable); void (*create_dummy_data) (void); struct item_data* (*create_item_data) (int nameid); int (*isequip) (int nameid); diff --git a/src/map/mail.c b/src/map/mail.c index e446a10d2..d8a354cc7 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/mail.h b/src/map/mail.h index 94100e608..0391f83c4 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/map.c b/src/map/map.c index 0a60a92b4..16d5e645d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -337,6 +337,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { //status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure... status_change_end(bl, SC_NJ_TATAMIGAESHI, INVALID_TIMER); status_change_end(bl, SC_MAGICROD, INVALID_TIMER); + status_change_end(bl, SC_SU_STOOP, INVALID_TIMER); if (sc && sc->data[SC_PROPERTYWALK] && sc->data[SC_PROPERTYWALK]->val3 >= skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER); @@ -4138,7 +4139,7 @@ bool map_read_npclist(const char *filename, bool imported) if (!libconfig->load_file(&config, filename)) return false; - deleted_npcs = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, MAP_NAME_LENGTH); + deleted_npcs = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, 0); // Remove NPCs if ((setting = libconfig->lookup(&config, "npc_removed_list")) != NULL) { diff --git a/src/map/map.h b/src/map/map.h index 723691971..8c5372093 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -47,6 +47,7 @@ enum E_MAPSERVER_ST { #define MAX_NPC_PER_MAP 512 #define AREA_SIZE (battle->bc->area_size) +#define CHAT_AREA_SIZE (battle->bc->chat_area_size) #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 #define MAX_MOBSKILL 50 @@ -74,7 +75,7 @@ enum E_MAPSERVER_ST { //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type. enum { //Novice And 1-1 Jobs - MAPID_NOVICE = 0x0, + MAPID_NOVICE = 0, MAPID_SWORDMAN, MAPID_MAGE, MAPID_ARCHER, @@ -88,118 +89,250 @@ enum { MAPID_XMAS, MAPID_SUMMER, MAPID_GANGSI, + MAPID_SUMMONER, + MAPID_1_1_MAX, + //2-1 Jobs - MAPID_SUPER_NOVICE = JOBL_2_1|0x0, - MAPID_KNIGHT, - MAPID_WIZARD, - MAPID_HUNTER, - MAPID_PRIEST, - MAPID_BLACKSMITH, - MAPID_ASSASSIN, - MAPID_STAR_GLADIATOR, - MAPID_REBELLION = JOBL_2_1|0x09, - MAPID_KAGEROUOBORO = JOBL_2_1|0x0A, - MAPID_DEATH_KNIGHT = JOBL_2_1|0x0E, + MAPID_SUPER_NOVICE = JOBL_2_1 | MAPID_NOVICE, + MAPID_KNIGHT = JOBL_2_1 | MAPID_SWORDMAN, + MAPID_WIZARD = JOBL_2_1 | MAPID_MAGE, + MAPID_HUNTER = JOBL_2_1 | MAPID_ARCHER, + MAPID_PRIEST = JOBL_2_1 | MAPID_ACOLYTE, + MAPID_BLACKSMITH = JOBL_2_1 | MAPID_MERCHANT, + MAPID_ASSASSIN = JOBL_2_1 | MAPID_THIEF, + MAPID_STAR_GLADIATOR = JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_2_1 | MAPID_WEDDING, + MAPID_REBELLION = JOBL_2_1 | MAPID_GUNSLINGER, + MAPID_KAGEROUOBORO = JOBL_2_1 | MAPID_NINJA, + // = JOBL_2_1 | MAPID_XMAS, + // = JOBL_2_1 | MAPID_SUMMER, + MAPID_DEATH_KNIGHT = JOBL_2_1 | MAPID_GANGSI, + // = JOBL_2_1 | MAPID_SUMMONER, + //2-2 Jobs - MAPID_CRUSADER = JOBL_2_2|0x1, - MAPID_SAGE, - MAPID_BARDDANCER, - MAPID_MONK, - MAPID_ALCHEMIST, - MAPID_ROGUE, - MAPID_SOUL_LINKER, - MAPID_DARK_COLLECTOR = JOBL_2_2|0x0E, + // = JOBL_2_1 | MAPID_NOVICE, + MAPID_CRUSADER = JOBL_2_2 | MAPID_SWORDMAN, + MAPID_SAGE = JOBL_2_2 | MAPID_MAGE, + MAPID_BARDDANCER = JOBL_2_2 | MAPID_ARCHER, + MAPID_MONK = JOBL_2_2 | MAPID_ACOLYTE, + MAPID_ALCHEMIST = JOBL_2_2 | MAPID_MERCHANT, + MAPID_ROGUE = JOBL_2_2 | MAPID_THIEF, + MAPID_SOUL_LINKER = JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_2_2 | MAPID_WEDDING, + // = JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_2_2 | MAPID_NINJA, + // = JOBL_2_2 | MAPID_XMAS, + // = JOBL_2_2 | MAPID_SUMMER, + MAPID_DARK_COLLECTOR = JOBL_2_2 | MAPID_GANGSI, + // = JOBL_2_2 | MAPID_SUMMONER, + //Trans Novice And Trans 1-1 Jobs - MAPID_NOVICE_HIGH = JOBL_UPPER|0x0, - MAPID_SWORDMAN_HIGH, - MAPID_MAGE_HIGH, - MAPID_ARCHER_HIGH, - MAPID_ACOLYTE_HIGH, - MAPID_MERCHANT_HIGH, - MAPID_THIEF_HIGH, + MAPID_NOVICE_HIGH = JOBL_UPPER | MAPID_NOVICE, + MAPID_SWORDMAN_HIGH = JOBL_UPPER | MAPID_SWORDMAN, + MAPID_MAGE_HIGH = JOBL_UPPER | MAPID_MAGE, + MAPID_ARCHER_HIGH = JOBL_UPPER | MAPID_ARCHER, + MAPID_ACOLYTE_HIGH = JOBL_UPPER | MAPID_ACOLYTE, + MAPID_MERCHANT_HIGH = JOBL_UPPER | MAPID_MERCHANT, + MAPID_THIEF_HIGH = JOBL_UPPER | MAPID_THIEF, + // = JOBL_UPPER | MAPID_TAEKWON, + // = JOBL_UPPER | MAPID_WEDDING, + // = JOBL_UPPER | MAPID_GUNSLINGER, + // = JOBL_UPPER | MAPID_NINJA, + // = JOBL_UPPER | MAPID_XMAS, + // = JOBL_UPPER | MAPID_SUMMER, + // = JOBL_UPPER | MAPID_GANGSI, + // = JOBL_UPPER | MAPID_SUMMONER, + //Trans 2-1 Jobs - MAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1, - MAPID_HIGH_WIZARD, - MAPID_SNIPER, - MAPID_HIGH_PRIEST, - MAPID_WHITESMITH, - MAPID_ASSASSIN_CROSS, + // = JOBL_UPPER | JOBL_2_1 | MAPID_NOVICE, + MAPID_LORD_KNIGHT = JOBL_UPPER | JOBL_2_1 | MAPID_SWORDMAN, + MAPID_HIGH_WIZARD = JOBL_UPPER | JOBL_2_1 | MAPID_MAGE, + MAPID_SNIPER = JOBL_UPPER | JOBL_2_1 | MAPID_ARCHER, + MAPID_HIGH_PRIEST = JOBL_UPPER | JOBL_2_1 | MAPID_ACOLYTE, + MAPID_WHITESMITH = JOBL_UPPER | JOBL_2_1 | MAPID_MERCHANT, + MAPID_ASSASSIN_CROSS = JOBL_UPPER | JOBL_2_1 | MAPID_THIEF, + // = JOBL_UPPER | JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_UPPER | JOBL_2_1 | MAPID_WEDDING, + // = JOBL_UPPER | JOBL_2_1 | MAPID_GUNSLINGER, + // = JOBL_UPPER | JOBL_2_1 | MAPID_NINJA, + // = JOBL_UPPER | JOBL_2_1 | MAPID_XMAS, + // = JOBL_UPPER | JOBL_2_1 | MAPID_SUMMER, + // = JOBL_UPPER | JOBL_2_1 | MAPID_GANGSI, + // = JOBL_UPPER | JOBL_2_1 | MAPID_SUMMONER, + //Trans 2-2 Jobs - MAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1, - MAPID_PROFESSOR, - MAPID_CLOWNGYPSY, - MAPID_CHAMPION, - MAPID_CREATOR, - MAPID_STALKER, + // = JOBL_UPPER | JOBL_2_2 | MAPID_NOVICE, + MAPID_PALADIN = JOBL_UPPER | JOBL_2_2 | MAPID_SWORDMAN, + MAPID_PROFESSOR = JOBL_UPPER | JOBL_2_2 | MAPID_MAGE, + MAPID_CLOWNGYPSY = JOBL_UPPER | JOBL_2_2 | MAPID_ARCHER, + MAPID_CHAMPION = JOBL_UPPER | JOBL_2_2 | MAPID_ACOLYTE, + MAPID_CREATOR = JOBL_UPPER | JOBL_2_2 | MAPID_MERCHANT, + MAPID_STALKER = JOBL_UPPER | JOBL_2_2 | MAPID_THIEF, + // = JOBL_UPPER | JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_UPPER | JOBL_2_2 | MAPID_WEDDING, + // = JOBL_UPPER | JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_UPPER | JOBL_2_2 | MAPID_NINJA, + // = JOBL_UPPER | JOBL_2_2 | MAPID_XMAS, + // = JOBL_UPPER | JOBL_2_2 | MAPID_SUMMER, + // = JOBL_UPPER | JOBL_2_2 | MAPID_GANGSI, + // = JOBL_UPPER | JOBL_2_2 | MAPID_SUMMONER, + //Baby Novice And Baby 1-1 Jobs - MAPID_BABY = JOBL_BABY|0x0, - MAPID_BABY_SWORDMAN, - MAPID_BABY_MAGE, - MAPID_BABY_ARCHER, - MAPID_BABY_ACOLYTE, - MAPID_BABY_MERCHANT, - MAPID_BABY_THIEF, + MAPID_BABY = JOBL_BABY | MAPID_NOVICE, + MAPID_BABY_SWORDMAN = JOBL_BABY | MAPID_SWORDMAN, + MAPID_BABY_MAGE = JOBL_BABY | MAPID_MAGE, + MAPID_BABY_ARCHER = JOBL_BABY | MAPID_ARCHER, + MAPID_BABY_ACOLYTE = JOBL_BABY | MAPID_ACOLYTE, + MAPID_BABY_MERCHANT = JOBL_BABY | MAPID_MERCHANT, + MAPID_BABY_THIEF = JOBL_BABY | MAPID_THIEF, + // = JOBL_BABY | MAPID_TAEKWON, + // = JOBL_BABY | MAPID_WEDDING, + // = JOBL_BABY | MAPID_GUNSLINGER, + // = JOBL_BABY | MAPID_NINJA, + // = JOBL_BABY | MAPID_XMAS, + // = JOBL_BABY | MAPID_SUMMER, + // = JOBL_BABY | MAPID_GANGSI, + // = JOBL_BABY | MAPID_SUMMONER, + //Baby 2-1 Jobs - MAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0, - MAPID_BABY_KNIGHT, - MAPID_BABY_WIZARD, - MAPID_BABY_HUNTER, - MAPID_BABY_PRIEST, - MAPID_BABY_BLACKSMITH, - MAPID_BABY_ASSASSIN, + MAPID_SUPER_BABY = JOBL_BABY | JOBL_2_1 | MAPID_NOVICE, + MAPID_BABY_KNIGHT = JOBL_BABY | JOBL_2_1 | MAPID_SWORDMAN, + MAPID_BABY_WIZARD = JOBL_BABY | JOBL_2_1 | MAPID_MAGE, + MAPID_BABY_HUNTER = JOBL_BABY | JOBL_2_1 | MAPID_ARCHER, + MAPID_BABY_PRIEST = JOBL_BABY | JOBL_2_1 | MAPID_ACOLYTE, + MAPID_BABY_BLACKSMITH = JOBL_BABY | JOBL_2_1 | MAPID_MERCHANT, + MAPID_BABY_ASSASSIN = JOBL_BABY | JOBL_2_1 | MAPID_THIEF, + // = JOBL_BABY | JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_BABY | JOBL_2_1 | MAPID_WEDDING, + // = JOBL_BABY | JOBL_2_1 | MAPID_GUNSLINGER, + // = JOBL_BABY | JOBL_2_1 | MAPID_NINJA, + // = JOBL_BABY | JOBL_2_1 | MAPID_XMAS, + // = JOBL_BABY | JOBL_2_1 | MAPID_SUMMER, + // = JOBL_BABY | JOBL_2_1 | MAPID_GANGSI, + // = JOBL_BABY | JOBL_2_1 | MAPID_SUMMONER, + //Baby 2-2 Jobs - MAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1, - MAPID_BABY_SAGE, - MAPID_BABY_BARDDANCER, - MAPID_BABY_MONK, - MAPID_BABY_ALCHEMIST, - MAPID_BABY_ROGUE, + // = JOBL_BABY | JOBL_2_2 | MAPID_NOVICE, + MAPID_BABY_CRUSADER = JOBL_BABY | JOBL_2_2 | MAPID_SWORDMAN, + MAPID_BABY_SAGE = JOBL_BABY | JOBL_2_2 | MAPID_MAGE, + MAPID_BABY_BARDDANCER = JOBL_BABY | JOBL_2_2 | MAPID_ARCHER, + MAPID_BABY_MONK = JOBL_BABY | JOBL_2_2 | MAPID_ACOLYTE, + MAPID_BABY_ALCHEMIST = JOBL_BABY | JOBL_2_2 | MAPID_MERCHANT, + MAPID_BABY_ROGUE = JOBL_BABY | JOBL_2_2 | MAPID_THIEF, + // = JOBL_BABY | JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_BABY | JOBL_2_2 | MAPID_WEDDING, + // = JOBL_BABY | JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_BABY | JOBL_2_2 | MAPID_NINJA, + // = JOBL_BABY | JOBL_2_2 | MAPID_XMAS, + // = JOBL_BABY | JOBL_2_2 | MAPID_SUMMER, + // = JOBL_BABY | JOBL_2_2 | MAPID_GANGSI, + // = JOBL_BABY | JOBL_2_2 | MAPID_SUMMONER, + //3-1 Jobs - MAPID_SUPER_NOVICE_E = JOBL_THIRD|JOBL_2_1|0x0, - MAPID_RUNE_KNIGHT, - MAPID_WARLOCK, - MAPID_RANGER, - MAPID_ARCH_BISHOP, - MAPID_MECHANIC, - MAPID_GUILLOTINE_CROSS, + MAPID_SUPER_NOVICE_E = JOBL_THIRD | JOBL_2_1 | MAPID_NOVICE, + MAPID_RUNE_KNIGHT = JOBL_THIRD | JOBL_2_1 | MAPID_SWORDMAN, + MAPID_WARLOCK = JOBL_THIRD | JOBL_2_1 | MAPID_MAGE, + MAPID_RANGER = JOBL_THIRD | JOBL_2_1 | MAPID_ARCHER, + MAPID_ARCH_BISHOP = JOBL_THIRD | JOBL_2_1 | MAPID_ACOLYTE, + MAPID_MECHANIC = JOBL_THIRD | JOBL_2_1 | MAPID_MERCHANT, + MAPID_GUILLOTINE_CROSS = JOBL_THIRD | JOBL_2_1 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_2_1 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_2_1 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_2_1 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_2_1 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_2_1 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_2_1 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_2_1 | MAPID_SUMMONER, + //3-2 Jobs - MAPID_ROYAL_GUARD = JOBL_THIRD|JOBL_2_2|0x1, - MAPID_SORCERER, - MAPID_MINSTRELWANDERER, - MAPID_SURA, - MAPID_GENETIC, - MAPID_SHADOW_CHASER, + // = JOBL_THIRD | JOBL_2_2 | MAPID_NOVICE, + MAPID_ROYAL_GUARD = JOBL_THIRD | JOBL_2_2 | MAPID_SWORDMAN, + MAPID_SORCERER = JOBL_THIRD | JOBL_2_2 | MAPID_MAGE, + MAPID_MINSTRELWANDERER = JOBL_THIRD | JOBL_2_2 | MAPID_ARCHER, + MAPID_SURA = JOBL_THIRD | JOBL_2_2 | MAPID_ACOLYTE, + MAPID_GENETIC = JOBL_THIRD | JOBL_2_2 | MAPID_MERCHANT, + MAPID_SHADOW_CHASER = JOBL_THIRD | JOBL_2_2 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_2_2 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_2_2 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_2_2 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_2_2 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_2_2 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_2_2 | MAPID_SUMMONER, + //Trans 3-1 Jobs - MAPID_RUNE_KNIGHT_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_1|0x1, - MAPID_WARLOCK_T, - MAPID_RANGER_T, - MAPID_ARCH_BISHOP_T, - MAPID_MECHANIC_T, - MAPID_GUILLOTINE_CROSS_T, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_NOVICE, + MAPID_RUNE_KNIGHT_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_SWORDMAN, + MAPID_WARLOCK_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_MAGE, + MAPID_RANGER_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_ARCHER, + MAPID_ARCH_BISHOP_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_ACOLYTE, + MAPID_MECHANIC_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_MERCHANT, + MAPID_GUILLOTINE_CROSS_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_1 | MAPID_SUMMONER, + //Trans 3-2 Jobs - MAPID_ROYAL_GUARD_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_2|0x1, - MAPID_SORCERER_T, - MAPID_MINSTRELWANDERER_T, - MAPID_SURA_T, - MAPID_GENETIC_T, - MAPID_SHADOW_CHASER_T, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_NOVICE, + MAPID_ROYAL_GUARD_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_SWORDMAN, + MAPID_SORCERER_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_MAGE, + MAPID_MINSTRELWANDERER_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_ARCHER, + MAPID_SURA_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_ACOLYTE, + MAPID_GENETIC_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_MERCHANT, + MAPID_SHADOW_CHASER_T = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_UPPER | JOBL_2_2 | MAPID_SUMMONER, + //Baby 3-1 Jobs - MAPID_SUPER_BABY_E = JOBL_THIRD|JOBL_BABY|JOBL_2_1|0x0, - MAPID_BABY_RUNE, - MAPID_BABY_WARLOCK, - MAPID_BABY_RANGER, - MAPID_BABY_BISHOP, - MAPID_BABY_MECHANIC, - MAPID_BABY_CROSS, + MAPID_SUPER_BABY_E = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_NOVICE, + MAPID_BABY_RUNE = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_SWORDMAN, + MAPID_BABY_WARLOCK = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_MAGE, + MAPID_BABY_RANGER = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_ARCHER, + MAPID_BABY_BISHOP = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_ACOLYTE, + MAPID_BABY_MECHANIC = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_MERCHANT, + MAPID_BABY_CROSS = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_1 | MAPID_SUMMONER, + //Baby 3-2 Jobs - MAPID_BABY_GUARD = JOBL_THIRD|JOBL_BABY|JOBL_2_2|0x1, - MAPID_BABY_SORCERER, - MAPID_BABY_MINSTRELWANDERER, - MAPID_BABY_SURA, - MAPID_BABY_GENETIC, - MAPID_BABY_CHASER, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_NOVICE, + MAPID_BABY_GUARD = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_SWORDMAN, + MAPID_BABY_SORCERER = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_MAGE, + MAPID_BABY_MINSTRELWANDERER = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_ARCHER, + MAPID_BABY_SURA = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_ACOLYTE, + MAPID_BABY_GENETIC = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_MERCHANT, + MAPID_BABY_CHASER = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_THIEF, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_TAEKWON, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_WEDDING, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_GUNSLINGER, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_NINJA, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_XMAS, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_SUMMER, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_GANGSI, + // = JOBL_THIRD | JOBL_BABY | JOBL_2_2 | MAPID_SUMMONER, }; +STATIC_ASSERT(((MAPID_1_1_MAX - 1) | MAPID_BASEMASK) == MAPID_BASEMASK, "First class map IDs do not fit into MAPID_BASEMASK"); + // Max size for inputs to Graffiti, Talkie Box and Vending text prompts #define MESSAGE_SIZE (79 + 1) // String length you can write in the 'talking box' diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 0b055bedf..f5d3fe11c 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -444,7 +444,7 @@ bool read_mercenarydb_sub(char* str[], int columns, int current) { db->lv = atoi(str[3]); mstatus = &db->status; - db->vd.class_ = db->class_; + db->vd.class = db->class_; mstatus->max_hp = atoi(str[4]); mstatus->max_sp = atoi(str[5]); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 142460e2a..0af75e8a2 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/mob.c b/src/map/mob.c index 590cbf856..d5932f195 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1652,7 +1652,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { memmove(&md->lootitem[0], &md->lootitem[1], (LOOTITEM_SIZE-1)*sizeof(md->lootitem[0])); memcpy (&md->lootitem[LOOTITEM_SIZE-1], &fitem->item_data, sizeof(md->lootitem[0])); } - if (pc->db_checkid(md->vd->class_)) { + if (pc->db_checkid(md->vd->class)) { //Give them walk act/delay to properly mimic players. [Skotlex] clif->takeitem(&md->bl,tbl); md->ud.canact_tick = tick + md->status.amotion; @@ -2635,7 +2635,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if( sd ) { if( sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex] if (++sd->mission_count >= 100 && (temp = mob->get_random_id(0, 0xE, sd->status.base_level)) != 0) { - pc->addfame(sd, 1); + pc->addfame(sd, RANKTYPE_TAEKWON, 1); sd->mission_mobid = temp; pc_setglobalreg(sd,script->add_str("TK_MISSION_ID"), temp); sd->mission_count = 0; @@ -2684,7 +2684,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if( !rebirth ) { - if( pc->db_checkid(md->vd->class_) ) {//Player mobs are not removed automatically by the client. + if (pc->db_checkid(md->vd->class)) { + // Player mobs are not removed automatically by the client. /* first we set them dead, then we delay the out sight effect */ clif->clearunit_area(&md->bl,CLR_DEAD); clif->clearunit_delayed(&md->bl, CLR_OUTSIGHT,tick+3000); @@ -2831,7 +2832,7 @@ int mob_class_change (struct mob_data *md, int class_) { mob_stop_walking(md, STOPWALKING_FLAG_NONE); unit->skillcastcancel(&md->bl, 0); status->set_viewdata(&md->bl, class_); - clif->class_change(&md->bl, md->vd->class_, 1); + clif->class_change(&md->bl, md->vd->class, 1); status_calc_mob(md, SCO_FIRST); md->ud.state.speed_changed = 1; //Speed change update. @@ -3491,8 +3492,8 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons //Go Backwards to give better priority to advanced skills. for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) { - int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][j].idx; - int skill_id = pc->skill_tree[pc->class2idx(sd->status.class_)][j].id; + int idx = pc->skill_tree[pc->class2idx(sd->status.class)][j].idx; + int skill_id = pc->skill_tree[pc->class2idx(sd->status.class)][j].id; if (!skill_id || sd->status.skill[idx].lv < 1 || (skill->dbs->db[idx].inf2&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL)) ) @@ -4209,7 +4210,7 @@ int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source) return 0; } md.mob_id = i32; - md.vd.class_ = md.mob_id; + md.vd.class = md.mob_id; if ((t = libconfig->setting_get_member(mobt, "Inherit")) && (inherit = libconfig->setting_get_bool(t))) { if (!mob->db_data[md.mob_id]) { @@ -4563,7 +4564,7 @@ void mob_name_constants(void) { *------------------------------------------*/ bool mob_readdb_mobavail(char* str[], int columns, int current) { - int class_, k; + int class_, view_class; nullpo_retr(false, str); class_=atoi(str[0]); @@ -4574,13 +4575,13 @@ bool mob_readdb_mobavail(char* str[], int columns, int current) return false; } - k=atoi(str[1]); + view_class = atoi(str[1]); memset(&mob->db_data[class_]->vd, 0, sizeof(struct view_data)); - mob->db_data[class_]->vd.class_=k; + mob->db_data[class_]->vd.class = view_class; //Player sprites - if(pc->db_checkid(k) && columns==12) { + if (pc->db_checkid(view_class) && columns == 12) { mob->db_data[class_]->vd.sex=atoi(str[2]); mob->db_data[class_]->vd.hair_style=atoi(str[3]); mob->db_data[class_]->vd.hair_color=atoi(str[4]); diff --git a/src/map/mob.h b/src/map/mob.h index 60bc4b869..7f2accedf 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/npc.c b/src/map/npc.c index 9791b66a5..a824d4216 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -4961,11 +4961,11 @@ int do_init_npc(bool minimal) { //Stock view data for normal npcs. memset(&npc_viewdb, 0, sizeof(npc_viewdb)); - npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here. + npc_viewdb[0].class = INVISIBLE_CLASS; //Invisible class is stored here. for( i = 1; i < MAX_NPC_CLASS; i++ ) - npc_viewdb[i].class_ = i; + npc_viewdb[i].class = i; for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ ) - npc_viewdb2[i - MAX_NPC_CLASS2_START].class_ = i; + npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i; npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH); npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH); diff --git a/src/map/npc.h b/src/map/npc.h index 24ea9ea59..6180e9765 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 7eb317e49..b8caa5df3 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/packets.h b/src/map/packets.h index 8b0a733c7..c622cb89d 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1868,15 +1868,111 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0859,-1); #endif +// 2010-12-21aRagexe +#if PACKETVER >= 20101221 +// shuffle packets not added +// new packets + packet(0x08b1,-1); // ZC_MCSTORE_NOTMOVEITEM_LIST +#endif + +// 2011-01-11aRagexe +#if PACKETVER >= 20110111 +// shuffle packets not added +// new packets + packet(0x08b3,-1); // ZC_SHOWSCRIPT +#endif + +// 2011-01-25aRagexe +#if PACKETVER >= 20110125 +// shuffle packets not added +// new packets + packet(0x08b4,2); // ZC_START_COLLECTION + packet(0x08b5,6,clif->pDull,2); // CZ_TRYCOLLECTION + packet(0x08b6,3); // ZC_TRYCOLLECTION +#endif + +// 2011-01-31aRagexe +#if PACKETVER >= 20110131 +// shuffle packets not added +// new packets + packet(0x02f3,-1,clif->pDull); // CZ_IRMAIL_SEND + packet(0x02f4,3); // ZC_IRMAIL_SEND_RES + packet(0x02f5,7); // ZC_IRMAIL_NOTIFY + packet(0x02f6,7,clif->pDull,2); // CZ_IRMAIL_LIST +#endif + +// 2011-02-22aRagexe +#if PACKETVER >= 20110222 +// shuffle packets not added +// new packets + packet(0x08c0,-1); // ZC_ACK_SE_CASH_ITEM_LIST2 + packet(0x08c1,2,clif->pDull); // CZ_MACRO_START + packet(0x08c2,2,clif->pDull); // CZ_MACRO_STOP +#endif + +// 2011-04-19aRagexe +#if PACKETVER >= 20110419 +// shuffle packets not added +// new packets + packet(0x08c7,-1); // ZC_SKILL_ENTRY3 +#endif + +// 2011-06-14aRagexe +#if PACKETVER >= 20110614 +// shuffle packets not added +// new packets + packet(0x08c8,34); // ZC_NOTIFY_ACT3 + packet(0x08c9,2,clif->pCashShopSchedule,0); + packet(0x08ca,-1); // ZC_ACK_SCHEDULER_CASHITEM +#endif + +// 2011-06-27aRagexe +#if PACKETVER >= 20110627 +// shuffle packets not added +// new packets + packet(0x08cb,-1); // ZC_PERSONAL_INFOMATION +#endif + //2011-07-18aRagexe (Thanks to Yommy!) #if PACKETVER >= 20110718 +// shuffle packets not added packet(0x0844,2,clif->pCashShopOpen,2);/* tell server cashshop window is being open */ packet(0x084a,2,clif->pCashShopClose,2);/* tell server cashshop window is being closed */ packet(0x0846,4,clif->pCashShopReqTab,2); - packet(0x08c9,2,clif->pCashShopSchedule,0); packet(0x0848,-1,clif->pCashShopBuy,2); #endif +// 2011-08-02aRagexe +#if PACKETVER >= 20110802 +// shuffle packets not added +// new packets + packet(0x09dc,2); // unknown +#endif + +// 2011-08-09aRagexe +#if PACKETVER >= 20110809 +// shuffle packets not added +// new packets + packet(0x08cf,10); // ZC_SPIRITS_ATTRIBUTE + packet(0x08d0,9); // ZC_REQ_WEAR_EQUIP_ACK2 + packet(0x08d1,7); // ZC_REQ_TAKEOFF_EQUIP_ACK2 + packet(0x08d2,10); // ZC_FASTMOVE +#endif + +// 2011-08-16aRagexe +#if PACKETVER >= 20110816 +// shuffle packets not added +// new packets + packet(0x08d3,10); // ZC_SE_CASHSHOP_UPDATE +#endif + +// 2011-09-28aRagexe +#if PACKETVER >= 20110928 +// shuffle packets not added +// new packets + packet(0x08d6,6); // ZC_CLEAR_DIALOG +#endif + //2011-10-05aRagexeRE #if PACKETVER >= 20111005 packet(0x0364,5,clif->pWalkToXY,2); @@ -1891,7 +1987,6 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x088a,6,clif->pGetCharNameRequest,2); packet(0x0838,6,clif->pSolveCharName,2); packet(0x0439,8,clif->pUseItem,2,4); - packet(0x08d2,10); packet(0x08d7,28,clif->pBGQueueRegister,2); packet(0x090a,26,clif->pBGQueueCheckState,2); packet(0x08da,26,clif->pBGQueueRevokeReq,2); @@ -1954,6 +2049,8 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); packet(0x0439,8,clif->pUseItem,2,4); +// changed packet sizes + packet(0x08e2,27); // ZC_NAVIGATION_ACTIVE #endif //2012-04-10aRagexeRE @@ -2021,7 +2118,6 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x08FB,6,clif->pDull,2); //bookingcanceljoinparty packet(0x0907,5,clif->pMoveItem,2,4); packet(0x0908,5); - packet(0x08CF,10);//Amulet spirits packet(0x0977,14);//Monster HP Bar #endif @@ -2042,18 +2138,26 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x096A,6,clif->pGetCharNameRequest,2); packet(0x0368,6,clif->pSolveCharName,2); packet(0x08E5,41,clif->pPartyRecruitRegisterReq,2,4); - packet(0x08d2,10); packet(0x0916,26,clif->pGuildInvite2,2); #endif +// 2012-05-02aRagexeRE +#if PACKETVER >= 20120502 +// shuffle packets not added + packet(0x097d,288); // ZC_ACK_RANKING + packet(0x097e,12); // ZC_UPDATE_RANKING_POINT +#endif + #ifndef PACKETVER_RE #if PACKETVER >= 20120604 +// shuffle packets not added packet(0x0861,18,clif->pPartyRecruitRegisterReq,2,4,6); #endif #endif //2012-06-18aRagexeRE #if PACKETVER >= 20120618 +// shuffle packets not added packet(0x0983,29); #endif @@ -2112,6 +2216,8 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); packet(0x096A,6,clif->pGetCharNameRequest,2); packet(0x0368,6,clif->pSolveCharName,2); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK #endif //2013-03-20Ragexe (Judas + Yommy) @@ -2142,14 +2248,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x085D,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - //packet(0x095A,8); // unknown usage packet(0x0868,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0888,19,clif->pWantToConnection,2,6,10,14,18); packet(0x086D,26,clif->pPartyInvite2,2); - //packet(0x0890,4); // unknown usage packet(0x086F,26,clif->pFriendsListAdd,2); packet(0x093F,5,clif->pHomMenu,2,4); packet(0x0947,36,clif->pStoragePassword,0); + packet(0x0890,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x095a,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD // Shuffle End // New Packets @@ -2187,14 +2293,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x092D,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - //packet(0x08AA,8); // CZ_JOIN_BATTLE_FIELD packet(0x0963,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0943,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0947,26,clif->pPartyInvite2,2); - //packet(0x0862,4); // CZ_GANGSI_RANK packet(0x0962,26,clif->pFriendsListAdd,2); packet(0x0931,5,clif->pHomMenu,2,4); packet(0x093E,36,clif->pStoragePassword,0); + packet(0x0862,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x08aa,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD // Shuffle End #endif @@ -2226,14 +2332,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x089B,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - //packet(0x0965,8); // CZ_JOIN_BATTLE_FIELD packet(0x086A,-1,clif->pItemListWindowSelected,2,4,8); packet(0x08A9,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0950,26,clif->pPartyInvite2,2); - //packet(0x08AC,4); // CZ_GANGSI_RANK packet(0x0362,26,clif->pFriendsListAdd,2); packet(0x0926,5,clif->pHomMenu,2,4); packet(0x088E,36,clif->pStoragePassword,0); + packet(0x08ac,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x0965,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD // Shuffle End #endif @@ -2264,14 +2370,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0874,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x088E,8); // CZ_JOIN_BATTLE_FIELD packet(0x0958,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0919,19,clif->pWantToConnection,2,6,10,14,18); packet(0x08A8,26,clif->pPartyInvite2,2); - // packet(0x0888,4); // CZ_GANGSI_RANK packet(0x0877,26,clif->pFriendsListAdd,2); packet(0x023B,5,clif->pHomMenu,2,4); packet(0x0956,36,clif->pStoragePassword,0); + packet(0x0888,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x088e,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif //2013-06-05Ragexe (Shakto) @@ -2301,19 +2407,20 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x023B,26,clif->pFriendsListAdd,2); packet(0x0361,5,clif->pHomMenu,2,4); packet(0x0883,36,clif->pStoragePassword,0); packet(0x097C,4,clif->pRanklist); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK #endif //2013-06-12Ragexe (Shakto) #if PACKETVER >= 20130612 +// most shuffle packets used from 20130605 packet(0x087E,5,clif->pChangeDir,2,4); packet(0x0919,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0940,26,clif->pFriendsListAdd,2); @@ -2348,14 +2455,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x08A7,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x087A,8); // CZ_JOIN_BATTLE_FIELD packet(0x0942,-1,clif->pItemListWindowSelected,2,4,8); packet(0x095B,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0887,26,clif->pPartyInvite2,2); - // packet(0x0878,4); // CZ_GANGSI_RANK packet(0x0953,26,clif->pFriendsListAdd,2); packet(0x02C4,5,clif->pHomMenu,2,4); packet(0x0864,36,clif->pStoragePassword,0); + packet(0x0878,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x087a,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif //2013-06-26Ragexe (Shakto) @@ -2385,14 +2492,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0894,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x0860,8); // CZ_JOIN_BATTLE_FIELD packet(0x08A5,-1,clif->pItemListWindowSelected,2,4,8); packet(0x088C,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0895,26,clif->pPartyInvite2,2); - // packet(0x088F,4); // CZ_GANGSI_RANK packet(0x08AB,26,clif->pFriendsListAdd,2); packet(0x0960,5,clif->pHomMenu,2,4); packet(0x0930,36,clif->pStoragePassword,0); + packet(0x0860,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x088f,4,clif->pDull); // CZ_GANGSI_RANK #endif //2013-07-03Ragexe (Shakto) @@ -2410,18 +2517,19 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x0360,26,clif->pFriendsListAdd,2); packet(0x094A,5,clif->pHomMenu,2,4); packet(0x0873,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK #endif /* Bank System [Yommy/Hercules] */ #if PACKETVER >= 20130724 +// shuffle packets not added packet(0x09A6,12); // ZC_BANKING_CHECK packet(0x09A7,10,clif->pBankDeposit,2,4,6); packet(0x09A8,16); // ZC_ACK_BANKING_DEPOSIT @@ -2462,14 +2570,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x023B,26,clif->pFriendsListAdd,2); packet(0x0361,5,clif->pHomMenu,2,4); packet(0x0887,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK #endif //2013-08-14aRagexe - Themon @@ -2499,14 +2607,14 @@ packet(0x96e,-1,clif->ackmergeitems); #else // not PACKETVER_RE packet(0x0959,18,clif->pPartyBookingRegisterReq,2,4); #endif // PACKETVER_RE - // packet(0x0896,8); // CZ_JOIN_BATTLE_FIELD packet(0x08A4,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0368,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0927,26,clif->pPartyInvite2,2); - // packet(0x0815,4); // CZ_GANGSI_RANK packet(0x0281,26,clif->pFriendsListAdd,2); packet(0x0958,5,clif->pHomMenu,2,4); packet(0x0885,36,clif->pStoragePassword,0); + packet(0x0815,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x0896,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif // 2013-12-18bRagexe - Yommy @@ -2532,14 +2640,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x092F,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x087B,4); // CZ_GANGSI_RANK packet(0x08AB,26,clif->pFriendsListAdd,2); packet(0x0811,5,clif->pHomMenu,2,4); packet(0x085C,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x087b,4,clif->pDull); // CZ_GANGSI_RANK /* New */ packet(0x09d4,2,clif->pNPCShopClosed); packet(0x09ce,102,clif->pGM_Monster_Item,2); @@ -2571,14 +2679,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022d,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x023B,26,clif->pFriendsListAdd,2); packet(0x0361,5,clif->pHomMenu,2,4); packet(0x08A4,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK packet(0x09df,7); packet(0x09cb,17); #endif @@ -2606,20 +2714,21 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x094C,2,clif->pReqCloseBuyingStore,0); packet(0x0365,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x091F,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x093E,8); // CZ_JOIN_BATTLE_FIELD packet(0x022D,-1,clif->pItemListWindowSelected,2,4,8); packet(0x089C,19,clif->pWantToConnection,2,6,10,14,18); packet(0x08A9,26,clif->pPartyInvite2,2); - // packet(0x087E,4); // CZ_GANGSI_RANK packet(0x0943,26,clif->pFriendsListAdd,2); packet(0x0949,5,clif->pHomMenu,2,4); packet(0x091D,36,clif->pStoragePassword,0); + packet(0x087e,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x093e,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif // 2014 Packet Data // 2014-01-15eRagexe - YomRawr #if PACKETVER >= 20140115 +// probably for some shuffle packets used wrong id packet(0x0369,7,clif->pActionRequest,2,6); packet(0x083C,10,clif->pUseSkillToId,2,4,6); packet(0x0437,5,clif->pWalkToXY,2); @@ -2641,11 +2750,11 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0965,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x096A,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x088A,8); // CZ_JOIN_BATTLE_FIELD + // packet(0x088A,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0965,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0966,19,clif->pWantToConnection,2,6,10,14,18); packet(0x095D,26,clif->pPartyInvite2,2); - // packet(0x095B,4); // CZ_GANGSI_RANK + // packet(0x095B,4,clif->pDull); // CZ_GANGSI_RANK packet(0x089B,26,clif->pFriendsListAdd,2); packet(0x092D,5,clif->pHomMenu,2,4); packet(0x0865,36,clif->pStoragePassword,0); @@ -2674,14 +2783,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x023B,26,clif->pFriendsListAdd,2); packet(0x0361,5,clif->pHomMenu,2,4); packet(0x0938,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK packet(0x09DF,7); #endif @@ -2708,14 +2817,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0361,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0438,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0878,4); // CZ_GANGSI_RANK packet(0x07E4,26,clif->pFriendsListAdd,2); packet(0x0934,5,clif->pHomMenu,2,4); packet(0x095e,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0878,4,clif->pDull); // CZ_GANGSI_RANK packet(0x09DF,7); #endif @@ -2742,14 +2851,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0867,2,clif->pReqCloseBuyingStore,0); packet(0x0944,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x08AC,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x094C,8); // CZ_JOIN_BATTLE_FIELD packet(0x0883,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0920,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0890,26,clif->pPartyInvite2,2); - // packet(0x088C,4); // CZ_GANGSI_RANK packet(0x089A,26,clif->pFriendsListAdd,2); packet(0x0896,5,clif->pHomMenu,2,4); packet(0x0926,36,clif->pStoragePassword,0); + packet(0x088c,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x094c,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x09DF,7); #endif @@ -2776,21 +2885,28 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0436,4); // CZ_GANGSI_RANK packet(0x023B,26,clif->pFriendsListAdd,2); packet(0x0361,5,clif->pHomMenu,2,4); packet(0x095C,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK packet(0x09DF,7); #endif #if PACKETVER >= 20140613 +// no shuffle packets packet(0x0a0e,14); #endif +// 2014-06-25aRagexeRE +#if PACKETVER >= 20140625 +// no shuffle packets + packet(0x0a28,3); // ZC_ACK_OPENSTORE2 +#endif + // 2014-10-16aRagexe - YomRawr #if PACKETVER >= 20141016 packet(0x0369,7,clif->pActionRequest,2,6); @@ -2814,14 +2930,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x086E,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0802,26,clif->pPartyInvite2,2); - // packet(0x0922,4); // CZ_GANGSI_RANK packet(0x094B,26,clif->pFriendsListAdd,2); packet(0x0364,5,clif->pHomMenu,2,4); packet(0x0936,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0922,4,clif->pDull); // CZ_GANGSI_RANK packet(0x09DF,7); packet(0x0a00,269); packet(0x09e5,18); // ZC_DELETEITEM_FROM_MCSTORE2 @@ -2865,18 +2981,19 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0955,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x092B,8); // CZ_JOIN_BATTLE_FIELD packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); packet(0x093B,19,clif->pWantToConnection,2,6,10,14,18); packet(0x0896,26,clif->pPartyInvite2,2); - // packet(0x08AB,4); // CZ_GANGSI_RANK packet(0x091A,26,clif->pFriendsListAdd,2); packet(0x0899,5,clif->pHomMenu,2,4); packet(0x0438,36,clif->pStoragePassword,0); packet(0x0A01,3,clif->pHotkeyRowShift,2); + packet(0x08ab,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x092b,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif #if PACKETVER >= 20150226 +// shuffle packets not added packet(0x0A09,45); packet(0x0A0A,47); packet(0x0A0B,47); @@ -2909,11 +3026,11 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x022D,2,clif->pReqCloseBuyingStore,0); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0883,18,clif->pPartyBookingRegisterReq,2,4); - packet(0x02C4,8); // CZ_JOIN_BATTLE_FIELD + packet(0x02C4,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0960,-1,clif->pItemListWindowSelected,2,4,8); packet(0x0363,19,clif->pWantToConnection,2,6,10,14,18); packet(0x094A,26,clif->pPartyInvite2,2); - packet(0x0927,4); // CZ_GANGSI_RANK + packet(0x0927,4,clif->pDull); // CZ_GANGSI_RANK packet(0x08A8,26,clif->pFriendsListAdd,2); packet(0x0817,5,clif->pHomMenu,2,4); packet(0x0923,36,clif->pStoragePassword,0); @@ -2926,10 +3043,145 @@ packet(0x96e,-1,clif->ackmergeitems); #endif #if PACKETVER >= 20150805 // RagexeRE +// shuffle packets not added packet(0x097f,-1); // ZC_SELECTCART packet(0x0980,7,clif->pSelectCart); // CZ_SELECTCART #endif +// 2015-10-01bRagexeRE +#if PACKETVER >= 20151001 + packet(0x0369,7,clif->pActionRequest,2,6); + packet(0x083C,10,clif->pUseSkillToId,2,4,6); + packet(0x0437,5,clif->pWalkToXY,2); + packet(0x035F,6,clif->pTickSend,2); + packet(0x0202,5,clif->pChangeDir,2,4); + packet(0x07E4,6,clif->pTakeItem,2); + packet(0x0362,6,clif->pDropItem,2,4); + packet(0x07EC,8,clif->pMoveToKafra,2,4); + packet(0x0364,8,clif->pMoveFromKafra,2,4); + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); + packet(0x096A,6,clif->pGetCharNameRequest,2); + packet(0x0368,6,clif->pSolveCharName,2); + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x0360,6,clif->pReqClickBuyingStore,2); + packet(0x0817,2,clif->pReqCloseBuyingStore,0); + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); + packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); + packet(0x0802,26,clif->pPartyInvite2,2); + packet(0x023B,26,clif->pFriendsListAdd,2); + packet(0x0361,5,clif->pHomMenu,2,4); + packet(0x0860,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK +#endif + +// 2015-10-29aRagexe +#if PACKETVER >= 20151029 + packet(0x0369,7,clif->pActionRequest,2,6); + packet(0x083C,10,clif->pUseSkillToId,2,4,6); + packet(0x0437,5,clif->pWalkToXY,2); + packet(0x035F,6,clif->pTickSend,2); + packet(0x0202,5,clif->pChangeDir,2,4); + packet(0x07E4,6,clif->pTakeItem,2); + packet(0x0362,6,clif->pDropItem,2,4); + packet(0x07EC,8,clif->pMoveToKafra,2,4); + packet(0x0364,8,clif->pMoveFromKafra,2,4); + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); + packet(0x096A,6,clif->pGetCharNameRequest,2); + packet(0x0368,6,clif->pSolveCharName,2); + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x0360,6,clif->pReqClickBuyingStore,2); + packet(0x0817,2,clif->pReqCloseBuyingStore,0); + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); + packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18); + packet(0x0802,26,clif->pPartyInvite2,2); + packet(0x023B,26,clif->pFriendsListAdd,2); + packet(0x0361,5,clif->pHomMenu,2,4); + packet(0x0860,36,clif->pStoragePassword,0); + packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x0a39,36); +#endif + +// 2015-11-04aRagexe +#if PACKETVER >= 20151104 + packet(0x0369,7,clif->pActionRequest,2,6); + packet(0x083C,10,clif->pUseSkillToId,2,4,6); + packet(0x0363,5,clif->pWalkToXY,2); + packet(0x0886,6,clif->pTickSend,2); + packet(0x0928,5,clif->pChangeDir,2,4); + packet(0x0964,6,clif->pTakeItem,2); + packet(0x0437,6,clif->pDropItem,2,4); + packet(0x088B,8,clif->pMoveToKafra,2,4); + packet(0x0364,8,clif->pMoveFromKafra,2,4); + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); + packet(0x0887,6,clif->pGetCharNameRequest,2); + packet(0x0368,6,clif->pSolveCharName,2); + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0815,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x0436,6,clif->pReqClickBuyingStore,2); + packet(0x0817,2,clif->pReqCloseBuyingStore,0); + packet(0x023B,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + packet(0x0811,18,clif->pPartyBookingRegisterReq,2,4,6); + packet(0x093A,-1,clif->pItemListWindowSelected,2,4,8,12); + packet(0x0360,19,clif->pWantToConnection,2,6,10,14,18); + packet(0x08A5,26,clif->pPartyInvite2,2); + packet(0x07EC,26,clif->pFriendsListAdd,2); + packet(0x088D,5,clif->pHomMenu,2,4); + packet(0x0940,36,clif->pStoragePassword,2,4,20); + packet(0x08a3,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x0939,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD + packet(0x0a39,36); +#endif + +// 2015-12-16aRagexe +#if PACKETVER >= 20151216 + packet(0x089D,7,clif->pActionRequest,2,6); + packet(0x0968,10,clif->pUseSkillToId,2,4,6); + packet(0x08A2,5,clif->pWalkToXY,2); + packet(0x085B,6,clif->pTickSend,2); + packet(0x022D,5,clif->pChangeDir,2,4); + packet(0x08A9,6,clif->pTakeItem,2); + packet(0x0966,6,clif->pDropItem,2,4); + packet(0x08AC,8,clif->pMoveToKafra,2,4); + packet(0x0864,8,clif->pMoveFromKafra,2,4); + packet(0x0865,10,clif->pUseSkillToPos,2,4,6,8); + packet(0x0874,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); + packet(0x088B,6,clif->pGetCharNameRequest,2); + packet(0x089E,6,clif->pSolveCharName,2); + packet(0x0436,12,clif->pSearchStoreInfoListItemClick,2,6,10); + packet(0x0960,2,clif->pSearchStoreInfoNextPage,0); + packet(0x0944,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0954,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x0361,6,clif->pReqClickBuyingStore,2); + packet(0x083C,2,clif->pReqCloseBuyingStore,0); + packet(0x0870,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); + packet(0x0949,-1,clif->pItemListWindowSelected,2,4,8); + packet(0x0947,19,clif->pWantToConnection,2,6,10,14,18); + packet(0x086E,26,clif->pPartyInvite2,2); + packet(0x091D,26,clif->pFriendsListAdd,2); + packet(0x0362,5,clif->pHomMenu,2,4); + packet(0x0885,36,clif->pStoragePassword,0); + packet(0x0364,4,clif->pDull); // CZ_GANGSI_RANK + packet(0x086a,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD +#endif + /* PacketKeys: http://herc.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */ #if PACKETVER >= 20110817 packetKeys(0x053D5CED,0x3DED6DED,0x6DED6DED); /* Thanks to Shakto */ @@ -3175,6 +3427,22 @@ packet(0x96e,-1,clif->ackmergeitems); packetKeys(0x62C86D09,0x75944F17,0x112C133D); /* Dastgir */ #endif +#if PACKETVER >= 20151001 + packetKeys(0x5CFF4561,0x32514AD1,0x06D126D1); /* Dastgir */ +#endif + +#if PACKETVER >= 20151029 + packetKeys(0x45B945B9,0x45B945B9,0x45B945B9); /* Dastgir */ +#endif + +#if PACKETVER >= 20151104 + packetKeys(0x4C17382A,0x7ED174C9,0x29961E4F); /* ossi0110 */ +#endif + +#if PACKETVER >= 20151216 + packetKeys(0x25DD643D,0x61AC39DE,0x77A8206D); /* Dastgir */ +#endif + #if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3) packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3); #endif diff --git a/src/map/party.c b/src/map/party.c index c471cceb9..3bf9542c7 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -64,7 +64,7 @@ void party_fill_member(struct party_member* member, struct map_session_data* sd, member->account_id = sd->status.account_id; member->char_id = sd->status.char_id; safestrncpy(member->name, sd->status.name, NAME_LENGTH); - member->class_ = sd->status.class_; + member->class = sd->status.class; member->map = sd->mapindex; member->lv = sd->status.base_level; member->online = 1; @@ -236,24 +236,29 @@ void party_check_state(struct party_data *p) { int i; nullpo_retv(p); memset(&p->state, 0, sizeof(p->state)); - for (i = 0; i < MAX_PARTY; i ++) { + for (i = 0; i < MAX_PARTY; i++) { if (!p->party.member[i].online) continue; //Those not online shouldn't apart to skill usage and all that. - switch (p->party.member[i].class_) { + switch (p->party.member[i].class) { case JOB_MONK: case JOB_BABY_MONK: case JOB_CHAMPION: + case JOB_SURA: + case JOB_SURA_T: + case JOB_BABY_SURA: p->state.monk = 1; - break; + break; case JOB_STAR_GLADIATOR: p->state.sg = 1; - break; + break; case JOB_SUPER_NOVICE: case JOB_SUPER_BABY: + case JOB_SUPER_NOVICE_E: + case JOB_SUPER_BABY_E: p->state.snovice = 1; - break; + break; case JOB_TAEKWON: p->state.tk = 1; - break; + break; } } } @@ -876,15 +881,14 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id continue; switch(skill_id) { case TK_COUNTER: //Increase Triple Attack rate of Monks. - if((p_sd->class_&MAPID_UPPERMASK) == MAPID_MONK - && pc->checkskill(p_sd,MO_TRIPLEATTACK)) { + if ((p_sd->job & MAPID_UPPERMASK) == MAPID_MONK && pc->checkskill(p_sd, MO_TRIPLEATTACK)) { sc_start4(&p_sd->bl,&p_sd->bl,SC_SKILLRATE_UP,100,MO_TRIPLEATTACK, 50+50*skill_lv, //+100/150/200% rate 0,0,skill->get_time(SG_FRIEND, 1)); } break; case MO_COMBOFINISH: //Increase Counter rate of Star Gladiators - if((p_sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR + if ((p_sd->job & MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && sd->sc.data[SC_COUNTERKICK_READY] && pc->checkskill(p_sd,SG_FRIEND)) { sc_start4(&p_sd->bl,&p_sd->bl,SC_SKILLRATE_UP,100,TK_COUNTER, @@ -1155,7 +1159,7 @@ int party_sub_count_chorus(struct block_list *bl, va_list ap) if (battle_config.idle_no_share && pc_isidle(sd)) return 0; - if ( (sd->class_&MAPID_THIRDMASK) != MAPID_MINSTRELWANDERER ) + if ((sd->job & MAPID_THIRDMASK) != MAPID_MINSTRELWANDERER) return 0; return 1; diff --git a/src/map/party.h b/src/map/party.h index 05037eb04..aa0977499 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/path.c b/src/map/path.c index f5e08d4df..509a82c7e 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -192,10 +192,8 @@ bool path_search_long(struct shootpath_data *spd,struct block_list *bl,int16 m,i /// Ensures there is enough space in array to store new element. static void heap_push_node(struct node_heap *heap, struct path_node *node) { -#ifndef __clang_analyzer__ // TODO: Figure out why clang's static analyzer doesn't like this BHEAP_ENSURE(*heap, 1, 256); BHEAP_PUSH2(*heap, node, NODE_MINTOPCMP, swap_ptr); -#endif // __clang_analyzer__ } /// Updates path_node in the binary node_heap. diff --git a/src/map/path.h b/src/map/path.h index c84b77eb0..1e67a8d97 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/pc.c b/src/map/pc.c index 0674f0137..2cf5d75b4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -80,12 +80,13 @@ struct pc_interface *pc; //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pc->db_checkid first! -int pc_class2idx(int class_) { - if (class_ >= JOB_NOVICE_HIGH) { - class_ += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; +int pc_class2idx(int class) +{ + if (class >= JOB_NOVICE_HIGH) { + class += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; } - Assert_ret(class_ >= 0 && class_ < CLASS_COUNT); - return class_; + Assert_ret(class >= 0 && class < CLASS_COUNT); + return class; } /** @@ -247,7 +248,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int)); sd->spirit_timer[i] = tid; sd->spiritball++; - if( (sd->class_&MAPID_THIRDMASK) == MAPID_ROYAL_GUARD ) + if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) clif->millenniumshield(&sd->bl,sd->spiritball); else clif->spiritball(&sd->bl); @@ -286,7 +287,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type) } if(!type) { - if( (sd->class_&MAPID_THIRDMASK) == MAPID_ROYAL_GUARD ) + if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) clif->millenniumshield(&sd->bl,sd->spiritball); else clif->spiritball(&sd->bl); @@ -387,51 +388,108 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { } // Increases a player's fame points and displays a notice to him -void pc_addfame(struct map_session_data *sd,int count) +/** + * Increases a player's fame points and displays a notice to them. + * + * If the character's job class doesn't allow the specified rank type, nothing + * happens and the request is ignored. + * + * @param sd The target character. + * @param type The fame list type (@see enum fame_list_type). + * @param count The amount of points to add. + */ +void pc_addfame(struct map_session_data *sd, int ranktype, int count) { - int ranktype = -1; nullpo_retv(sd); + + switch (ranktype) { + case RANKTYPE_BLACKSMITH: + if ((sd->job & MAPID_UPPERMASK) != MAPID_BLACKSMITH) + return; + break; + case RANKTYPE_ALCHEMIST: + if ((sd->job & MAPID_UPPERMASK) != MAPID_ALCHEMIST) + return; + break; + case RANKTYPE_TAEKWON: + if ((sd->job & MAPID_UPPERMASK) != MAPID_TAEKWON) + return; + break; + case RANKTYPE_PK: + // Not supported + FALLTHROUGH + default: + Assert_retv(0); + } + sd->status.fame += count; - if(sd->status.fame > MAX_FAME) + if (sd->status.fame > MAX_FAME) sd->status.fame = MAX_FAME; - switch(sd->class_&MAPID_UPPERMASK){ - case MAPID_BLACKSMITH: ranktype = RANKTYPE_BLACKSMITH; break; - case MAPID_ALCHEMIST: ranktype = RANKTYPE_ALCHEMIST; break; - case MAPID_TAEKWON: ranktype = RANKTYPE_TAEKWON; break; - } + clif->update_rankingpoint(sd, ranktype, count); chrif->updatefamelist(sd); } -// Check whether a player ID is in the fame rankers' list of its job, returns his/her position if so, 0 else -unsigned char pc_famerank(int char_id, int job) +/** + * Returns a character's rank in the specified fame list. + * + * @param char_id The character ID. + * @param ranktype The rank list type (@see enum fame_list_type). + * @return The rank position (1-based index) + * @retval 0 if the character isn't in the specified list. + */ +int pc_fame_rank(int char_id, int ranktype) { int i; - switch(job){ - case MAPID_BLACKSMITH: // Blacksmith - for(i = 0; i < MAX_FAME_LIST; i++){ - if(pc->smith_fame_list[i].id == char_id) - return i + 1; - } - break; - case MAPID_ALCHEMIST: // Alchemist - for(i = 0; i < MAX_FAME_LIST; i++){ - if(pc->chemist_fame_list[i].id == char_id) - return i + 1; - } - break; - case MAPID_TAEKWON: // Taekwon - for(i = 0; i < MAX_FAME_LIST; i++){ - if(pc->taekwon_fame_list[i].id == char_id) - return i + 1; - } - break; + switch (ranktype) { + case RANKTYPE_BLACKSMITH: + for (i = 0; i < MAX_FAME_LIST; i++) { + if (pc->smith_fame_list[i].id == char_id) + return i + 1; + } + break; + case RANKTYPE_ALCHEMIST: + for (i = 0; i < MAX_FAME_LIST; i++) { + if (pc->chemist_fame_list[i].id == char_id) + return i + 1; + } + break; + case RANKTYPE_TAEKWON: + for (i = 0; i < MAX_FAME_LIST; i++) { + if (pc->taekwon_fame_list[i].id == char_id) + return i + 1; + } + break; + case RANKTYPE_PK: // Not implemented + FALLTHROUGH + default: + Assert_ret(0); } return 0; } +/** + * Returns the appropriate fame list type for the given job. + * + * @param job_mapid The job (in MapID format) + * @return the appropriate fame list type (@see enum fame_list_type). + * @retval RANKTYPE_UNKNOWN if no appropriate type exists. + */ +int pc_famelist_type(uint16 job_mapid) { + switch (job_mapid & MAPID_UPPERMASK) { + case MAPID_BLACKSMITH: + return RANKTYPE_BLACKSMITH; + case MAPID_ALCHEMIST: + return RANKTYPE_ALCHEMIST; + case MAPID_TAEKWON: + return RANKTYPE_TAEKWON; + default: + return RANKTYPE_UNKNOWN; + } +} + int pc_setrestartvalue(struct map_session_data *sd,int type) { struct status_data *st, *bst; nullpo_ret(sd); @@ -490,7 +548,7 @@ void pc_rental_expire(struct map_session_data *sd, int i) { /* Soon to be dropped, we got plans to integrate it with item db */ switch( nameid ) { - case ITEMID_REINS_OF_MOUNT: + case ITEMID_BOARDING_HALTER: status_change_end(&sd->bl,SC_ALL_RIDING,INVALID_TIMER); break; case ITEMID_LOVE_ANGEL: @@ -711,8 +769,8 @@ int pc_equippoint(struct map_session_data *sd,int n) || sd->inventory_data[n]->look == W_1HAXE ) { if (pc->checkskill(sd,AS_LEFT) > 0 - || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN - || (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO + || (sd->job & MAPID_UPPERMASK) == MAPID_ASSASSIN + || (sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO ) { //Kagerou and Oboro can dual wield daggers. [Rytech] if( ep == EQP_HAND_R ) @@ -887,7 +945,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd return false; } - if( !( ( b_sd->status.class_ >= JOB_NOVICE && b_sd->status.class_ <= JOB_THIEF ) || b_sd->status.class_ == JOB_SUPER_NOVICE ) ) + if (!(b_sd->status.class >= JOB_NOVICE && b_sd->status.class <= JOB_THIEF) && b_sd->status.class != JOB_SUPER_NOVICE) return false; return true; @@ -898,7 +956,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd *------------------------------------------*/ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { - int job, joblevel; + int class, joblevel; unsigned int jobexp; if( !pc->can_Adopt(p1_sd, p2_sd, b_sd) ) @@ -909,9 +967,9 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, joblevel = b_sd->status.job_level; jobexp = b_sd->status.job_exp; - job = pc->mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex); - if( job != -1 && !pc->jobchange(b_sd, job, 0) ) - { // Success, proceed to configure parents and baby skills + class = pc->mapid2jobid(b_sd->job | JOBL_BABY, b_sd->status.sex); + if (class != -1 && !pc->jobchange(b_sd, class, 0)) { + // Success, proceed to configure parents and baby skills p1_sd->status.child = b_sd->status.char_id; p2_sd->status.child = b_sd->status.char_id; b_sd->status.father = p1_sd->status.char_id; @@ -972,12 +1030,11 @@ int pc_isequip(struct map_session_data *sd,int n) return 0; if ( item->equip & EQP_AMMO ) { - if ( (sd->state.active && !pc_iscarton(sd)) // check if sc data is already loaded. - && (sd->status.class_ == JOB_GENETIC_T || sd->status.class_ == JOB_GENETIC) ) { + if (sd->state.active && !pc_iscarton(sd) && (sd->job & MAPID_THIRDMASK) == MAPID_GENETIC) { // check if sc data is already loaded. clif->msgtable(sd, MSG_ITEM_NEED_CART); return 0; } - if ( !pc_ismadogear(sd) && (sd->status.class_ == JOB_MECHANIC_T || sd->status.class_ == JOB_MECHANIC) ) { + if (!pc_ismadogear(sd) && (sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { clif->msgtable(sd, MSG_ITEM_NEED_MADO); return 0; } @@ -1014,14 +1071,26 @@ int pc_isequip(struct map_session_data *sd,int n) } } //Not equipable by class. [Skotlex] - if (!(1ULL<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)])) + if (((1ULL<<(sd->job & MAPID_BASEMASK)) & item->class_base[(sd->job & JOBL_2_1) != 0 ? 1 : ((sd->job & JOBL_2_2) != 0 ? 2 : 0)]) == 0) return 0; //Not usable by upper class. [Inkfish] while( 1 ) { - if( item->class_upper&ITEMUPPER_NORMAL && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break; - if( item->class_upper&ITEMUPPER_UPPER && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break; - if( item->class_upper&ITEMUPPER_BABY && sd->class_&JOBL_BABY ) break; - if( item->class_upper&ITEMUPPER_THIRD && sd->class_&JOBL_THIRD ) break; + if ((item->class_upper & ITEMUPPER_NORMAL) != 0) { + if ((sd->job & (JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) == 0) + break; + } + if ((item->class_upper & ITEMUPPER_UPPER) != 0) { + if ((sd->job & (JOBL_UPPER|JOBL_THIRD)) != 0) + break; + } + if ((item->class_upper & ITEMUPPER_BABY) != 0) { + if ((sd->job & JOBL_BABY) != 0) + break; + } + if ((item->class_upper & ITEMUPPER_THIRD) != 0) { + if ((sd->job & JOBL_THIRD) != 0) + break; + } return 0; } @@ -1075,13 +1144,16 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim } //Set the map-server used job id. [Skotlex] - i = pc->jobid2mapid(sd->status.class_); - if (i == -1) { //Invalid class? - ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id); - sd->status.class_ = JOB_NOVICE; - sd->class_ = MAPID_NOVICE; - } else - sd->class_ = i; + { + int job = pc->jobid2mapid(sd->status.class); + if (job == -1) { + ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class, sd->status.name, sd->status.account_id, sd->status.char_id); + sd->status.class = JOB_NOVICE; + sd->job = MAPID_NOVICE; + } else { + sd->job = job; + } + } // Checks and fixes to character status data, that are required // in case of configuration change or stuff, which cannot be @@ -1162,7 +1234,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->sc.option = sd->status.option; //This is the actual option used in battle. //Set here because we need the inventory data for weapon sprite parsing. - status->set_viewdata(&sd->bl, sd->status.class_); + status->set_viewdata(&sd->bl, sd->status.class); unit->dataset(&sd->bl); sd->guild_x = -1; @@ -1338,7 +1410,7 @@ int pc_reg_received(struct map_session_data *sd) // Cooking Exp sd->cook_mastery = pc_readglobalreg(sd,script->add_str("COOK_MASTERY")); - if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON ) { + if ((sd->job & MAPID_BASEMASK) == MAPID_TAEKWON) { // Better check for class rather than skill to prevent "skill resets" from unsetting this sd->mission_mobid = pc_readglobalreg(sd,script->add_str("TK_MISSION_ID")); sd->mission_count = pc_readglobalreg(sd,script->add_str("TK_MISSION_COUNT")); @@ -1420,7 +1492,7 @@ int pc_reg_received(struct map_session_data *sd) } if (pc_isinvisible(sd)) { - sd->vd.class_ = INVISIBLE_CLASS; + sd->vd.class = INVISIBLE_CLASS; clif->message(sd->fd, msg_sd(sd,11)); // Invisible: On // decrement the number of pvp players on the map map->list[sd->bl.m].users_pvp--; @@ -1467,17 +1539,17 @@ int pc_calc_skillpoint(struct map_session_data* sd) { int pc_calc_skilltree(struct map_session_data *sd) { int i,id=0,flag; - int c=0; + int class = 0, classidx = 0; nullpo_ret(sd); i = pc->calc_skilltree_normalize_job(sd); - c = pc->mapid2jobid(i, sd->status.sex); - if( c == -1 ) - { //Unable to normalize job?? + class = pc->mapid2jobid(i, sd->status.sex); + if (class == -1) { + //Unable to normalize job?? ShowError("pc_calc_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id); return 1; } - c = pc->class2idx(c); + classidx = pc->class2idx(class); for( i = 0; i < MAX_SKILL; i++ ) { if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these @@ -1486,10 +1558,10 @@ int pc_calc_skilltree(struct map_session_data *sd) if( sd->status.skill[i].flag == SKILL_FLAG_PERMANENT ) { switch( skill->dbs->db[i].nameid ) { case NV_TRICKDEAD: - if( (sd->class_&(MAPID_BASEMASK|JOBL_2)) != MAPID_NOVICE ) { - sd->status.skill[i].id = 0; - sd->status.skill[i].lv = 0; - sd->status.skill[i].flag = 0; + if ((sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { + sd->status.skill[i].id = 0; + sd->status.skill[i].lv = 0; + sd->status.skill[i].flag = 0; } break; } @@ -1559,16 +1631,16 @@ int pc_calc_skilltree(struct map_session_data *sd) do { flag = 0; - for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[c][i].id) > 0; i++) { - int idx = pc->skill_tree[c][i].idx; + for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[classidx][i].id) > 0; i++) { + int idx = pc->skill_tree[classidx][i].idx; bool satisfied = true; if (sd->status.skill[idx].id > 0) continue; //Skill already known. if (!battle_config.skillfree) { int j; - for (j = 0; j < VECTOR_LENGTH(pc->skill_tree[c][i].need); j++) { - struct skill_tree_requirement *req = &VECTOR_INDEX(pc->skill_tree[c][i].need, j); + for (j = 0; j < VECTOR_LENGTH(pc->skill_tree[classidx][i].need); j++) { + struct skill_tree_requirement *req = &VECTOR_INDEX(pc->skill_tree[classidx][i].need, j); int level; if (sd->status.skill[req->idx].id == 0 || sd->status.skill[req->idx].flag == SKILL_FLAG_TEMPORARY @@ -1583,8 +1655,8 @@ int pc_calc_skilltree(struct map_session_data *sd) break; } } - if (sd->status.job_level < (int)pc->skill_tree[c][i].joblv) { - int jobid = pc->mapid2jobid(sd->class_, sd->status.sex); // need to get its own skilltree + if (sd->status.job_level < (int)pc->skill_tree[classidx][i].joblv) { + int jobid = pc->mapid2jobid(sd->job, sd->status.sex); // need to get its own skilltree if (jobid > -1) { if (!pc->skill_tree[pc->class2idx(jobid)][i].inherited) satisfied = false; // job level requirement wasn't satisfied @@ -1615,16 +1687,17 @@ int pc_calc_skilltree(struct map_session_data *sd) } while(flag); // - if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) - { - /* Taekwon Ranger Bonus Skill Tree + if (classidx > 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON + && sd->status.base_level >= 90 && sd->status.skill_point == 0 + && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) { + /* Taekwon Ranker Bonus Skill Tree ============================================ - Grant All Taekwon Tree, but only as Bonus Skills in case they drop from ranking. - (c > 0) to avoid grant Novice Skill Tree in case of Skill Reset (need more logic) - (sd->status.skill_point == 0) to wait until all skill points are asigned to avoid problems with Job Change quest. */ - for( i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[c][i].id) > 0; i++ ) { - int idx = pc->skill_tree[c][i].idx; + for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[classidx][i].id) > 0; i++) { + int idx = pc->skill_tree[classidx][i].idx; if( (skill->dbs->db[idx].inf2&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) ) continue; //Do not include Quest/Wedding skills. @@ -1635,7 +1708,7 @@ int pc_calc_skilltree(struct map_session_data *sd) sd->status.skill[idx].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[idx].lv; // Remember original level } - sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); + sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); } } @@ -1688,7 +1761,7 @@ void pc_check_skilltree(struct map_session_data *sd, int skill_id) continue; if (sd->status.job_level < (int)pc->skill_tree[c][i].joblv) { - int jobid = pc->mapid2jobid(sd->class_, sd->status.sex); // need to get its own skilltree + int jobid = pc->mapid2jobid(sd->job, sd->status.sex); // need to get its own skilltree if (jobid > -1) { if (!pc->skill_tree[pc->class2idx(jobid)][i].inherited) continue; @@ -1735,12 +1808,12 @@ int pc_clean_skilltree(struct map_session_data *sd) int pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int skill_point, novice_skills; - int c; + uint16 job; nullpo_ret(sd); - c = sd->class_; + job = sd->job; if (!battle_config.skillup_limit || pc_has_permission(sd, PC_PERM_ALL_SKILL)) - return c; + return job; skill_point = pc->calc_skillpoint(sd); @@ -1748,19 +1821,17 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) sd->sktree.second = sd->sktree.third = 0; - // limit 1st class and above to novice job levels - if(skill_point < novice_skills) { - c = MAPID_NOVICE; - } - // limit 2nd class and above to first class job levels (super novices are exempt) - else if ((sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) - { + if (skill_point < novice_skills && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) { + // limit 1st class and above to novice job levels + job = MAPID_NOVICE; + } else if ((sd->job & JOBL_2) != 0 && (sd->job & MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) { + // limit 2nd class and above to first class job levels (super novices are exempt) // regenerate change_level_2nd if (sd->change_level_2nd == 0) { - if (sd->class_&JOBL_THIRD) { + if ((sd->job & JOBL_THIRD) != 0) { // if neither 2nd nor 3rd jobchange levels are known, we have to assume a default for 2nd if (sd->change_level_3rd == 0) { - sd->change_level_2nd = pc->max_level[pc->class2idx(pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1]; + sd->change_level_2nd = pc->max_level[pc->class2idx(pc->mapid2jobid(sd->job & MAPID_UPPERMASK, sd->status.sex))][1]; } else { sd->change_level_2nd = 1 + skill_point + sd->status.skill_point - (sd->status.job_level - 1) @@ -1778,9 +1849,9 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) } if (skill_point < novice_skills + (sd->change_level_2nd - 1)) { - c &= MAPID_BASEMASK; + job &= MAPID_BASEMASK; sd->sktree.second = ( novice_skills + (sd->change_level_2nd - 1) ) - skill_point; - } else if(sd->class_&JOBL_THIRD) { // limit 3rd class to 2nd class/trans job levels + } else if ((sd->job & JOBL_THIRD) != 0) { // limit 3rd class to 2nd class/trans job levels // regenerate change_level_3rd if (sd->change_level_3rd == 0) { sd->change_level_3rd = 1 + skill_point + sd->status.skill_point @@ -1791,16 +1862,16 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) } if (skill_point < novice_skills + (sd->change_level_2nd - 1) + (sd->change_level_3rd - 1)) { - c &= MAPID_UPPERMASK; + job &= MAPID_UPPERMASK; sd->sktree.third = (novice_skills + (sd->change_level_2nd - 1) + (sd->change_level_3rd - 1)) - skill_point; } } } // restore non-limiting flags - c |= sd->class_&(JOBL_UPPER|JOBL_BABY); + job |= sd->job & (JOBL_UPPER|JOBL_BABY); - return c; + return job; } /*========================================== @@ -1841,38 +1912,40 @@ int pc_updateweightstatus(struct map_session_data *sd) return 0; } -int pc_disguise(struct map_session_data *sd, int class_) { +int pc_disguise(struct map_session_data *sd, int class) +{ nullpo_ret(sd); - if (class_ == -1 && sd->disguise == -1) + if (class == -1 && sd->disguise == -1) return 0; - if (class_ >= 0 && sd->disguise == class_) + if (class >= 0 && sd->disguise == class) return 0; if (pc_isinvisible(sd)) { //Character is invisible. Stealth class-change. [Skotlex] - sd->disguise = class_; //viewdata is set on uncloaking. + sd->disguise = class; //viewdata is set on uncloaking. return 2; } if (sd->bl.prev != NULL) { - if( class_ == -1 && sd->disguise == sd->status.class_ ) { + if (class == -1 && sd->disguise == sd->status.class) { clif->clearunit_single(-sd->bl.id,CLR_OUTSIGHT,sd->fd); - } else if ( class_ != sd->status.class_ ) { + } else if (class != sd->status.class) { pc_stop_walking(sd, STOPWALKING_FLAG_NONE); clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); } } - if (class_ == -1) { + if (class == -1) { sd->disguise = -1; - class_ = sd->status.class_; - } else - sd->disguise = class_; + class = sd->status.class; + } else { + sd->disguise = class; + } - status->set_viewdata(&sd->bl, class_); + status->set_viewdata(&sd->bl, class); clif->changeoption(&sd->bl); // We need to update the client so it knows that a costume is being used if( sd->sc.option&OPTION_COSTUME ) { - clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); clif->changelook(&sd->bl,LOOK_WEAPON,0); clif->changelook(&sd->bl,LOOK_SHIELD,0); clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); @@ -1880,7 +1953,7 @@ int pc_disguise(struct map_session_data *sd, int class_) { if (sd->bl.prev != NULL) { clif->spawn(&sd->bl); - if (class_ == sd->status.class_ && pc_iscarton(sd)) { + if (class == sd->status.class && pc_iscarton(sd)) { //It seems the cart info is lost on undisguise. clif->cartlist(sd); clif->updatestatus(sd,SP_CARTINFO); @@ -4852,12 +4925,12 @@ int pc_isUseitem(struct map_session_data *sd,int n) /** * Only Rune Knights may use runes **/ - if( itemdb_is_rune(nameid) && (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT ) + if (itemdb_is_rune(nameid) && (sd->job & MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT) return 0; /** * Only GCross may use poisons **/ - else if( itemdb_is_poison(nameid) && (sd->class_&MAPID_THIRDMASK) != MAPID_GUILLOTINE_CROSS ) + else if (itemdb_is_poison(nameid) && (sd->job & MAPID_THIRDMASK) != MAPID_GUILLOTINE_CROSS) return 0; if( item->package || item->group ) { @@ -4886,31 +4959,47 @@ int pc_isUseitem(struct map_session_data *sd,int n) } //Not equipable by class. [Skotlex] - if (!( - (1ULL<<(sd->class_&MAPID_BASEMASK)) & - (item->class_base[(sd->class_&JOBL_2_1) ? 1 : ((sd->class_&JOBL_2_2) ? 2 : 0)]) - )) + if (((1ULL << (sd->job & MAPID_BASEMASK)) & (item->class_base[(sd->job & JOBL_2_1) ? 1 : ((sd->job & JOBL_2_2) ? 2 : 0)])) == 0) return 0; //Not usable by upper class. [Haru] while( 1 ) { // Normal classes (no upper, no baby, no third classes) - if( item->class_upper&ITEMUPPER_NORMAL && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break; + if ((item->class_upper & ITEMUPPER_NORMAL) != 0) { + if ((sd->job & (JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) == 0) + break; + } + if ((item->class_upper & ITEMUPPER_UPPER) != 0) { #ifdef RENEWAL - // Upper classes (no third classes) - if( item->class_upper&ITEMUPPER_UPPER && sd->class_&JOBL_UPPER && !(sd->class_&JOBL_THIRD) ) break; + // Upper classes (no third classes) + if ((sd->job & JOBL_UPPER) != 0 && (sd->job&JOBL_THIRD) == 0) + break; #else - //pre-re has no use for the extra, so we maintain the previous for backwards compatibility - if( item->class_upper&ITEMUPPER_UPPER && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break; + //pre-re has no use for the extra, so we maintain the previous for backwards compatibility + if ((sd->job & (JOBL_UPPER|JOBL_THIRD)) != 0) + break; #endif + } // Baby classes (no third classes) - if( item->class_upper&ITEMUPPER_BABY && sd->class_&JOBL_BABY && !(sd->class_&JOBL_THIRD) ) break; + if ((item->class_upper & ITEMUPPER_BABY) != 0) { + if ((sd->job & JOBL_BABY) != 0 && (sd->job&JOBL_THIRD) == 0) + break; + } // Third classes (no upper, no baby classes) - if( item->class_upper&ITEMUPPER_THIRD && sd->class_&JOBL_THIRD && !(sd->class_&(JOBL_UPPER|JOBL_BABY)) ) break; + if ((item->class_upper & ITEMUPPER_THIRD) != 0) { + if ((sd->job & JOBL_THIRD) != 0 && (sd->job & (JOBL_UPPER|JOBL_BABY)) == 0) + break; + } // Upper third classes - if( item->class_upper&ITEMUPPER_THURDUPPER && sd->class_&JOBL_THIRD && sd->class_&JOBL_UPPER ) break; + if ((item->class_upper & ITEMUPPER_THURDUPPER) != 0) { + if ((sd->job & JOBL_THIRD) != 0 && (sd->job & JOBL_UPPER) != 0) + break; + } // Baby third classes - if( item->class_upper&ITEMUPPER_THIRDBABY && sd->class_&JOBL_THIRD && sd->class_&JOBL_BABY ) break; + if ((item->class_upper & ITEMUPPER_THIRDBABY) != 0) { + if ((sd->job & JOBL_THIRD) != 0 && (sd->job & JOBL_BABY) != 0) + break; + } return 0; } @@ -4965,6 +5054,7 @@ int pc_useitem(struct map_session_data *sd,int n) { sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC_SATURDAY_NIGHT_FEVER] || sd->sc.data[SC_COLD] || + sd->sc.data[SC_SUHIDE] || pc_ismuted(&sd->sc, MANNER_NOITEM) )) return 0; @@ -4976,7 +5066,7 @@ int pc_useitem(struct map_session_data *sd,int n) { return 0; /* Items with delayed consume are not meant to work while in mounts except reins of mount(12622) */ - if( sd->inventory_data[n]->flag.delay_consume && nameid != ITEMID_REINS_OF_MOUNT ) { + if (sd->inventory_data[n]->flag.delay_consume && nameid != ITEMID_BOARDING_HALTER) { if( sd->sc.data[SC_ALL_RIDING] ) return 0; else if( pc_issit(sd) ) @@ -5003,7 +5093,7 @@ int pc_useitem(struct map_session_data *sd,int n) { } else {// not yet used item (all slots are initially empty) sd->item_delay[i].nameid = nameid; } - if (!(nameid == ITEMID_REINS_OF_MOUNT && pc_hasmount(sd))) + if (!(nameid == ITEMID_BOARDING_HALTER && pc_hasmount(sd))) sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay; } else {// should not happen ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%d, char_id=%d)\n", nameid, sd->status.char_id); @@ -5051,9 +5141,8 @@ int pc_useitem(struct map_session_data *sd,int n) { } } - if(sd->status.inventory[n].card[0]==CARD0_CREATE && - pc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST)) - { + if (sd->status.inventory[n].card[0] == CARD0_CREATE + && pc->fame_rank(MakeDWord(sd->status.inventory[n].card[2], sd->status.inventory[n].card[3]), RANKTYPE_ALCHEMIST) > 0) { script->potion_flag = 2; // Famous player's potions have 50% more efficiency if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_ROGUE) script->potion_flag = 3; //Even more effective potions. @@ -5862,10 +5951,9 @@ int pc_checkequip(struct map_session_data *sd,int pos) * Convert's from the client's lame Job ID system * to the map server's 'makes sense' system. [Skotlex] *------------------------------------------*/ -int pc_jobid2mapid(unsigned short b_class) +int pc_jobid2mapid(int16 class) { - switch(b_class) - { + switch (class) { //Novice And 1-1 Jobs case JOB_NOVICE: return MAPID_NOVICE; case JOB_SWORDMAN: return MAPID_SWORDMAN; @@ -5881,6 +5969,7 @@ int pc_jobid2mapid(unsigned short b_class) case JOB_XMAS: return MAPID_XMAS; case JOB_SUMMER: return MAPID_SUMMER; case JOB_GANGSI: return MAPID_GANGSI; + case JOB_SUMMONER: return MAPID_SUMMONER; //2-1 Jobs case JOB_SUPER_NOVICE: return MAPID_SUPER_NOVICE; case JOB_KNIGHT: return MAPID_KNIGHT; @@ -6004,10 +6093,9 @@ int pc_jobid2mapid(unsigned short b_class) } //Reverts the map-style class id to the client-style one. -int pc_mapid2jobid(unsigned short class_, int sex) +int pc_mapid2jobid(uint16 job, int sex) { - switch(class_) - { + switch (job) { //Novice And 1-1 Jobs case MAPID_NOVICE: return JOB_NOVICE; case MAPID_SWORDMAN: return JOB_SWORDMAN; @@ -6023,6 +6111,7 @@ int pc_mapid2jobid(unsigned short class_, int sex) case MAPID_XMAS: return JOB_XMAS; case MAPID_SUMMER: return JOB_SUMMER; case MAPID_GANGSI: return JOB_GANGSI; + case MAPID_SUMMONER: return JOB_SUMMONER; //2-1 Jobs case MAPID_SUPER_NOVICE: return JOB_SUPER_NOVICE; case MAPID_KNIGHT: return JOB_KNIGHT; @@ -6141,9 +6230,9 @@ int pc_mapid2jobid(unsigned short class_, int sex) /*==================================================== * This function return the name of the job (by [Yor]) *----------------------------------------------------*/ -const char* job_name(int class_) +const char *job_name(int class) { - switch (class_) { + switch (class) { case JOB_NOVICE: // 550 case JOB_SWORDMAN: // 551 case JOB_MAGE: // 552 @@ -6151,7 +6240,7 @@ const char* job_name(int class_) case JOB_ACOLYTE: // 554 case JOB_MERCHANT: // 555 case JOB_THIEF: // 556 - return msg_txt(550 - JOB_NOVICE+class_); + return msg_txt(550 - JOB_NOVICE + class); case JOB_KNIGHT: // 557 case JOB_PRIEST: // 558 @@ -6159,7 +6248,7 @@ const char* job_name(int class_) case JOB_BLACKSMITH: // 560 case JOB_HUNTER: // 561 case JOB_ASSASSIN: // 562 - return msg_txt(557 - JOB_KNIGHT+class_); + return msg_txt(557 - JOB_KNIGHT + class); case JOB_KNIGHT2: return msg_txt(557); @@ -6171,7 +6260,7 @@ const char* job_name(int class_) case JOB_ALCHEMIST: // 567 case JOB_BARD: // 568 case JOB_DANCER: // 569 - return msg_txt(563 - JOB_CRUSADER+class_); + return msg_txt(563 - JOB_CRUSADER + class); case JOB_CRUSADER2: return msg_txt(563); @@ -6181,7 +6270,7 @@ const char* job_name(int class_) case JOB_GUNSLINGER: // 572 case JOB_NINJA: // 573 case JOB_XMAS: // 574 - return msg_txt(570 - JOB_WEDDING+class_); + return msg_txt(570 - JOB_WEDDING + class); case JOB_SUMMER: return msg_txt(621); @@ -6193,7 +6282,7 @@ const char* job_name(int class_) case JOB_ACOLYTE_HIGH: // 579 case JOB_MERCHANT_HIGH: // 580 case JOB_THIEF_HIGH: // 581 - return msg_txt(575 - JOB_NOVICE_HIGH+class_); + return msg_txt(575 - JOB_NOVICE_HIGH + class); case JOB_LORD_KNIGHT: // 582 case JOB_HIGH_PRIEST: // 583 @@ -6201,7 +6290,7 @@ const char* job_name(int class_) case JOB_WHITESMITH: // 585 case JOB_SNIPER: // 586 case JOB_ASSASSIN_CROSS: // 587 - return msg_txt(582 - JOB_LORD_KNIGHT+class_); + return msg_txt(582 - JOB_LORD_KNIGHT + class); case JOB_LORD_KNIGHT2: return msg_txt(582); @@ -6213,7 +6302,7 @@ const char* job_name(int class_) case JOB_CREATOR: // 592 case JOB_CLOWN: // 593 case JOB_GYPSY: // 594 - return msg_txt(588 - JOB_PALADIN + class_); + return msg_txt(588 - JOB_PALADIN + class); case JOB_PALADIN2: return msg_txt(588); @@ -6225,7 +6314,7 @@ const char* job_name(int class_) case JOB_BABY_ACOLYTE: // 599 case JOB_BABY_MERCHANT: // 600 case JOB_BABY_THIEF: // 601 - return msg_txt(595 - JOB_BABY + class_); + return msg_txt(595 - JOB_BABY + class); case JOB_BABY_KNIGHT: // 602 case JOB_BABY_PRIEST: // 603 @@ -6233,7 +6322,7 @@ const char* job_name(int class_) case JOB_BABY_BLACKSMITH: // 605 case JOB_BABY_HUNTER: // 606 case JOB_BABY_ASSASSIN: // 607 - return msg_txt(602 - JOB_BABY_KNIGHT + class_); + return msg_txt(602 - JOB_BABY_KNIGHT + class); case JOB_BABY_KNIGHT2: return msg_txt(602); @@ -6245,7 +6334,7 @@ const char* job_name(int class_) case JOB_BABY_ALCHEMIST: // 612 case JOB_BABY_BARD: // 613 case JOB_BABY_DANCER: // 614 - return msg_txt(608 - JOB_BABY_CRUSADER + class_); + return msg_txt(608 - JOB_BABY_CRUSADER + class); case JOB_BABY_CRUSADER2: return msg_txt(608); @@ -6264,7 +6353,7 @@ const char* job_name(int class_) case JOB_GANGSI: // 622 case JOB_DEATH_KNIGHT: // 623 case JOB_DARK_COLLECTOR: // 624 - return msg_txt(622 - JOB_GANGSI+class_); + return msg_txt(622 - JOB_GANGSI + class); case JOB_RUNE_KNIGHT: // 625 case JOB_WARLOCK: // 626 @@ -6272,7 +6361,7 @@ const char* job_name(int class_) case JOB_ARCH_BISHOP: // 628 case JOB_MECHANIC: // 629 case JOB_GUILLOTINE_CROSS: // 630 - return msg_txt(625 - JOB_RUNE_KNIGHT+class_); + return msg_txt(625 - JOB_RUNE_KNIGHT + class); case JOB_RUNE_KNIGHT_T: // 656 case JOB_WARLOCK_T: // 657 @@ -6280,7 +6369,7 @@ const char* job_name(int class_) case JOB_ARCH_BISHOP_T: // 659 case JOB_MECHANIC_T: // 660 case JOB_GUILLOTINE_CROSS_T: // 661 - return msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); + return msg_txt(656 - JOB_RUNE_KNIGHT_T + class); case JOB_ROYAL_GUARD: // 631 case JOB_SORCERER: // 632 @@ -6289,7 +6378,7 @@ const char* job_name(int class_) case JOB_SURA: // 635 case JOB_GENETIC: // 636 case JOB_SHADOW_CHASER: // 637 - return msg_txt(631 - JOB_ROYAL_GUARD+class_); + return msg_txt(631 - JOB_ROYAL_GUARD + class); case JOB_ROYAL_GUARD_T: // 662 case JOB_SORCERER_T: // 663 @@ -6298,7 +6387,7 @@ const char* job_name(int class_) case JOB_SURA_T: // 666 case JOB_GENETIC_T: // 667 case JOB_SHADOW_CHASER_T: // 668 - return msg_txt(662 - JOB_ROYAL_GUARD_T+class_); + return msg_txt(662 - JOB_ROYAL_GUARD_T + class); case JOB_RUNE_KNIGHT2: return msg_txt(625); @@ -6337,7 +6426,7 @@ const char* job_name(int class_) case JOB_BABY_SURA: // 648 case JOB_BABY_GENETIC: // 649 case JOB_BABY_CHASER: // 650 - return msg_txt(638 - JOB_BABY_RUNE+class_); + return msg_txt(638 - JOB_BABY_RUNE + class); case JOB_BABY_RUNE2: return msg_txt(638); @@ -6353,15 +6442,18 @@ const char* job_name(int class_) case JOB_SUPER_NOVICE_E: // 651 case JOB_SUPER_BABY_E: // 652 - return msg_txt(651 - JOB_SUPER_NOVICE_E+class_); + return msg_txt(651 - JOB_SUPER_NOVICE_E + class); case JOB_KAGEROU: // 653 case JOB_OBORO: // 654 - return msg_txt(653 - JOB_KAGEROU+class_); + return msg_txt(653 - JOB_KAGEROU + class); case JOB_REBELLION: return msg_txt(655); + case JOB_SUMMONER: + return msg_txt(669); + default: return msg_txt(620); // "Unknown Job" } @@ -6487,6 +6579,7 @@ int pc_check_job_name(const char *name) { { "Kagerou", JOB_KAGEROU }, { "Oboro", JOB_OBORO }, { "Rebellion", JOB_REBELLION }, + { "Summoner", JOB_SUMMONER }, }; nullpo_retr(-1, name); @@ -6598,7 +6691,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { status_calc_pc(sd,SCO_FORCE); status_percent_heal(&sd->bl,100,100); - if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { sc_start(NULL,&sd->bl,status->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1)); sc_start(NULL,&sd->bl,status->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1)); sc_start(NULL,&sd->bl,status->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1)); @@ -6606,7 +6699,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { sc_start(NULL,&sd->bl,status->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1)); if (sd->state.snovice_dead_flag) sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead. - } else if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON ) { + } else if ((sd->job & MAPID_BASEMASK) == MAPID_TAEKWON) { sc_start(NULL,&sd->bl,status->skill2sc(AL_INCAGI),100,10,600000); sc_start(NULL,&sd->bl,status->skill2sc(AL_BLESSING),100,10,600000); } @@ -6830,12 +6923,12 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in *------------------------------------------*/ int pc_maxbaselv(const struct map_session_data *sd) { - return pc->max_level[pc->class2idx(sd->status.class_)][0]; + return pc->max_level[pc->class2idx(sd->status.class)][0]; } int pc_maxjoblv(const struct map_session_data *sd) { - return pc->max_level[pc->class2idx(sd->status.class_)][1]; + return pc->max_level[pc->class2idx(sd->status.class)][1]; } /*========================================== @@ -6850,7 +6943,7 @@ unsigned int pc_nextbaseexp(const struct map_session_data *sd) if (sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0) return 0; - return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-1]; + return pc->exp_table[pc->class2idx(sd->status.class)][0][sd->status.base_level-1]; } //Base exp needed for this level. @@ -6859,7 +6952,7 @@ unsigned int pc_thisbaseexp(const struct map_session_data *sd) if (sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1) return 0; - return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-2]; + return pc->exp_table[pc->class2idx(sd->status.class)][0][sd->status.base_level-2]; } /*========================================== @@ -6876,7 +6969,7 @@ unsigned int pc_nextjobexp(const struct map_session_data *sd) if (sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0) return 0; - return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-1]; + return pc->exp_table[pc->class2idx(sd->status.class)][1][sd->status.job_level-1]; } //Job exp needed for this level. @@ -6884,7 +6977,7 @@ unsigned int pc_thisjobexp(const struct map_session_data *sd) { if (sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1) return 0; - return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-2]; + return pc->exp_table[pc->class2idx(sd->status.class)][1][sd->status.job_level-2]; } /// Returns the value of the specified stat. @@ -7115,13 +7208,14 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) { if( sd->status.skill_point > 0 && sd->status.skill[index].id && sd->status.skill[index].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex] - sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class_) ) + sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class) ) { sd->status.skill[index].lv++; sd->status.skill_point--; if( !skill->dbs->db[index].inf ) status_calc_pc(sd,SCO_NONE); // Only recalculate for passive skills. - else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + else if (sd->status.skill_point == 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON + && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) pc->calc_skilltree(sd); // Required to grant all TK Ranger skills. else pc->check_skilltree(sd, skill_id); // Check if a new skill can Lvlup @@ -7177,8 +7271,8 @@ int pc_allskillup(struct map_session_data *sd) } } else { int id; - for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class_)][i].id) > 0; i++) { - int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][i].idx; + for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class)][i].id) > 0; i++) { + int idx = pc->skill_tree[pc->class2idx(sd->status.class)][i].idx; int inf2 = skill->dbs->db[idx].inf2; if ( (inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || @@ -7188,7 +7282,7 @@ int pc_allskillup(struct map_session_data *sd) continue; //Cannot be learned normally. sd->status.skill[idx].id = id; - sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest + sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); // celest } } status_calc_pc(sd,SCO_NONE); @@ -7225,7 +7319,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) sd->status.int_=1; sd->status.dex=1; sd->status.luk=1; - if(sd->status.class_ == JOB_NOVICE_HIGH) { + if (sd->status.class == JOB_NOVICE_HIGH) { sd->status.status_point=100; // not 88 [celest] // give platinum skills upon changing pc->skill(sd, NV_FIRSTAID, 1, SKILL_GRANT_PERMANENT); @@ -7302,7 +7396,7 @@ int pc_resetstate(struct map_session_data* sd) return 0; } - sd->status.status_point = pc->statp[sd->status.base_level] + ((sd->class_&JOBL_UPPER) ? 52 : 0); // extra 52+48=100 stat points + sd->status.status_point = pc->statp[sd->status.base_level] + ((sd->job & JOBL_UPPER) != 0 ? 52 : 0); // extra 52+48=100 stat points } else { @@ -7360,7 +7454,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) int i, inf2, skill_point=0; nullpo_ret(sd); - if( flag&PCRESETSKILL_CHSEX && (sd->class_&MAPID_UPPERMASK) != MAPID_BARDDANCER ) + if (flag&PCRESETSKILL_CHSEX && (sd->job & MAPID_UPPERMASK) != MAPID_BARDDANCER) return 0; if( !(flag&PCRESETSKILL_RECOUNT) ) { //Remove stuff lost when resetting skills. @@ -7368,7 +7462,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) /** * It has been confirmed on official server that when you reset skills with a ranked tweakwon your skills are not reset (because you have all of them anyway) **/ - if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON)) return 0; if( pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex] @@ -7384,7 +7478,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) i &= ~OPTION_WUG; if( i&OPTION_WUGRIDER && pc->checkskill(sd, RA_WUGRIDER) ) i &= ~OPTION_WUGRIDER; - if( i&OPTION_MADOGEAR && ( sd->class_&MAPID_THIRDMASK ) == MAPID_MECHANIC ) + if (i&OPTION_MADOGEAR && (sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) i &= ~OPTION_MADOGEAR; #ifndef NEW_CARTS if( i&OPTION_CART && pc->checkskill(sd, MC_PUSHCART) ) @@ -7398,6 +7492,9 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( homun_alive(sd->hd) && pc->checkskill(sd, AM_CALLHOMUN) ) homun->vaporize(sd, HOM_ST_REST); + + if ((sd->sc.data[SC_SPRITEMABLE] && pc->checkskill(sd, SU_SPRITEMABLE))) + status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); } for( i = 1; i < MAX_SKILL; i++ ) { @@ -7415,14 +7512,16 @@ int pc_resetskill(struct map_session_data* sd, int flag) skill_id = skill->dbs->db[i].nameid; // Don't reset trick dead if not a novice/baby - if( skill_id == NV_TRICKDEAD && (sd->class_&(MAPID_BASEMASK|JOBL_2)) != MAPID_NOVICE ) { + if (skill_id == NV_TRICKDEAD && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { sd->status.skill[i].lv = 0; sd->status.skill[i].flag = 0; continue; } // do not reset basic skill - if( skill_id == NV_BASIC && (sd->class_&(MAPID_BASEMASK|JOBL_2)) != MAPID_NOVICE ) + if (skill_id == NV_BASIC && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) + continue; + if (skill_id == SU_BASIC_SKILL && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) continue; if( sd->status.skill[i].flag == SKILL_FLAG_PERM_GRANTED ) @@ -7800,7 +7899,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } // activate Steel body if a super novice dies at 99+% exp [celest] - if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) { unsigned int next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if( get_percentage(sd->status.base_exp,next) >= 99 ) { @@ -7819,7 +7918,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { // changed penalty options, added death by player if pk_mode [Valaris] if( battle_config.death_penalty_type - && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty + && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty && !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m) && !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY] ) { @@ -8000,10 +8099,10 @@ int pc_readparam(const struct map_session_data *sd, int type) case SP_ZENY: val = sd->status.zeny; break; case SP_BASELEVEL: val = sd->status.base_level; break; case SP_JOBLEVEL: val = sd->status.job_level; break; - case SP_CLASS: val = sd->status.class_; break; - case SP_BASEJOB: val = pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type. - case SP_UPPER: val = (sd->class_&JOBL_UPPER) ? 1 : ((sd->class_&JOBL_BABY) ? 2 : 0); break; - case SP_BASECLASS: val = pc->mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex] + case SP_CLASS: val = sd->status.class; break; + case SP_BASEJOB: val = pc->mapid2jobid(sd->job & MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type. + case SP_UPPER: val = (sd->job & JOBL_UPPER) != 0 ? 1 : ((sd->job & JOBL_BABY) != 0 ? 2 : 0); break; + case SP_BASECLASS: val = pc->mapid2jobid(sd->job & MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex] case SP_SEX: val = sd->status.sex; break; case SP_WEIGHT: val = sd->weight; break; case SP_MAXWEIGHT: val = sd->max_weight; break; @@ -8396,6 +8495,9 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) if( sd->sc.data[SC_EXTREMITYFIST2] ) sp = 0; #endif + if (sd->sc.data[SC_BITESCAR]) { + hp = 0; + } } return status->heal(&sd->bl, hp, sp, 1); @@ -8458,44 +8560,43 @@ int jobchange_killclone(struct block_list *bl, va_list ap) * Called when player changes job * Rewrote to make it tidider [Celest] *------------------------------------------*/ -int pc_jobchange(struct map_session_data *sd,int job, int upper) +int pc_jobchange(struct map_session_data *sd, int class, int upper) { int i, fame_flag=0; - int b_class, idx = 0; + int job, idx = 0; nullpo_ret(sd); - if (job < 0) + if (class < 0) return 1; //Normalize job. - b_class = pc->jobid2mapid(job); - if (b_class == -1) + job = pc->jobid2mapid(class); + if (job == -1) return 1; switch (upper) { case 1: - b_class|= JOBL_UPPER; + job |= JOBL_UPPER; break; case 2: - b_class|= JOBL_BABY; + job |= JOBL_BABY; break; } //This will automatically adjust bard/dancer classes to the correct gender //That is, if you try to jobchange into dancer, it will turn you to bard. - job = pc->mapid2jobid(b_class, sd->status.sex); - if (job == -1) + class = pc->mapid2jobid(job, sd->status.sex); + if (class == -1) return 1; - if ((unsigned short)b_class == sd->class_) + if ((uint16)job == sd->job) return 1; //Nothing to change. - // changing from 1st to 2nd job - if ((b_class&JOBL_2) && !(sd->class_&JOBL_2) && (b_class&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) { + if ((job & JOBL_2) != 0 && (sd->job & JOBL_2) == 0 && (job & MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) { + // changing from 1st to 2nd job sd->change_level_2nd = sd->status.job_level; pc_setglobalreg(sd, script->add_str("jobchange_level"), sd->change_level_2nd); - } - // changing from 2nd to 3rd job - else if((b_class&JOBL_THIRD) && !(sd->class_&JOBL_THIRD)) { + } else if((job & JOBL_THIRD) != 0 && (sd->job & JOBL_THIRD) == 0) { + // changing from 2nd to 3rd job sd->change_level_3rd = sd->status.job_level; pc_setglobalreg(sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd); } @@ -8526,10 +8627,10 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) pc_setglobalreg(sd, script->add_str("REPRODUCE_SKILL_LV"),0); } - if ( (b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK) ) { //Things to remove when changing class tree. - const int class_ = pc->class2idx(sd->status.class_); + if ((job & MAPID_UPPERMASK) != (sd->job & MAPID_UPPERMASK)) { //Things to remove when changing class tree. + const int class_idx = pc->class2idx(sd->status.class); short id; - for(i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[class_][i].id) > 0; i++) { + for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[class_idx][i].id) > 0; i++) { //Remove status specific to your current tree skills. enum sc_type sc = status->skill2sc(id); if (sc > SC_COMMON_MAX && sd->sc.data[sc]) @@ -8537,14 +8638,18 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) } } - if( (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (b_class&MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (job & MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) { /* going off star glad lineage, reset feel to not store no-longer-used vars in the database */ pc->resetfeel(sd); } - sd->status.class_ = job; - fame_flag = pc->famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK); - sd->class_ = (unsigned short)b_class; + sd->status.class = class; + { + int fame_list_type = pc->famelist_type(sd->job); + if (fame_list_type != RANKTYPE_UNKNOWN) + fame_flag = pc->fame_rank(sd->status.char_id, fame_list_type); + } + sd->job = (uint16)job; sd->status.job_level=1; sd->status.job_exp=0; @@ -8573,8 +8678,8 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if (sd->disguise != -1) pc->disguise(sd, -1); - status->set_viewdata(&sd->bl, job); - clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris] + status->set_viewdata(&sd->bl, class); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); // move sprite update to prevent client crashes with incompatible equipment [Valaris] if(sd->vd.cloth_color) clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); if (sd->vd.body_style) @@ -8593,7 +8698,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) //Remove peco/cart/falcon i = sd->sc.option; - if( i&OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) ) + if (i&OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT)) i&=~OPTION_RIDING; if( i&OPTION_FALCON && !pc->checkskill(sd, HT_FALCON) ) i&=~OPTION_FALCON; @@ -8618,6 +8723,9 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if(homun_alive(sd->hd) && !pc->checkskill(sd, AM_CALLHOMUN)) homun->vaporize(sd, HOM_ST_REST); + if ((sd->sc.data[SC_SPRITEMABLE] && pc->checkskill(sd, SU_SPRITEMABLE))) + status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); + if(sd->status.manner < 0) clif->changestatus(sd,SP_MANNER,sd->status.manner); @@ -8626,12 +8734,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) pc->equiplookall(sd); //if you were previously famous, not anymore. - if (fame_flag) { + if (fame_flag != 0) { chrif->save(sd,0); chrif->buildfamelist(); } else if (sd->status.fame > 0) { //It may be that now they are famous? - switch (sd->class_&MAPID_UPPERMASK) { + switch (sd->job & MAPID_UPPERMASK) { case MAPID_BLACKSMITH: case MAPID_ALCHEMIST: case MAPID_TAEKWON: @@ -8671,7 +8779,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) switch(type){ case LOOK_BASE: status->set_viewdata(&sd->bl, val); - clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); + clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class); clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); if (sd->vd.cloth_color) clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); @@ -8817,8 +8925,8 @@ int pc_setoption(struct map_session_data *sd,int type) return 0; //Disguises break sprite changes if (new_look < 0) { //Restore normal look. - status->set_viewdata(&sd->bl, sd->status.class_); - new_look = sd->vd.class_; + status->set_viewdata(&sd->bl, sd->status.class); + new_look = sd->vd.class; } pc_stop_attack(sd); //Stop attacking on new view change (to prevent wedding/santa attacks. @@ -8940,7 +9048,7 @@ void pc_setmadogear(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { - if ((sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC) + if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR); } else if (pc_ismadogear(sd)) { pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR); @@ -9186,7 +9294,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val) { switch( regname[0] ) { default: //Char reg if( !strcmp(regname,"PC_DIE_COUNTER") && sd->die_counter != val ) { - int i = (!sd->die_counter && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE); + int i = (!sd->die_counter && (sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE); sd->die_counter = val; if( i ) status_calc_pc(sd,SCO_NONE); // Lost the bonus. @@ -10224,7 +10332,7 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) { if(sd == NULL || dstsd == NULL || sd->status.partner_id > 0 || dstsd->status.partner_id > 0 || - (sd->class_&JOBL_BABY) || (dstsd->class_&JOBL_BABY)) + (sd->job & JOBL_BABY) != 0 || (dstsd->job & JOBL_BABY) != 0) return -1; sd->status.partner_id = dstsd->status.char_id; dstsd->status.partner_id = sd->status.char_id; @@ -10288,7 +10396,7 @@ struct map_session_data *pc_get_partner(struct map_session_data *sd) { * Get sd father charid. (Need to be baby) *------------------------------------------*/ struct map_session_data *pc_get_father(struct map_session_data *sd) { - if (sd && sd->class_&JOBL_BABY && sd->status.father > 0) + if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.father > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.father); @@ -10299,7 +10407,7 @@ struct map_session_data *pc_get_father(struct map_session_data *sd) { * Get sd mother charid. (Need to be baby) *------------------------------------------*/ struct map_session_data *pc_get_mother(struct map_session_data *sd) { - if (sd && sd->class_&JOBL_BABY && sd->status.mother > 0) + if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.mother > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.mother); @@ -11635,16 +11743,17 @@ void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idlet } //Checks if the given class value corresponds to a player class. [Skotlex] -//JOB_NOVICE isn't checked for class_ is supposed to be unsigned -bool pc_db_checkid(unsigned int class_) +//JOB_NOVICE isn't checked for class is supposed to be unsigned +bool pc_db_checkid(int class) { - return class_ < JOB_MAX_BASIC - || (class_ >= JOB_NOVICE_HIGH && class_ <= JOB_DARK_COLLECTOR ) - || (class_ >= JOB_RUNE_KNIGHT && class_ <= JOB_MECHANIC_T2 ) - || (class_ >= JOB_BABY_RUNE && class_ <= JOB_BABY_MECHANIC2 ) - || (class_ >= JOB_SUPER_NOVICE_E && class_ <= JOB_SUPER_BABY_E ) - || (class_ >= JOB_KAGEROU && class_ <= JOB_OBORO ) - || (class_ >= JOB_REBELLION && class_ < JOB_MAX ); + return class < JOB_MAX_BASIC + || (class >= JOB_NOVICE_HIGH && class <= JOB_DARK_COLLECTOR ) + || (class >= JOB_RUNE_KNIGHT && class <= JOB_MECHANIC_T2 ) + || (class >= JOB_BABY_RUNE && class <= JOB_BABY_MECHANIC2 ) + || (class >= JOB_SUPER_NOVICE_E && class <= JOB_SUPER_BABY_E ) + || (class >= JOB_KAGEROU && class <= JOB_OBORO ) + || (class == JOB_REBELLION) + || (class >= JOB_SUMMONER && class < JOB_MAX ); } /** @@ -11655,13 +11764,25 @@ bool pc_db_checkid(unsigned int class_) int pc_have_magnifier(struct map_session_data *sd) { int n; - n = pc->search_inventory(sd, ITEMID_MAGNIFIER); + n = pc->search_inventory(sd, ITEMID_SPECTACLES); if (n == INDEX_NOT_FOUND) - n = pc->search_inventory(sd, ITEMID_NOVICE_MAGNIFIER); + n = pc->search_inventory(sd, ITEMID_N_MAGNIFIER); return n; } /** + * Checks if player have basic skills learned. + * @param sd Player Data + * @param level Required Level of Novice Skill + * @return bool true, if requirement is satisfied + */ +bool pc_check_basicskill(struct map_session_data *sd, int level) { + if (pc->checkskill(sd, NV_BASIC) >= level || pc->checkskill(sd, SU_BASIC_SKILL)) + return true; + return false; +} + +/** * Verifies a chat message, searching for atcommands, checking if the sender * character can chat, and updating the idle timer. * @@ -11708,7 +11829,7 @@ void pc_check_supernovice_call(struct map_session_data *sd, const char *message) nullpo_retv(sd); nullpo_retv(message); - if ((sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) + if ((sd->job & MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) return; if (next == 0) next = pc->thisbaseexp(sd); @@ -12028,7 +12149,8 @@ void pc_defaults(void) { pc->addspiritball = pc_addspiritball; pc->delspiritball = pc_delspiritball; pc->addfame = pc_addfame; - pc->famerank = pc_famerank; + pc->fame_rank = pc_fame_rank; + pc->famelist_type = pc_famelist_type; pc->set_hate_mob = pc_set_hate_mob; pc->getmaxspiritball = pc_getmaxspiritball; @@ -12117,4 +12239,6 @@ void pc_defaults(void) { pc->update_idle_time = pc_update_idle_time; pc->have_magnifier = pc_have_magnifier; + + pc->check_basicskill = pc_check_basicskill; } diff --git a/src/map/pc.h b/src/map/pc.h index fd446813f..0e4f1affd 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -235,7 +235,7 @@ struct map_session_data { unsigned int bonus_coma : 1; } special_state; int login_id1, login_id2; - unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] + uint16 job; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] /// Groups & permissions int group_id; @@ -635,12 +635,13 @@ END_ZEROED_BLOCK; #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate ) #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) #define pc_maxparameter(sd) ( \ - ( ((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \ - || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION \ - || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \ - ) ? battle->bc->max_extended_parameter : ((sd)->class_&JOBL_THIRD) ? \ - (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter ) : \ - (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_parameter : battle->bc->max_parameter) \ + ((sd)->job & MAPID_BASEMASK) == MAPID_SUMMONER ? battle->bc->max_summoner_parameter : \ + ( ((sd)->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \ + || ((sd)->job & MAPID_UPPERMASK) == MAPID_REBELLION \ + || ((sd)->job & MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \ + ) ? battle->bc->max_extended_parameter : ((sd)->job & JOBL_THIRD) ? \ + (((sd)->job & JOBL_BABY) ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter ) : \ + (((sd)->job & JOBL_BABY) ? battle->bc->max_baby_parameter : battle->bc->max_parameter) \ ) /// Generic check for mounts #define pc_hasmount(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_WUGRIDER|OPTION_DRAGON|OPTION_MADOGEAR) ) @@ -823,7 +824,7 @@ END_ZEROED_BLOCK; /* End */ void (*final) (void); struct map_session_data* (*get_dummy_sd) (void); - int (*class2idx) (int class_); + int (*class2idx) (int class); bool (*can_talk) (struct map_session_data *sd); bool (*can_attack) ( struct map_session_data *sd, int target_id ); @@ -947,7 +948,7 @@ END_ZEROED_BLOCK; /* End */ void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type); int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp); int (*percentheal) (struct map_session_data *sd,int hp,int sp); - int (*jobchange) (struct map_session_data *sd,int job, int upper); + int (*jobchange) (struct map_session_data *sd, int class, int upper); int (*setoption) (struct map_session_data *sd,int type); int (*setcart) (struct map_session_data* sd, int type); void (*setfalcon) (struct map_session_data *sd, bool flag); @@ -991,10 +992,10 @@ END_ZEROED_BLOCK; /* End */ void (*setstand) (struct map_session_data *sd); int (*candrop) (struct map_session_data *sd,struct item *item); - int (*jobid2mapid) (unsigned short b_class); // Skotlex + int (*jobid2mapid) (int16 class); // Skotlex int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex - const char * (*job_name) (int class_); + const char * (*job_name) (int class); void (*setinvincibletimer) (struct map_session_data* sd, int val); void (*delinvincibletimer) (struct map_session_data* sd); @@ -1002,8 +1003,9 @@ END_ZEROED_BLOCK; /* End */ int (*addspiritball) (struct map_session_data *sd,int interval,int max); int (*delspiritball) (struct map_session_data *sd,int count,int type); int (*getmaxspiritball) (struct map_session_data *sd, int min); - void (*addfame) (struct map_session_data *sd,int count); - unsigned char (*famerank) (int char_id, int job); + void (*addfame) (struct map_session_data *sd, int ranktype, int count); + int (*fame_rank) (int char_id, int ranktype); + int (*famelist_type) (uint16 job_mapid); int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl); int (*readdb) (void); @@ -1014,7 +1016,7 @@ END_ZEROED_BLOCK; /* End */ int (*inventory_rental_clear) (struct map_session_data *sd); void (*inventory_rental_add) (struct map_session_data *sd, int seconds); - int (*disguise) (struct map_session_data *sd, int class_); + int (*disguise) (struct map_session_data *sd, int class); bool (*isautolooting) (struct map_session_data *sd, int nameid); void (*overheat) (struct map_session_data *sd, int val); @@ -1073,7 +1075,7 @@ END_ZEROED_BLOCK; /* End */ int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data); void (*expire_check) (struct map_session_data *sd); - bool (*db_checkid) (unsigned int class_); + bool (*db_checkid) (int class); void (*validate_levels) (void); @@ -1094,6 +1096,7 @@ END_ZEROED_BLOCK; /* End */ bool (*process_chat_message) (struct map_session_data *sd, const char *message); void (*check_supernovice_call) (struct map_session_data *sd, const char *message); + bool (*check_basicskill) (struct map_session_data *sd, int level); }; #ifdef HERCULES_CORE diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index f0e3880b8..9645300ef 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 27eac7284..7c933f054 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/pet.c b/src/map/pet.c index 9d7264103..9ac496659 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/pet.h b/src/map/pet.h index 79cbeddae..9a0287b42 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/quest.c b/src/map/quest.c index 544ddf985..ed8e5bd33 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/quest.h b/src/map/quest.h index e0768ef40..8837a1fb6 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/script.c b/src/map/script.c index a1efbb3b8..38931bd11 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -771,7 +771,7 @@ const char* skip_word(const char* p) p += ( p[1] == '@' ? 2 : 1 ); break; } - while( ISALNUM(*p) || *p == '_' || *p == '\'' ) + while (ISALNUM(*p) || *p == '_') ++p; // postfix @@ -5482,8 +5482,6 @@ bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) safestrncpy(buf, p, len); StrBuf->AppendStr(out, buf); } - - p = np; np++; // placeholder = "%%" ; (special case) @@ -6393,6 +6391,9 @@ int buildin_areawarp_sub(struct block_list *bl, va_list ap) pc->randomwarp(sd, CLR_TELEPORT); } else if (x3 != 0 && y3 != 0) { int max, tx, ty, j = 0; + int16 m; + + m = map->mapindex2mapid(index); // choose a suitable max number of attempts if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 ) @@ -6403,7 +6404,7 @@ int buildin_areawarp_sub(struct block_list *bl, va_list ap) tx = rnd()%(x3-x2+1)+x2; ty = rnd()%(y3-y2+1)+y2; j++; - } while (map->getcell(index, bl, tx, ty, CELL_CHKNOPASS) && j < max); + } while (map->getcell(m, bl, tx, ty, CELL_CHKNOPASS) && j < max); pc->setpos(sd, index, tx, ty, CLR_OUTSIGHT); } else { @@ -6723,13 +6724,16 @@ BUILDIN(percentheal) } sd = script->rid2sd(st); - if( sd == NULL ) + if (sd == NULL) return true; #ifdef RENEWAL if( sd->sc.data[SC_EXTREMITYFIST2] ) sp = 0; #endif - pc->percentheal(sd,hp,sp); + if (sd->sc.data[SC_BITESCAR]) { + hp = 0; + } + pc->percentheal(sd, hp, sp); return true; } @@ -6738,18 +6742,18 @@ BUILDIN(percentheal) *------------------------------------------*/ BUILDIN(jobchange) { - int job, upper=-1; + int class, upper=-1; - job=script_getnum(st,2); + class = script_getnum(st,2); if( script_hasdata(st,3) ) upper=script_getnum(st,3); - if (pc->db_checkid(job)) { + if (pc->db_checkid(class)) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - pc->jobchange(sd, job, upper); + pc->jobchange(sd, class, upper); } return true; @@ -6760,8 +6764,8 @@ BUILDIN(jobchange) *------------------------------------------*/ BUILDIN(jobname) { - int class_=script_getnum(st,2); - script_pushconststr(st, pc->job_name(class_)); + int class = script_getnum(st,2); + script_pushconststr(st, pc->job_name(class)); return true; } @@ -8012,6 +8016,90 @@ BUILDIN(makeitem) return true; } +/*========================================== +* makeitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,{"<map name>",<X>,<Y>,<range>}; +*------------------------------------------*/ +BUILDIN(makeitem2) +{ + struct map_session_data *sd = NULL; + struct item_data *i_data; + int nameid = 0, amount; + int16 x, y, m = -1, range; + struct item item_tmp; + + if (script_isstringtype(st, 2)) { + const char *name = script_getstr(st, 2); + struct item_data *item_data = itemdb->search_name(name); + if (item_data != NULL) + nameid = item_data->nameid; + } else { + nameid = script_getnum(st, 2); + } + + i_data = itemdb->exists(nameid); + if (i_data == NULL) { + ShowError("makeitem2: Unknown item %d requested.\n", nameid); + return true; + } + + if (script_hasdata(st, 11)) { + m = map->mapname2mapid(script_getstr(st, 11)); + } else { + sd = script->rid2sd(st); + if (sd == NULL) + return true; + m = sd->bl.m; + } + + if (m == -1) { + ShowError("makeitem2: Nonexistant map requested.\n"); + return true; + } + + x = (script_hasdata(st, 12) ? script_getnum(st, 12) : 0); + y = (script_hasdata(st, 13) ? script_getnum(st, 13) : 0); + + // pick random position on map + if (x <= 0 || x >= map->list[m].xs || y <= 0 || y >= map->list[m].ys) { + sd = map->id2sd(st->rid); + if ((x < 0 || y < 0) && sd == NULL) { + x = 0; + y = 0; + map->search_freecell(NULL, m, &x, &y, -1, -1, 1); + } else { + range = (script_hasdata(st, 14) ? cap_value(script_getnum(st, 14), 1, battle_config.area_size) : 3); + map->search_freecell(&sd->bl, sd->bl.m, &x, &y, range, range, 0); // Locate spot next to player. + } + } + + // if equip or weapon or egg type only drop one. + switch (i_data->type) { + case IT_ARMOR: + case IT_WEAPON: + case IT_PETARMOR: + case IT_PETEGG: + amount = 1; + break; + default: + amount = cap_value(script_getnum(st, 3), 1, MAX_AMOUNT); + break; + } + + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = nameid; + item_tmp.identify = script_getnum(st, 4); + item_tmp.refine = cap_value(script_getnum(st, 5), 0, MAX_REFINE); + item_tmp.attribute = script_getnum(st, 6); + item_tmp.card[0] = (short)script_getnum(st, 7); + item_tmp.card[1] = (short)script_getnum(st, 8); + item_tmp.card[2] = (short)script_getnum(st, 9); + item_tmp.card[3] = (short)script_getnum(st, 10); + + map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0); + + return true; +} + /// Counts / deletes the current item given by idx. /// Used by buildin_delitem_search /// Relies on all input data being already fully valid. @@ -8473,7 +8561,7 @@ BUILDIN(getpartyleader) switch (type) { case 1: script_pushint(st,p->party.member[i].account_id); break; case 2: script_pushint(st,p->party.member[i].char_id); break; - case 3: script_pushint(st,p->party.member[i].class_); break; + case 3: script_pushint(st,p->party.member[i].class); break; case 4: script_pushstrcopy(st,mapindex_id2name(p->party.member[i].map)); break; case 5: script_pushint(st,p->party.member[i].lv); break; default: script_pushstrcopy(st,p->party.member[i].name); break; @@ -9080,15 +9168,15 @@ BUILDIN(successrefitem) sd->status.char_id == (int)MakeDWord(sd->status.inventory[i].card[2],sd->status.inventory[i].card[3]) ) { // Fame point system [DracoRPG] switch (sd->inventory_data[i]->wlv) { - case 1: - pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point - break; - case 2: - pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point - break; - case 3: - pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point - break; + case 1: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point + break; + case 2: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point + break; + case 3: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point + break; } } } @@ -9889,7 +9977,7 @@ BUILDIN(setmount) flag = SETMOUNT_TYPE_AUTODETECT; } // Sanity checks and auto-detection - if ((sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) { + if ((sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) { if (pc->checkskill(sd, RK_DRAGONTRAINING)) { // Rune Knight (Dragon) unsigned int option; @@ -9901,11 +9989,11 @@ BUILDIN(setmount) OPTION_DRAGON1); // default value pc->setridingdragon(sd, option); } - } else if ((sd->class_&MAPID_THIRDMASK) == MAPID_RANGER) { + } else if ((sd->job & MAPID_THIRDMASK) == MAPID_RANGER) { // Ranger (Warg) if (pc->checkskill(sd, RA_WUGRIDER)) pc->setridingwug(sd, true); - } else if ((sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC) { + } else if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { // Mechanic (Mado Gear) if (pc->checkskill(sd, NC_MADOLICENCE)) pc->setmadogear(sd, true); @@ -11679,22 +11767,22 @@ BUILDIN(homunculus_shuffle) //These two functions bring the eA MAPID_* class functionality to scripts. BUILDIN(eaclass) { - int class_; + int class; if (script_hasdata(st,2)) { - class_ = script_getnum(st,2); + class = script_getnum(st,2); } else { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - class_ = sd->status.class_; + class = sd->status.class; } - script_pushint(st,pc->jobid2mapid(class_)); + script_pushint(st,pc->jobid2mapid(class)); return true; } BUILDIN(roclass) { - int class_ =script_getnum(st,2); + int job = script_getnum(st,2); int sex; if (script_hasdata(st,3)) { sex = script_getnum(st,3); @@ -11705,7 +11793,7 @@ BUILDIN(roclass) else sex = 1; //Just use male when not found. } - script_pushint(st,pc->mapid2jobid(class_, sex)); + script_pushint(st,pc->mapid2jobid(job, sex)); return true; } @@ -11801,12 +11889,12 @@ BUILDIN(changebase) if(vclass == JOB_WEDDING) { if (!battle_config.wedding_modifydisplay || //Do not show the wedding sprites - sd->class_&JOBL_BABY //Baby classes screw up when showing wedding sprites. [Skotlex] They don't seem to anymore. + sd->job & JOBL_BABY //Baby classes screw up when showing wedding sprites. [Skotlex] They don't seem to anymore. ) return true; } - if(sd->disguise == -1 && vclass != sd->vd.class_) + if (sd->disguise == -1 && vclass != sd->vd.class) pc->changelook(sd,LOOK_BASE,vclass); //Updated client view. Base, Weapon and Cloth Colors. return true; @@ -13753,14 +13841,14 @@ BUILDIN(undisguise) * @type unused *------------------------------------------*/ BUILDIN(classchange) { - int class_,type; + int class, type; struct block_list *bl=map->id2bl(st->oid); if(bl==NULL) return true; - class_=script_getnum(st,2); + class = script_getnum(st,2); type=script_getnum(st,3); - clif->class_change(bl,class_,type); + clif->class_change(bl, class, type); return true; } @@ -20745,6 +20833,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getnameditem,"vv"), BUILDIN_DEF2(grouprandomitem,"groupranditem","i"), BUILDIN_DEF(makeitem,"visii"), + BUILDIN_DEF(makeitem2,"viiiiiiii????"), BUILDIN_DEF(delitem,"vi?"), BUILDIN_DEF(delitem2,"viiiiiiii?"), BUILDIN_DEF2(enableitemuse,"enable_items",""), diff --git a/src/map/searchstore.c b/src/map/searchstore.c index 1782112f1..16d8ce130 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 8edfcd2a8..2d1de7e55 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/skill.c b/src/map/skill.c index 2559a7a5b..51a8a28e7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -131,7 +131,7 @@ int skill_get_index (uint16 skill_id) skill_id = (1077) + skill_id - 2201; else if ( skill_id < 3036 ) // 2549 - 3000 are empty - 1020+57+348 skill_id = (1425) + skill_id - 3001; - else if ( skill_id < 5019 ) // 3036 - 5000 are empty - 1020+57+348+35 + else if ( skill_id < 5044 ) // 3036 - 5000 are empty - 1020+57+348+35 skill_id = (1460) + skill_id - 5001; else ShowWarning("skill_get_index: skill id '%d' is not being handled!\n",skill_id); @@ -219,14 +219,14 @@ int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) { #endif } -int skill_tree_get_max(uint16 skill_id, int b_class) +int skill_tree_get_max(uint16 skill_id, int class) { int i; - b_class = pc->class2idx(b_class); + int class_idx = pc->class2idx(class); - ARR_FIND( 0, MAX_SKILL_TREE, i, pc->skill_tree[b_class][i].id == 0 || pc->skill_tree[b_class][i].id == skill_id ); - if( i < MAX_SKILL_TREE && pc->skill_tree[b_class][i].id == skill_id ) - return pc->skill_tree[b_class][i].max; + ARR_FIND( 0, MAX_SKILL_TREE, i, pc->skill_tree[class_idx][i].id == 0 || pc->skill_tree[class_idx][i].id == skill_id ); + if( i < MAX_SKILL_TREE && pc->skill_tree[class_idx][i].id == skill_id ) + return pc->skill_tree[class_idx][i].max; else return skill->get_max(skill_id); } @@ -365,7 +365,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk nullpo_ret(src); - switch( skill_id ) { + switch (skill_id) { + case SU_TUNABELLY: + hp = status_get_max_hp(target) * ((20 * skill_lv) - 10) / 100; + break; case BA_APPLEIDUN: #ifdef RENEWAL hp = 100+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery @@ -397,6 +400,11 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk hp += hp * skill2_lv * 2 / 100; else if (src->type == BL_HOM && (skill2_lv = homun->checkskill(BL_UCAST(BL_HOM, src), HLIF_BRAIN)) > 0) hp += hp * skill2_lv * 2 / 100; + if (sd != NULL && ((skill2_lv = pc->checkskill(sd, SU_POWEROFSEA)) > 0)) { + hp += hp * 10 / 100; + if (pc->checkskill(sd, SU_TUNABELLY) == 5 && pc->checkskill(sd, SU_TUNAPARTY) == 5 && pc->checkskill(sd, SU_BUNCHOFSHRIMP) == 5 && pc->checkskill(sd, SU_FRESHSHRIMP) == 5) + hp += hp * 20 / 100; + } break; } @@ -451,13 +459,14 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b if (skill->get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL)) return 0; - // High-class skills - if((skill_id >= LK_AURABLADE && skill_id <= ASC_CDP) || (skill_id >= ST_PRESERVE && skill_id <= CR_CULTIVATION)) - { - if(battle_config.copyskill_restrict == 2) + // Transcendent-class skills + if((skill_id >= LK_AURABLADE && skill_id <= ASC_CDP) || (skill_id >= ST_PRESERVE && skill_id <= CR_CULTIVATION)) { + if (battle_config.copyskill_restrict == 2) { return 0; - else if(battle_config.copyskill_restrict) - return (sd->status.class_ == JOB_STALKER); + } else if (battle_config.copyskill_restrict == 1) { + if ((sd->job & (MAPID_UPPERMASK | JOBL_UPPER)) != MAPID_STALKER) + return 0; + } } //Added so plagarize can't copy agi/bless if you're undead since it damages you @@ -466,8 +475,11 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b skill_id == MER_INCAGI || skill_id == MER_BLESSING)) return 0; - // Couldn't preserve 3rd Class skills except only when using Reproduce skill. [Jobbie] - if( !(sd->sc.data[SC__REPRODUCE]) && ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) || (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI) || (skill_id >= GC_DARKCROW && skill_id <= NC_MAGMA_ERUPTION_DOTDAMAGE))) + // Couldn't preserve 3rd Class/Summoner skills except only when using Reproduce skill. [Jobbie] + if (!(sd->sc.data[SC__REPRODUCE]) && + ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) || + (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI) || + (skill_id >= GC_DARKCROW && skill_id <= SU_FRESHSHRIMP))) return 0; // Reproduce will only copy skills according on the list. [Jobbie] else if( sd->sc.data[SC__REPRODUCE] && !skill->dbs->reproduce_db[skill->get_index(skill_id)] ) @@ -902,6 +914,10 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 break; #endif + case WZ_HEAVENDRIVE: + status_change_end(bl, SC_SV_ROOTTWIST, INVALID_TIMER); + break; + case WZ_STORMGUST: /** * Storm Gust counter was dropped in renewal @@ -1135,8 +1151,8 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 break; case TK_JUMPKICK: - if( dstsd && dstsd->class_ != MAPID_SOUL_LINKER && !tsc->data[SC_PRESERVE] ) - {// debuff the following statuses + if (dstsd != NULL && (dstsd->job & MAPID_UPPERMASK) != MAPID_SOUL_LINKER && tsc->data[SC_PRESERVE] == NULL) { + // debuff the following statuses status_change_end(bl, SC_SOULLINK, INVALID_TIMER); status_change_end(bl, SC_ADRENALINE2, INVALID_TIMER); status_change_end(bl, SC_KAITE, INVALID_TIMER); @@ -1415,6 +1431,25 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 case MH_XENO_SLASHER: sc_start2(src, bl, SC_BLOODING, 10 * skill_lv, skill_lv, src->id, skill->get_time(skill_id,skill_lv)); break; + /** + * Summoner + */ + case SU_SCRATCH: + sc_start2(src, bl, SC_BLOODING, (skill_lv * 3), skill_lv, src->id, skill->get_time(skill_id, skill_lv)); // TODO: What's the chance/time? + break; + case SU_SV_STEMSPEAR: + sc_start2(src, bl, SC_BLOODING, 10, skill_lv, src->id, skill->get_time(skill_id, skill_lv)); + break; + case SU_CN_METEOR: + sc_start(src, bl, SC_CURSE, 10, skill_lv, skill->get_time2(skill_id, skill_lv)); // TODO: What's the chance/time? + break; + case SU_SCAROFTAROU: + sc_start(src, bl, SC_STUN, 10, skill_lv, skill->get_time2(skill_id, skill_lv)); // TODO: What's the chance/time? + break; + case SU_LUNATICCARROTBEAT: + if (skill->area_temp[3] == 1) + sc_start(src, bl, SC_STUN, 10, skill_lv, skill_get_time(skill_id, skill_lv)); // TODO: What's the chance/time? + break; default: skill->additional_effect_unknown(src, bl, &skill_id, &skill_lv, &attack_type, &dmg_lv, &tick); break; @@ -1808,7 +1843,7 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b break; } - if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR + if (sd != NULL && (sd->job & MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && rnd()%10000 < battle_config.sg_miracle_skill_ratio) // SG_MIRACLE [Komurka] sc_start(src,src,SC_MIRACLE,100,1,battle_config.sg_miracle_skill_duration); @@ -2088,6 +2123,7 @@ int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) { int dx = 0, dy = 0; + struct status_change *tsc = status->get_sc(target); nullpo_ret(src); @@ -2135,6 +2171,9 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in dy = -diry[dir]; } + if (tsc != NULL && tsc->data[SC_SU_STOOP]) // Any knockback will cancel it. + status_change_end(target, SC_SU_STOOP, INVALID_TIMER); + return unit->blown(target, dx, dy, count, flag); // send over the proper flag } @@ -2391,7 +2430,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: - if (pc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time. + if (pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) { //Extend combo time. sce->val1 = skill_id; //Update combo-skill sce->val3 = skill_id; if( sce->timer != INVALID_TIMER ) @@ -3442,7 +3481,8 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) { break; switch( skl->skill_id ) { case WZ_METEOR: - if( skl->type >= 0 ) { + case SU_CN_METEOR: + if (skl->type >= 0) { int x = skl->type>>16, y = skl->type&0xFFFF; if( path->search_long(NULL, src, src->m, src->x, src->y, x, y, CELL_CHKWALL) ) skill->unitsetting(src,skl->skill_id,skl->skill_lv,x,y,skl->flag); @@ -3961,7 +4001,17 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; - //Splash attack skills. + case SU_BITE: + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + if (status->get_lv(src) >= 30 && (rnd() % 100 < (int)(status->get_lv(src) / 30) + 10)) // TODO: Need activation chance. + skill->addtimerskill(src, tick + skill->get_delay(skill_id, skill_lv), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); + break; + + case SU_PICKYPECK: + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + break; + + // Splash attack skills. case AS_GRIMTOOTH: case MC_CARTREVOLUTION: case NPC_SPLASHATTACK: @@ -4014,7 +4064,9 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 case KO_BAKURETSU: case GN_ILLUSIONDOPING: case MH_XENO_SLASHER: - if( flag&1 ) {//Recursive invocation + case SU_SCRATCH: + case SU_LUNATICCARROTBEAT: + if (flag&1) { //Recursive invocation // skill->area_temp[0] holds number of targets in area // skill->area_temp[1] holds the id of the original target // skill->area_temp[2] counts how many targets have already been processed @@ -4029,15 +4081,19 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 break; heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag); - if( skill_id == NPC_VAMPIRE_GIFT && heal > 0 ) { + if (skill_id == NPC_VAMPIRE_GIFT && heal > 0) { clif->skill_nodamage(NULL, src, AL_HEAL, heal, 1); status->heal(src,heal,0,0); } + if (skill_id == SU_SCRATCH && status->get_lv(src) >= 30 && (rnd() % 100 < (int)(status->get_lv(src) / 30) + 10)) // TODO: Need activation chance. + skill->addtimerskill(src, tick + skill->get_delay(skill_id, skill_lv), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); } else { switch ( skill_id ) { case NJ_BAKUENRYU: case LG_EARTHDRIVE: case GN_CARTCANNON: + case SU_SCRATCH: + case SU_LUNATICCARROTBEAT: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case SR_TIGERCANNON: @@ -4056,13 +4112,19 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 skill->area_temp[0] = 0; skill->area_temp[1] = bl->id; skill->area_temp[2] = 0; - if( skill_id == WL_CRIMSONROCK ) { + if (skill_id == WL_CRIMSONROCK) { skill->area_temp[4] = bl->x; skill->area_temp[5] = bl->y; } + if (skill_id == SU_LUNATICCARROTBEAT) { + skill->area_temp[3] = 0; + } - if( skill_id == NC_VULCANARM ) - if (sd) pc->overheat(sd,1); + if (skill_id == NC_VULCANARM) { + if (sd != NULL) { + pc->overheat(sd,1); + } + } // if skill damage should be split among targets, count them //SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets @@ -4072,6 +4134,15 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 // recursive invocation of skill->castend_damage_id() with flag|1 map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), skill->splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id); + + if (sd && skill_id == SU_LUNATICCARROTBEAT) { + short item_idx = pc->search_inventory(sd, ITEMID_CARROT); + + if (item_idx >= 0) { + pc->delitem(sd, item_idx, 1, 0, 1, LOG_TYPE_CONSUME); + skill->area_temp[3] = 1; + } + } } break; @@ -4629,7 +4700,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) { struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP; + item_tmp.nameid = sg->item_id ? sg->item_id : ITEMID_BOOBY_TRAP; item_tmp.identify = 1; if( item_tmp.nameid ) map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); @@ -4881,6 +4952,15 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); break; + case SU_SV_STEMSPEAR: + skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag); + if (status->get_lv(src) >= 30 && (rnd() % 100 < (int)(status->get_lv(src) / 30) + 10)) // TODO: Need activation chance. + skill->addtimerskill(src, tick + skill->get_delay(skill_id, skill_lv), bl->id, 0, 0, skill_id, skill_lv, (skill_id == SU_SV_STEMSPEAR) ? BF_MAGIC : BF_WEAPON, flag); + break; + case SU_SCAROFTAROU: + sc_start(src, bl, status->skill2sc(skill_id), 10, skill_lv, skill->get_time(skill_id, skill_lv)); // TODO: What's the activation chance for the effect? + break; + case 0:/* no skill - basic/normal attack */ if(sd) { if (flag & 3){ @@ -5018,6 +5098,8 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) ud->skilltimer=tid; return skill->castend_pos(tid,tick,id,data); case GN_WALLOFTHORN: + case SU_CN_POWDERING: + case SU_SV_ROOTTWIST: ud->skillx = target->x; ud->skilly = target->y; ud->skilltimer = tid; @@ -5480,6 +5562,10 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin * Arch Bishop **/ case AB_HIGHNESSHEAL: + /** + * Summoner + */ + case SU_TUNABELLY: { int heal = skill->calc_heal(src, bl, (skill_id == AB_HIGHNESSHEAL)?AL_HEAL:skill_id, (skill_id == AB_HIGHNESSHEAL)?10:skill_lv, true); int heal_get_jobexp; @@ -5490,7 +5576,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if (status->isimmune(bl) || (dstmd != NULL && (dstmd->class_ == MOBID_EMPELIUM || mob_is_battleground(dstmd)))) heal = 0; - if (sd && dstsd && sd->status.partner_id == dstsd->status.char_id && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.sex == 0) + if (sd != NULL && dstsd != NULL && sd->status.partner_id == dstsd->status.char_id && (sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.sex == 0) heal = heal * 2; if (tsc && tsc->count) @@ -5509,6 +5595,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin else if (tsc->data[SC_BERSERK]) heal = 0; //Needed so that it actually displays 0 when healing. } + if (skill_id == AL_HEAL) { + status_change_end(bl, SC_BITESCAR, INVALID_TIMER); + } clif->skill_nodamage (src, bl, skill_id, heal, 1); if( tsc && tsc->data[SC_AKAITSUKI] && heal && skill_id != HLIF_HEAL ) heal = ~heal + 1; @@ -5778,7 +5867,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case CR_PROVIDENCE: if(sd && dstsd){ //Check they are not another crusader [Skotlex] - if ((dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) { + if ((dstsd->job & MAPID_UPPERMASK) == MAPID_CRUSADER) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; @@ -5792,7 +5881,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin { struct status_change* sc = status->get_sc(src); - if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex ) { + if (sd != NULL && dstsd != NULL && (dstsd->job & MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex) { // Cannot cast on another bard/dancer-type class of the same gender as caster clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); @@ -5888,6 +5977,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case PR_KYRIE: case MER_KYRIE: + case SU_TUNAPARTY: clif->skill_nodamage(bl, bl, skill_id, -1, sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); break; @@ -6004,9 +6094,18 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case RK_ABUNDANCE: case RK_CRUSHSTRIKE: case ALL_ODINS_POWER: + case SU_FRESHSHRIMP: + case SU_ARCLOUSEDASH: clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; + // Works just like the above list of skills, except animation caused by + // status must trigger AFTER the skill cast animation or it will cancel + // out the status's animation. + case SU_STOOP: + clif->skill_nodamage(src,bl,skill_id,skill_lv,1); + sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); + break; case KN_AUTOCOUNTER: sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); skill->addtimerskill(src, tick + 100, bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); @@ -6204,7 +6303,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( lv > battle_config.devotion_level_difference || // Level difference requeriments (dstsd->sc.data[type] && dstsd->sc.data[type]->val1 != src->id) || // Cannot Devote a player devoted from another source (skill_id == ML_DEVOTION && (!mer || mer != dstsd->md)) || // Mercenary only can devote owner - (dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER || // Crusader Cannot be devoted + (dstsd->job & MAPID_UPPERMASK) == MAPID_CRUSADER || // Crusader Cannot be devoted (dstsd->sc.data[SC_HELLPOWER])) // Players affected by SC_HELLPOWERR cannot be devoted. { if( sd ) @@ -6257,7 +6356,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case MO_KITRANSLATION: - if(dstsd && ((dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER || (dstsd->class_&MAPID_UPPERMASK)!=MAPID_REBELLION)) { + if (dstsd != NULL && (dstsd->job & MAPID_BASEMASK) != MAPID_GUNSLINGER) { pc->addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5); } break; @@ -6273,10 +6372,10 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case MO_ABSORBSPIRITS: { int sp = 0; - if ( dstsd && dstsd->spiritball - && (sd == dstsd || map_flag_vs(src->m) || (sd && sd->duel_group && sd->duel_group == dstsd->duel_group)) - && ((dstsd->class_&MAPID_BASEMASK) != MAPID_GUNSLINGER || (dstsd->class_&MAPID_UPPERMASK) != MAPID_REBELLION) - ) { + if (dstsd != NULL && dstsd->spiritball != 0 + && (sd == dstsd || map_flag_vs(src->m) || (sd && sd->duel_group && sd->duel_group == dstsd->duel_group)) + && (dstsd->job & MAPID_BASEMASK) != MAPID_GUNSLINGER + ) { // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen] sp = dstsd->spiritball * 7; pc->delspiritball(dstsd, dstsd->spiritball, 0); @@ -6477,7 +6576,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if (sd) { if (!dstsd || !( (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SOULLINKER) - || (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER + || (dstsd->job & MAPID_UPPERMASK) == MAPID_SOUL_LINKER || dstsd->status.char_id == sd->status.char_id || dstsd->status.char_id == sd->status.partner_id || dstsd->status.char_id == sd->status.child @@ -6661,7 +6760,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin status_change_end(bl, SC_SILENCE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); status_change_end(bl, SC_CONFUSION, INVALID_TIMER); - clif->skill_nodamage(src,bl,skill_id,skill_lv,1); + status_change_end(bl, SC_BITESCAR, INVALID_TIMER); + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); break; case TF_DETOXIFY: @@ -7111,7 +7211,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; } clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) + if ((dstsd != NULL && (dstsd->job & MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || (tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SL_ROGUE) //Rogue's spirit defends against dispel. || (dstsd && pc_ismadogear(dstsd)) || rnd()%100 >= 50+10*skill_lv ) @@ -7578,7 +7678,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // get back 1 trap struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP; + item_tmp.nameid = su->group->item_id ? su->group->item_id : ITEMID_BOOBY_TRAP; item_tmp.identify = 1; if (item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SKILL)) != 0) { clif->additem(sd,0,0,flag); @@ -7904,7 +8004,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case SL_SUPERNOVICE: case SL_WIZARD: //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SOULLINK constant. - if (sd && !(dstsd && (dstsd->class_&MAPID_UPPERMASK) == type)) { + if (sd != NULL && !(dstsd != NULL && (dstsd->job & MAPID_UPPERMASK) == type)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -7920,7 +8020,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin sc_start(src,src,SC_SMA_READY,100,skill_lv,skill->get_time(SL_SMA,skill_lv)); break; case SL_HIGH: - if (sd && !(dstsd && (dstsd->class_&JOBL_UPPER) && !(dstsd->class_&JOBL_2) && dstsd->status.base_level < 70)) { + if (sd != NULL && !(dstsd != NULL && (dstsd->job & JOBL_UPPER) != 0 && (dstsd->job & JOBL_2) == 0 && dstsd->status.base_level < 70)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -8455,7 +8555,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case AB_ANCILLA: if( sd ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - skill->produce_mix(sd, skill_id, ITEMID_ANCILLA, 0, 0, 0, 1); + skill->produce_mix(sd, skill_id, ITEMID_ANSILA, 0, 0, 0, 1); } break; @@ -8573,7 +8673,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - if((dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 60 + 8 * skill_lv) { + if ((dstsd != NULL && (dstsd->job & MAPID_UPPERMASK) == MAPID_SOUL_LINKER) || rnd()%100 >= 60 + 8 * skill_lv) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -8923,6 +9023,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case LG_TRAMPLE: clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, BDT_SKILL); map->foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick); + status_change_end(bl, SC_SV_ROOTTWIST, INVALID_TIMER); break; case LG_REFLECTDAMAGE: @@ -9129,8 +9230,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case SR_ASSIMILATEPOWER: if( flag&1 ) { int sp = 0; - if( dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER ) - { + if (dstsd != NULL && dstsd->spiritball != 0 && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->job & MAPID_BASEMASK) != MAPID_GUNSLINGER) { sp = dstsd->spiritball; //1%sp per spiritball. pc->delspiritball(dstsd, dstsd->spiritball, 0); status_percent_heal(src, 0, sp); @@ -9148,7 +9248,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case SR_POWERVELOCITY: if( !dstsd ) break; - if ( sd && (dstsd->class_&MAPID_BASEMASK) != MAPID_GUNSLINGER ) { + if (sd != NULL && (dstsd->job & MAPID_BASEMASK) != MAPID_GUNSLINGER) { int i, max = pc->getmaxspiritball(dstsd, 5); for ( i = 0; i < max; i++ ) { pc->addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, 1), max); @@ -9452,6 +9552,25 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, 0, 1, skill_id, -2, BDT_SKILL); break; + case SU_HIDE: + if (tsce != NULL) { + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + status_change_end(bl, type, INVALID_TIMER); + map->freeblock_unlock(); + return 0; + } + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv)); + break; + + case SU_BUNCHOFSHRIMP: + if (sd == NULL || sd->status.party_id == 0 || flag&1) { + clif->skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); + } else if (sd != NULL) { + party->foreachsamemap(skill->area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id); + } + break; + case GM_SANDMAN: if( tsc ) { if( tsc->opt1 == OPT1_SLEEP ) @@ -10352,6 +10471,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case HW_GANBANTEIN: case LG_EARTHDRIVE: case SC_ESCAPE: + case SU_CN_METEOR: break; //Effect is displayed on respective switch case. default: skill->castend_pos2_effect_unknown(src, &x, &y, &skill_id, &skill_lv, &tick, &flag); @@ -10540,7 +10660,9 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case SO_ELEMENTAL_SHIELD: case RL_B_TRAP: case MH_XENO_SLASHER: - flag|=1;//Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). + case SU_CN_POWDERING: + case SU_SV_ROOTTWIST: + flag |= 1; // Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). FALLTHROUGH case GS_GROUNDDRIFT: //Ammo should be deleted right away. if ( skill_id == WM_SEVERE_RAINSTORM ) @@ -10593,11 +10715,24 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case WZ_METEOR: + case SU_CN_METEOR: { int area = skill->get_splash(skill_id, skill_lv); short tmpx = 0, tmpy = 0, x1 = 0, y1 = 0; int i; +#if 0 + // The Meteor should inflict curse if Catnip fruit is consumed. + // Currently Catnip fruit is added as requirement. + if (sd && skill_id == SU_CN_METEOR) { + short item_idx = pc->search_inventory(sd, ITEMID_CATNIP_FRUIT); + if (item_idx >= 0) { + pc->delitem(sd, item_idx, 1, 0, 1, LOG_TYPE_SKILL); + flag |= 1; + } + } +#endif + for( i = 0; i < 2 + (skill_lv>>1); i++ ) { // Creates a random Cell in the Splash Area tmpx = x - area + rnd()%(area * 2 + 1); @@ -10649,6 +10784,19 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui } status_change_end(src, SC_HIDING, INVALID_TIMER); break; + case SU_LOPE: + { + if (map->list[src->m].flag.noteleport && !(map->list[src->m].flag.battleground || map_flag_gvg2(src->m))) { + x = src->x; + y = src->y; + } + clif->skill_nodamage(src, src, SU_LOPE, skill_lv, 1); + if(!map->count_oncell(src->m, x, y, BL_PC | BL_NPC | BL_MOB, 0) && map->getcell(src->m, src, x, y, CELL_CHKREACH)) { + clif->slide(src, x, y); + unit->movepos(src, x, y, 1, 0); + } + } + break; case AM_SPHEREMINE: case AM_CANNIBALIZE: { @@ -11232,7 +11380,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ nullpo_retr(NULL, st); sc = status->get_sc(src); // for traps, firewall and fogwall - celest - switch( skill_id ) { + switch (skill_id) { case SO_ELEMENTAL_SHIELD: val2 = 300 * skill_lv + 65 * (st->int_ + status->get_lv(src)) + st->max_sp; break; @@ -11329,7 +11477,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ case RA_ICEBOUNDTRAP: { struct skill_condition req = skill->get_requirement(sd,skill_id,skill_lv); - ARR_FIND(0, MAX_SKILL_ITEM_REQUIRE, i, req.itemid[i] && (req.itemid[i] == ITEMID_TRAP || req.itemid[i] == ITEMID_TRAP_ALLOY)); + ARR_FIND(0, MAX_SKILL_ITEM_REQUIRE, i, req.itemid[i] && (req.itemid[i] == ITEMID_BOOBY_TRAP || req.itemid[i] == ITEMID_SPECIAL_ALLOY_TRAP)); if( i != MAX_SKILL_ITEM_REQUIRE && req.itemid[i] ) req_item = req.itemid[i]; if( map_flag_gvg2(src->m) || map->list[src->m].flag.battleground ) @@ -11969,6 +12117,13 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick sc_start(ss, bl, SC_VOLCANIC_ASH, 100, sg->skill_lv, skill->get_time(MH_VOLCANIC_ASH, sg->skill_lv)); break; + case UNT_CATNIPPOWDER: + if (sg->src_id == bl->id || (status_get_mode(bl)&MD_BOSS)) + break; // Does not affect the caster or Boss. + if (sce == NULL && battle->check_target(&src->bl, bl, BCT_ENEMY) > 0) + sc_start(ss, bl, type, 100, sg->skill_lv, skill->get_time(sg->skill_id, sg->skill_lv)); + break; + case UNT_GD_LEADERSHIP: case UNT_GD_GLORYWOUNDS: case UNT_GD_SOULCOLD: @@ -12178,12 +12333,12 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 tsc->sg_counter++; //SG hit counter. if (skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0) <= 0 && tsc) tsc->sg_counter=0; //Attack absorbed. - break; + break; #endif case GS_DESPERADO: if (rnd()%100 < src->val1) skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); - break; + break; default: skill->attack(skill->get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); } @@ -12753,6 +12908,30 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 status->change_start(ss, bl, SC_BLIND, rnd() % 100 > sg->skill_lv * 10, sg->skill_lv, sg->skill_id, 0, 0, skill->get_time2(sg->skill_id, sg->skill_lv), SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE); break; + case UNT_SV_ROOTTWIST: + if (status_get_mode(bl)&MD_BOSS) { + break; + } + if (tsc) { + if (!sg->val2) { + int sec = skill->get_time(sg->skill_id, sg->skill_lv); + + if (sc_start2(ss, bl, type, 100, sg->skill_lv, sg->group_id, sec)) { + const struct TimerData* td = ((tsc->data[type])? timer->get(tsc->data[type]->timer) : NULL); + + if (td != NULL) + sec = DIFF_TICK32(td->tick, tick); + clif->fixpos(bl); + sg->val2 = bl->id; + } else { // Couldn't trap it? + sec = 7000; + } + sg->limit = DIFF_TICK32(tick, sg->tick) + sec; + } else if (tsc->data[type] && bl->id == sg->val2) { + skill->attack(skill->get_type(SU_SV_ROOTTWIST_ATK), ss, &src->bl, bl, SU_SV_ROOTTWIST_ATK, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION); + } + } + break; default: skill->unit_onplace_timer_unknown(src, bl, &tick); break; @@ -13060,7 +13239,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) return 0; if( skill->get_inf2(skill_id)&INF2_CHORUS_SKILL ) { - if( tsd->status.party_id == sd->status.party_id && (tsd->class_&MAPID_THIRDMASK) == MAPID_MINSTRELWANDERER ) + if (tsd->status.party_id == sd->status.party_id && (tsd->job & MAPID_THIRDMASK) == MAPID_MINSTRELWANDERER) p_sd[(*c)++] = tsd->bl.id; return 1; } else { @@ -13069,24 +13248,23 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) case PR_BENEDICTIO: { uint8 dir = map->calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); dir = (unit->getdir(&sd->bl) + dir)%8; //This adjusts dir to account for the direction the sd is facing. - if ((tsd->class_&MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest. + if ((tsd->job & MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest. && sd->status.sp >= 10) p_sd[(*c)++]=tsd->bl.id; return 1; } case AB_ADORAMUS: // Adoramus does not consume Blue Gemstone when there is at least 1 Priest class next to the caster - if( (tsd->class_&MAPID_UPPERMASK) == MAPID_PRIEST ) + if ((tsd->job & MAPID_UPPERMASK) == MAPID_PRIEST) p_sd[(*c)++] = tsd->bl.id; return 1; case WL_COMET: // Comet does not consume Red Gemstones when there is at least 1 Warlock class next to the caster - if( ( tsd->class_&MAPID_THIRDMASK ) == MAPID_WARLOCK ) + if ((tsd->job & MAPID_THIRDMASK) == MAPID_WARLOCK) p_sd[(*c)++] = tsd->bl.id; return 1; case LG_RAYOFGENESIS: - if( tsd->status.party_id == sd->status.party_id && (tsd->class_&MAPID_THIRDMASK) == MAPID_ROYAL_GUARD && - tsd->sc.data[SC_BANDING] ) + if (tsd->status.party_id == sd->status.party_id && (tsd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD && tsd->sc.data[SC_BANDING]) p_sd[(*c)++] = tsd->bl.id; return 1; default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex] @@ -13095,7 +13273,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) if(pc_issit(tsd) || !unit->can_move(&tsd->bl)) return 0; if (sd->status.sex != tsd->status.sex && - (tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && + (tsd->job & MAPID_UPPERMASK) == MAPID_BARDDANCER && (skill_lv = pc->checkskill(tsd, skill_id)) > 0 && (tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) && sd->status.party_id && tsd->status.party_id && @@ -13342,7 +13520,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case SG_FUSION: case RA_WUGDASH: case KO_YAMIKUMO: - if( sc && sc->data[status->skill2sc(skill_id)] ) + case SU_HIDE: + if (sc && sc->data[status->skill2sc(skill_id)]) return 1; FALLTHROUGH default: @@ -13544,7 +13723,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case TK_MISSION: - if( (sd->class_&MAPID_UPPERMASK) != MAPID_TAEKWON ) { + if ((sd->job & MAPID_UPPERMASK) != MAPID_TAEKWON) { // Cannot be used by Non-Taekwon classes clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -13556,7 +13735,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_READYSTORM: case TK_READYTURN: case TK_JUMPKICK: - if( (sd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER ) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SOUL_LINKER) { // Soul Linkers cannot use this skill clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; @@ -13567,7 +13746,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: - if ((sd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) + if ((sd->job & MAPID_UPPERMASK) == MAPID_SOUL_LINKER) return 0; //Anti-Soul Linker check in case you job-changed with Stances active. if(!(sc && sc->data[SC_COMBOATTACK]) || sc->data[SC_COMBOATTACK]->val1 == TK_JUMPKICK) return 0; //Combo needs to be ready @@ -13579,7 +13758,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id status_change_end(&sd->bl, SC_COMBOATTACK, INVALID_TIMER); return 0; } - if(sc->data[SC_COMBOATTACK]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { + if (sc->data[SC_COMBOATTACK]->val1 != skill_id + && !(sd != NULL && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0)) { //Cancel combo wait. unit->cancel_combo(&sd->bl); return 0; @@ -13763,7 +13943,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id { int count = 0, i; for( i = 0; i < MAX_INVENTORY; i ++ ) - if( sd->status.inventory[i].nameid == ITEMID_ANCILLA ) + if (sd->status.inventory[i].nameid == ITEMID_ANSILA) count += sd->status.inventory[i].amount; if( count >= 3 ) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_ANCILLA_NUMOVER, 0); @@ -14396,7 +14576,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, cause = USESKILL_FAIL_BLUEJAMSTONE; break; case ITEMID_HOLY_WATER: cause = USESKILL_FAIL_HOLYWATER; break; - case ITEMID_ANCILLA: + case ITEMID_ANSILA: cause = USESKILL_FAIL_ANCILLA; break; case ITEMID_ACCELERATOR: case ITEMID_HOVERING_BOOSTER: @@ -14554,7 +14734,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 case TK_READYTURN: case SG_FUSION: case KO_YAMIKUMO: - if( sc && sc->data[status->skill2sc(skill_id)] ) + case SU_HIDE: + if (sc && sc->data[status->skill2sc(skill_id)]) return req; /* Fall through */ default: @@ -14710,7 +14891,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 if ((item_index = pc->search_inventory(sd, req.itemid[i])) == INDEX_NOT_FOUND || sd->status.inventory[item_index].amount < req.amount[i] ) { - req.itemid[i] = ITEMID_TRAP_ALLOY; + req.itemid[i] = ITEMID_SPECIAL_ALLOY_TRAP; req.amount[i] = 1; } break; @@ -14737,14 +14918,14 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 switch(skill_lv) { case 1: case 2: - req.itemid[1] = ITEMID_REPAIR_A; + req.itemid[1] = ITEMID_REPAIRA; break; case 3: case 4: - req.itemid[1] = ITEMID_REPAIR_B; + req.itemid[1] = ITEMID_REPAIRB; break; case 5: - req.itemid[1] = ITEMID_REPAIR_C; + req.itemid[1] = ITEMID_REPAIRC; break; } req.amount[1] = 1; @@ -15468,7 +15649,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) per = status->get_refine_chance(ditem->wlv, (int)item->refine) * 10; // Aegis leaked formula. [malufett] - if( sd->status.class_ == JOB_MECHANIC_T ) + if (sd->status.class == JOB_MECHANIC_T) per += 100; else per += 5 * (sd->status.job_level - 50); @@ -15494,16 +15675,16 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) item->card[0] == CARD0_FORGE && (int)MakeDWord(item->card[2],item->card[3]) == sd->status.char_id) { // Fame point system [DracoRPG] - switch(ditem->wlv){ - case 1: - pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point - break; - case 2: - pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point - break; - case 3: - pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point - break; + switch (ditem->wlv) { + case 1: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point + break; + case 2: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point + break; + case 3: + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point + break; } } } else { @@ -16802,7 +16983,7 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) // revert unit back into a trap struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP; + item_tmp.nameid = group->item_id ? group->item_id : ITEMID_BOOBY_TRAP; item_tmp.identify = 1; map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); } @@ -17611,7 +17792,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, make_per = make_per * battle_config.wp_rate / 100; } - if (sd->class_&JOBL_BABY) //if it's a Baby Class + if ((sd->job & JOBL_BABY) != 0) //if it's a Baby Class make_per = (make_per * 50) / 100; //Baby penalty is 50% (bugreport:4847) if(make_per < 1) make_per = 1; @@ -17675,8 +17856,8 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, if(equip){ clif->produce_effect(sd,0,nameid); clif->misceffect(&sd->bl,3); - if(itemdb_wlv(nameid) >= 3 && ((ele? 1 : 0) + sc) >= 3) // Fame point system [DracoRPG] - pc->addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point + if (itemdb_wlv(nameid) >= 3 && ((ele? 1 : 0) + sc) >= 3) // Fame point system [DracoRPG] + pc->addfame(sd, RANKTYPE_BLACKSMITH, 10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point } else { int fame = 0; tmp_item.amount = 0; @@ -17716,8 +17897,9 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, sd->potion_success_counter = 0; } - if (fame) - pc->addfame(sd,fame); + if (fame != 0 && (skill_id == AM_PHARMACY || skill_id == AM_TWILIGHT1 || skill_id == AM_TWILIGHT2 || skill_id == AM_TWILIGHT3)) { + pc->addfame(sd, RANKTYPE_ALCHEMIST, fame); + } //Visual effects and the like. switch (skill_id) { case AM_PHARMACY: @@ -17976,16 +18158,16 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) sd->menuskill_val = 0; switch (nameid) { - case ITEMID_SCARLET_POINT: + case ITEMID_SCARLET_PTS: class_ = MOBID_MAGICDECOY_FIRE; break; - case ITEMID_INDIGO_POINT: + case ITEMID_INDIGO_PTS: class_ = MOBID_MAGICDECOY_WATER; break; - case ITEMID_LIME_GREEN_POINT: + case ITEMID_LIME_GREEN_PTS: class_ = MOBID_MAGICDECOY_WIND; break; - case ITEMID_YELLOW_WISH_POINT: + case ITEMID_YELLOW_WISH_PTS: class_ = MOBID_MAGICDECOY_EARTH; break; } diff --git a/src/map/skill.h b/src/map/skill.h index c7761b082..bba440107 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1365,6 +1365,10 @@ enum e_skill { ITEM_OPTION_SPLASH_ATTACK, GM_FORCE_TRANSFER, GM_WIDE_RESURRECTION, + ALL_NIFLHEIM_RECALL, + ALL_PRONTERA_RECALL, + ALL_GLASTHEIM_RECALL, + ALL_THANATOS_RECALL, GC_DARKCROW = 5001, RA_UNLIMIT, @@ -1382,6 +1386,47 @@ enum e_skill { ALL_FULL_THROTTLE, NC_MAGMA_ERUPTION_DOTDAMAGE, + /** Summoner */ + SU_BASIC_SKILL = 5018, + SU_BITE, + SU_HIDE, + SU_SCRATCH, + SU_STOOP, + SU_LOPE, + SU_SPRITEMABLE, + SU_POWEROFLAND, + SU_SV_STEMSPEAR, + SU_CN_POWDERING, + SU_CN_METEOR, + SU_SV_ROOTTWIST, + SU_SV_ROOTTWIST_ATK, + SU_POWEROFLIFE, + SU_SCAROFTAROU, + SU_PICKYPECK, + SU_PICKYPECK_DOUBLE_ATK, + SU_ARCLOUSEDASH, + SU_LUNATICCARROTBEAT, + SU_POWEROFSEA, + SU_TUNABELLY, + SU_TUNAPARTY, + SU_BUNCHOFSHRIMP, + SU_FRESHSHRIMP, + SU_CN_METEOR2, + SU_LUNATICCARROTBEAT2, + SU_SOULATTACK, + SU_POWEROFFLOCK, + SU_SVG_SPIRIT, + SU_HISS, + SU_NYANGGRASS, + SU_GROOMING, + SU_PURRING, + SU_SHRIMPARTY, + SU_SPIRITOFLIFE, + SU_MEOWMEOW, + SU_SPIRITOFLAND, + SU_CHATTERING, + SU_SPIRITOFSEA, + HLIF_HEAL = 8001, HLIF_AVOID, HLIF_BRAIN, @@ -1651,6 +1696,9 @@ enum { UNT_B_TRAP, UNT_FIRE_RAIN, + UNT_CATNIPPOWDER, + UNT_SV_ROOTTWIST, + /** * Guild Auras **/ @@ -1922,7 +1970,7 @@ struct skill_interface { int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv ); int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv ); int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv ); - int (*tree_get_max) ( uint16 skill_id, int b_class ); + int (*tree_get_max) (uint16 skill_id, int class); const char *(*get_name) ( uint16 skill_id ); const char *(*get_desc) ( uint16 skill_id ); /* check */ diff --git a/src/map/status.c b/src/map/status.c index 5e65244ef..78c11899b 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -719,6 +719,24 @@ void initChangeTables(void) status->set_sc( GN_FIRE_EXPANSION_TEAR_GAS , SC_FIRE_EXPANSION_TEAR_GAS , SI_FIRE_EXPANSION_TEAR_GAS , SCB_NONE ); status->set_sc( GN_MANDRAGORA , SC_MANDRAGORA , SI_MANDRAGORA , SCB_INT ); + /** + * Summoner + */ + status->set_sc(SU_HIDE, SC_SUHIDE, SI_SUHIDE, SCB_SPEED); + add_sc(SU_SCRATCH, SC_BLOODING); + status->set_sc(SU_STOOP, SC_SU_STOOP, SI_SU_STOOP, SCB_NONE); + status->set_sc(SU_FRESHSHRIMP, SC_FRESHSHRIMP, SI_FRESHSHRIMP, SCB_NONE); + add_sc(SU_SV_STEMSPEAR, SC_BLOODING); + status->set_sc(SU_CN_POWDERING, SC_CATNIPPOWDER, SI_CATNIPPOWDER, SCB_WATK | SCB_SPEED | SCB_REGEN); + add_sc(SU_CN_METEOR, SC_CURSE); + set_sc_with_vfx(SU_SV_ROOTTWIST, SC_SV_ROOTTWIST, SI_SV_ROOTTWIST, SCB_NONE); + add_sc(SU_SCAROFTAROU, SC_STUN ); + status->set_sc(SU_SCAROFTAROU, SC_BITESCAR, SI_BITESCAR, SCB_NONE); + status->set_sc(SU_ARCLOUSEDASH, SC_ARCLOUSEDASH, SI_ARCLOUSEDASH, SCB_AGI | SCB_SPEED); + add_sc(SU_LUNATICCARROTBEAT, SC_STUN); + status->set_sc(SU_TUNAPARTY, SC_TUNAPARTY, SI_TUNAPARTY, SCB_NONE); + status->set_sc(SU_BUNCHOFSHRIMP, SC_SHRIMP, SI_SHRIMP, SCB_BATK | SCB_MATK); + // Elemental Spirit summoner's 'side' status changes. status->set_sc( EL_CIRCLE_OF_FIRE , SC_CIRCLE_OF_FIRE_OPTION, SI_CIRCLE_OF_FIRE_OPTION, SCB_NONE ); status->set_sc( EL_FIRE_CLOAK , SC_FIRE_CLOAK_OPTION , SI_FIRE_CLOAK_OPTION , SCB_ALL ); @@ -997,6 +1015,9 @@ void initChangeTables(void) status->dbs->IconChangeTable[SC_MAGICAL_FEATHER] = SI_MAGICAL_FEATHER; status->dbs->IconChangeTable[SC_BLOSSOM_FLUTTERING] = SI_BLOSSOM_FLUTTERING; + // Summoner + status->dbs->IconChangeTable[SC_SPRITEMABLE] = SI_SPRITEMABLE; + // Other SC which are not necessarily associated to skills. status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION1] |= SCB_ASPD; status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION2] |= SCB_ASPD; @@ -1347,6 +1368,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, status_change_end(target, SC_CLOAKING, INVALID_TIMER); status_change_end(target, SC_CHASEWALK, INVALID_TIMER); status_change_end(target, SC_CAMOUFLAGE, INVALID_TIMER); + status_change_end(target, SC_SUHIDE, INVALID_TIMER); if ((sce=sc->data[SC_ENDURE]) && !sce->val4 && !sc->data[SC_LKCONCENTRATION]) { //Endure count is only reduced by non-players on non-gvg maps. //val4 signals infinite endure. [Skotlex] @@ -1802,6 +1824,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin (sc->data[SC_TRICKDEAD] && skill_id != NV_TRICKDEAD) || (sc->data[SC_AUTOCOUNTER] && !flag && skill_id) || (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF && skill_id != PA_GOSPEL) + || (sc->data[SC_SUHIDE] && skill_id != SU_HIDE) ) return 0; @@ -2246,14 +2269,14 @@ unsigned int status_get_base_maxsp(const struct map_session_data *sd, const stru nullpo_ret(sd); nullpo_ret(st); - val = pc->class2idx(sd->status.class_); + val = pc->class2idx(sd->status.class); val = status->dbs->SP_table[val][sd->status.base_level]; - if ( sd->class_&JOBL_UPPER ) + if ((sd->job & JOBL_UPPER) != 0) val += val * 25 / 100; - else if ( sd->class_&JOBL_BABY ) + else if ((sd->job & JOBL_BABY) != 0) val = val * 70 / 100; - if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) val *= 3; //Triple max SP for top ranking Taekwons over level 90. val += val * st->int_ / 100; @@ -2267,20 +2290,20 @@ unsigned int status_get_base_maxhp(const struct map_session_data *sd, const stru nullpo_ret(sd); nullpo_ret(st); - val = pc->class2idx(sd->status.class_); + val = pc->class2idx(sd->status.class); val = status->dbs->HP_table[val][sd->status.base_level]; - if ( (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99 ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99) val += 2000; //Supernovice lvl99 hp bonus. - if ( (sd->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E && sd->status.base_level >= 150 ) + if ((sd->job & MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E && sd->status.base_level >= 150) val += 2000; //Extented Supernovice lvl150 hp bonus. - if ( sd->class_&JOBL_UPPER ) + if ((sd->job & JOBL_UPPER) != 0) val += val * 25 / 100; //Trans classes get a 25% hp bonus - else if ( sd->class_&JOBL_BABY ) + else if ((sd->job & JOBL_BABY) != 0) val = val * 70 / 100; //Baby classes get a 30% hp penalty - if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON)) val *= 3; //Triple max HP for top ranking Taekwons over level 90. val += val * st->vit / 100; // +1% per each point of VIT @@ -2319,7 +2342,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) pc->calc_skilltree(sd); // SkillTree calculation - sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300; + sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class)]+sd->status.str*300; if(opt&SCO_FIRST) { //Load Hp/SP from char-received data. @@ -2381,9 +2404,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) //Give them all modes except these (useful for clones) bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK); - bstatus->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM; + bstatus->size = ((sd->job & JOBL_BABY) != 0 || (sd->job & MAPID_BASEMASK) == MAPID_SUMMONER)?SZ_SMALL:SZ_MEDIUM; if (battle_config.character_size && (pc_isridingpeco(sd) || pc_isridingdragon(sd))) { //[Lupus] - if (sd->class_&JOBL_BABY) { + if ((sd->job & JOBL_BABY) != 0) { if (battle_config.character_size&SZ_BIG) bstatus->size++; } else { @@ -2393,7 +2416,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) } bstatus->aspd_rate = 1000; bstatus->ele_lv = 1; - bstatus->race = RC_PLAYER; + bstatus->race = ((sd->job & MAPID_BASEMASK) == MAPID_SUMMONER)?RC_BRUTE:RC_PLAYER; // Autobonus pc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true); @@ -2487,8 +2510,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) if (sd->status.inventory[index].card[0]==CARD0_FORGE) { // Forged weapon wd->star += (sd->status.inventory[index].card[1]>>8); - if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg - if(pc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH)) + if (wd->star >= 15) + wd->star = 40; // 3 Star Crumbs now give +40 dmg + if (pc->fame_rank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]), RANKTYPE_BLACKSMITH) > 0) wd->star += 10; if (!wa->ele) //Do not overwrite element from previous bonuses. @@ -2663,7 +2687,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) // ----- STATS CALCULATION ----- // Job bonuses - index = pc->class2idx(sd->status.class_); + index = pc->class2idx(sd->status.class); for (i = 0; i < sd->status.job_level && i < MAX_LEVEL; i++) { if(!status->dbs->job_bonus[index][i]) continue; @@ -2678,7 +2702,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) } // If a Super Novice has never died and is at least joblv 70, he gets all stats +10 - if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->die_counter == 0 && sd->status.job_level >= 70) { + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->die_counter == 0 && sd->status.job_level >= 70) { bstatus->str += 10; bstatus->agi += 10; bstatus->vit += 10; @@ -2696,6 +2720,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->dex += skill_lv; if((skill_lv = pc->checkskill(sd,RA_RESEARCHTRAP))>0) bstatus->int_ += skill_lv; + if ((pc->checkskill(sd,SU_POWEROFLAND)) > 0) + bstatus->int_ += 20; // Bonuses from cards and equipment as well as base stat, remember to avoid overflows. i = bstatus->str + sd->status.str + sd->param_bonus[0] + sd->param_equip[0]; @@ -2733,9 +2759,12 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX); // Absolute modifiers from passive skills - if((skill_lv=pc->checkskill(sd,CR_TRUST))>0) + if ((skill_lv=pc->checkskill(sd,CR_TRUST)) > 0) bstatus->max_hp += skill_lv*200; + if ((pc->checkskill(sd,SU_SPRITEMABLE)) > 0) + bstatus->max_hp += 1000; + // Apply relative modifiers from equipment if(sd->hprate < 0) sd->hprate = 0; @@ -2768,6 +2797,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->max_sp += 200 + 20 * skill_lv; if( (skill_lv = pc->checkskill(sd,WM_LESSON)) > 0 ) bstatus->max_sp += 30 * skill_lv; + if ((pc->checkskill(sd,SU_SPRITEMABLE)) > 0) + bstatus->max_sp += 100; // Apply relative modifiers from equipment if(sd->sprate < 0) @@ -2790,7 +2821,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->hp = bstatus->max_hp; bstatus->sp = bstatus->max_sp; } else { - if((sd->class_&MAPID_BASEMASK) == MAPID_NOVICE && !(sd->class_&JOBL_2) + if ((sd->job & MAPID_BASEMASK) == MAPID_NOVICE && (sd->job & JOBL_2) == 0 && battle_config.restart_hp_rate < 50) bstatus->hp = bstatus->max_hp>>1; else @@ -2840,6 +2871,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) sd->critical_rate = 0; if(sd->critical_rate != 100) bstatus->cri = bstatus->cri * sd->critical_rate/100; + if (pc->checkskill(sd, SU_POWEROFLIFE) > 0) + bstatus->cri += 20; if(sd->flee2_rate < 0) sd->flee2_rate = 0; @@ -2872,14 +2905,18 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->hit += 3*skill_lv; if((sd->status.weapon == W_MACE || sd->status.weapon == W_2HMACE) && (skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0) bstatus->hit += 2*skill_lv; + if (pc->checkskill(sd, SU_POWEROFLIFE) > 0) + bstatus->hit += 20; // ----- FLEE CALCULATION ----- // Absolute modifiers from passive skills if((skill_lv=pc->checkskill(sd,TF_MISS))>0) - bstatus->flee += skill_lv*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3); + bstatus->flee += skill_lv*((sd->job & JOBL_2) != 0 && (sd->job & MAPID_BASEMASK) == MAPID_THIEF? 4 : 3); if((skill_lv=pc->checkskill(sd,MO_DODGE))>0) bstatus->flee += (skill_lv*3)>>1; + if (pc->checkskill(sd, SU_POWEROFLIFE) > 0) + bstatus->flee += 20; // ----- EQUIPMENT-DEF CALCULATION ----- // Apply relative modifiers from equipment @@ -2922,7 +2959,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) // Basic ASPD value i = status->base_amotion_pc(sd,bstatus); - bstatus->amotion = cap_value(i,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000); + bstatus->amotion = cap_value(i,((sd->job & JOBL_THIRD) != 0 ? battle_config.max_third_aspd : battle_config.max_aspd),2000); // Relative modifiers from passive skills #ifndef RENEWAL_ASPD @@ -3175,6 +3212,12 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) clif->updatestatus(sd,SP_CARTINFO); } + // Spirit Marble status activates automatically for a infinite + // amount of time when the skill is learned. Felt this was the + // best place to put this. [Rytech] + if (pc->checkskill(sd, SU_SPRITEMABLE)) + sc_start(&sd->bl, &sd->bl, SC_SPRITEMABLE, 100, 1, INFINITE_DURATION); + calculating = 0; return 0; @@ -3520,7 +3563,7 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str || sc->data[SC_OBLIVIONCURSE] != NULL || sc->data[SC_MAXIMIZEPOWER] != NULL || sc->data[SC_REBOUND] != NULL - || (bl->type == BL_PC && (BL_UCAST(BL_PC, bl)->class_&MAPID_UPPERMASK) == MAPID_MONK + || (bl->type == BL_PC && (BL_UCAST(BL_PC, bl)->job & MAPID_UPPERMASK) == MAPID_MONK && (sc->data[SC_EXTREMITYFIST] != NULL || (sc->data[SC_EXPLOSIONSPIRITS] != NULL && (sc->data[SC_SOULLINK] == NULL || sc->data[SC_SOULLINK]->val2 != SL_MONK) @@ -3584,6 +3627,10 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str regen->rate.hp += regen->rate.hp * sc->data[SC_BUCHEDENOEL]->val1 / 100; regen->rate.sp += regen->rate.sp * sc->data[SC_BUCHEDENOEL]->val2 / 100; } + if (sc->data[SC_CATNIPPOWDER]) { + regen->rate.hp *= 2; + regen->rate.sp *= 2; + } } #define status_get_homstr(st, hd) ((st)->str + (hd)->homunculus.str_value) @@ -3806,13 +3853,15 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) } if(flag&SCB_CRI && bst->cri) { - if (st->luk == bst->luk) + if (st->luk == bst->luk) { st->cri = status->calc_critical(bl, sc, bst->cri, true); - else + } else { st->cri = status->calc_critical(bl, sc, bst->cri + 3*(st->luk - bst->luk), true); + } + if (battle_config.show_katar_crit_bonus && bl->type == BL_PC && BL_UCAST(BL_PC, bl)->status.weapon == W_KATAR) { + st->cri *= 2; + } } - if (battle_config.show_katar_crit_bonus && bl->type == BL_PC && BL_UCAST(BL_PC, bl)->status.weapon == W_KATAR) - st->cri <<= 1; if(flag&SCB_FLEE2 && bst->flee2) { if (st->luk == bst->luk) @@ -3960,7 +4009,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) #endif amotion = status->calc_fix_aspd(bl, sc, amotion); if (sd != NULL) { - st->amotion = cap_value(amotion, ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd), 2000); + st->amotion = cap_value(amotion, ((sd->job & JOBL_THIRD) != 0 ? battle_config.max_third_aspd : battle_config.max_aspd), 2000); } else { st->amotion = cap_value(amotion, battle_config.max_aspd, 2000); } @@ -4239,11 +4288,11 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) nullpo_ret(sd); nullpo_ret(st); - amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]; + amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1]; if ( sd->status.weapon > MAX_SINGLE_WEAPON_TYPE) - amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] / 4; + amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2] / 4; if ( sd->status.shield ) - amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][MAX_SINGLE_WEAPON_TYPE]; + amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][MAX_SINGLE_WEAPON_TYPE]; switch ( sd->status.weapon ) { case W_BOW: case W_MUSICAL: @@ -4267,8 +4316,8 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) #else // base weapon delay amotion = (sd->status.weapon < MAX_SINGLE_WEAPON_TYPE) - ? (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon - : (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 7 / 10; // dual-wield + ? (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->status.weapon]) // single weapon + : (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2]) * 7 / 10; // dual-wield // percentual delay reduction from stats amotion -= amotion * (4 * st->agi + st->dex) / 1000; @@ -4579,9 +4628,12 @@ unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, if (sc->data[SC_2011RWC]) agi += sc->data[SC_2011RWC]->val1; - if(sc->data[SC_MARSHOFABYSS]) + if (sc->data[SC_MARSHOFABYSS]) agi -= agi * sc->data[SC_MARSHOFABYSS]->val2 / 100; + if (sc->data[SC_ARCLOUSEDASH]) + agi += sc->data[SC_ARCLOUSEDASH]->val2; + return (unsigned short)cap_value(agi,0,USHRT_MAX); } @@ -4914,6 +4966,9 @@ unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, if (sc->data[SC_STEAMPACK]) batk += sc->data[SC_STEAMPACK]->val1; + if (sc->data[SC_SHRIMP]) + batk += batk * sc->data[SC_SHRIMP]->val2 / 100; + return (unsigned short)cap_value(batk,0,USHRT_MAX); } @@ -5006,6 +5061,8 @@ unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, watk += watk * sc->data[SC_ANGRIFFS_MODUS]->val2/100; if( sc->data[SC_FLASHCOMBO] ) watk += sc->data[SC_FLASHCOMBO]->val2; + if (sc->data[SC_CATNIPPOWDER]) + watk -= watk * sc->data[SC_CATNIPPOWDER]->val2 / 100; return (unsigned short)cap_value(watk,0,USHRT_MAX); } @@ -5033,6 +5090,8 @@ unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc matk += 40 + 30 * sc->data[SC_ODINS_POWER]->val1; //70 lvl1, 100lvl2 if(sc->data[SC_IZAYOI]) matk += 25 * sc->data[SC_IZAYOI]->val1; + if (sc->data[SC_SHRIMP]) + matk += matk * sc->data[SC_SHRIMP]->val2 / 100; return (unsigned short)cap_value(matk,0,USHRT_MAX); #else return 0; @@ -5719,6 +5778,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc if (sc->data[SC_DEC_AGI] || sc->data[SC_QUAGMIRE] || sc->data[SC_DONTFORGETME]) return 0; } + if (sc->data[SC_CATNIPPOWDER]) + val = max(val, sc->data[SC_CATNIPPOWDER]->val3); if( sd && sd->bonus.speed_rate + sd->bonus.speed_add_rate > 0 ) // permanent item-based speedup val = max( val, sd->bonus.speed_rate + sd->bonus.speed_add_rate ); @@ -5741,7 +5802,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc val = max( val, 2 * sc->data[SC_WINDWALK]->val1 ); if( sc->data[SC_CARTBOOST] ) val = max( val, 20 ); - if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && pc->checkskill(sd,TF_MISS) > 0 ) + if (sd != NULL && (sd->job & MAPID_UPPERMASK) == MAPID_ASSASSIN && pc->checkskill(sd,TF_MISS) > 0) val = max( val, 1 * pc->checkskill(sd,TF_MISS) ); if( sc->data[SC_CLOAKING] && (sc->data[SC_CLOAKING]->val4&1) == 1 ) val = max( val, sc->data[SC_CLOAKING]->val1 >= 10 ? 25 : 3 * sc->data[SC_CLOAKING]->val1 - 3 ); @@ -5769,6 +5830,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc val = max(val, sc->data[SC_MOVHASTE_HORSE]->val1); if( sd && sd->bonus.speed_rate + sd->bonus.speed_add_rate < 0 ) // permanent item-based speedup val = max( val, -(sd->bonus.speed_rate + sd->bonus.speed_add_rate) ); + if (sc->data[SC_ARCLOUSEDASH]) + val = max(val, sc->data[SC_ARCLOUSEDASH]->val3); speed_rate -= val; } @@ -6368,8 +6431,8 @@ int status_get_class(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { - case BL_PC: return BL_UCCAST(BL_PC, bl)->status.class_; - case BL_MOB: return BL_UCCAST(BL_MOB, bl)->vd->class_; //Class used on all code should be the view class of the mob. + case BL_PC: return BL_UCCAST(BL_PC, bl)->status.class; + case BL_MOB: return BL_UCCAST(BL_MOB, bl)->vd->class; //Class used on all code should be the view class of the mob. case BL_PET: return BL_UCCAST(BL_PET, bl)->pet.class_; case BL_HOM: return BL_UCCAST(BL_HOM, bl)->homunculus.class_; case BL_MER: return BL_UCCAST(BL_MER, bl)->mercenary.class_; @@ -6764,7 +6827,7 @@ void status_set_viewdata(struct block_list *bl, int class_) break; } } - sd->vd.class_ = class_; + sd->vd.class = class_; clif->get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield); sd->vd.head_top = sd->status.head_top; sd->vd.head_mid = sd->status.head_mid; @@ -6816,7 +6879,7 @@ void status_set_viewdata(struct block_list *bl, int class_) struct pet_data *pd = BL_UCAST(BL_PET, bl); if (vd != NULL) { memcpy(&pd->vd, vd, sizeof(struct view_data)); - if (!pc->db_checkid(vd->class_)) { + if (!pc->db_checkid(vd->class)) { pd->vd.hair_style = battle_config.pet_hair_style; if(pd->pet.equip) { pd->vd.head_bottom = itemdb_viewid(pd->pet.equip); @@ -7505,6 +7568,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t return 0; break; case SC_KYRIE: + case SC_TUNAPARTY: if (bl->type == BL_MOB) return 0; break; @@ -7768,12 +7832,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_OBLIVIONCURSE: case SC_LEECHESEND: - // Ranger Effects + // Ranger Effects case SC_WUGBITE: case SC_ELECTRICSHOCKER: case SC_MAGNETICFIELD: - // Masquerades + // Masquerades case SC__ENERVATION: case SC__GROOMY: case SC__LAZINESS: @@ -7784,7 +7848,9 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t // Other Effects case SC_VACUUM_EXTREME: case SC_NETHERWORLD: - + case SC_FRESHSHRIMP: + case SC_SV_ROOTTWIST: + case SC_BITESCAR: return 0; } } @@ -8178,12 +8244,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t int i; for( i = 0; i < MAX_PC_DEVOTION; i++ ) { if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } else if (bl->type == BL_MER) { struct mercenary_data *mc = BL_UCAST(BL_MER, bl); if (mc->devotion_flag && (tsd = mc->master) != NULL) { - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } } @@ -8282,12 +8348,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t int i; for( i = 0; i < MAX_PC_DEVOTION; i++ ) { if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } else if (bl->type == BL_MER) { struct mercenary_data *mc = BL_UCAST(BL_MER, bl); if (mc->devotion_flag && (tsd = mc->master) != NULL) { - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } } @@ -8336,7 +8402,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t #endif break; case SC_NJ_SUITON: - if (!val2 || (sd && (sd->class_&MAPID_BASEMASK) == MAPID_NINJA)) { + if (val2 == 0 || (sd != NULL && (sd->job & MAPID_BASEMASK) == MAPID_NINJA)) { //No penalties. val2 = 0; //Agi penalty val3 = 0; //Walk speed penalty @@ -8546,12 +8612,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if( sd ) { for( i = 0; i < MAX_PC_DEVOTION; i++ ) { if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } else if (bl->type == BL_MER) { struct mercenary_data *mc = BL_UCAST(BL_MER, bl); if (mc->devotion_flag && (tsd = mc->master) != NULL) { - status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID|SCFLAG_NOICON); } } } @@ -9742,6 +9808,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if (!mob->db_checkid(val1)) val1 = MOBID_PORING; break; + case SC_SPRITEMABLE: case SC_ALL_RIDING: tick = INFINITE_DURATION; break; @@ -9752,6 +9819,36 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t **/ val2 = 20+(20*val1); break; + /** + * Summoner + */ + case SC_FRESHSHRIMP: + val4 = tick / (10000 - ((val1 - 1) * 1000)); + tick_time = 10000 - ((val1 - 1) * 1000); + if (val4 <= 0) // Prevents a negeative value from happening + val4 = 0; + break; + case SC_ARCLOUSEDASH: + val2 = 15 + 5 * val1; // AGI + val3 = 25; // Move speed increase + if (sd != NULL && (sd->job & MAPID_BASEMASK) == MAPID_SUMMONER) + val4 = 10; // Ranged ATK increase + break; + case SC_TUNAPARTY: + val2 = (st->max_hp * (val1 * 10) / 100); // %Max HP to absorb + break; + case SC_BITESCAR: + val2 = 2 * val1; // MHP% damage + val4 = tick / 1000; + tick_time = 1000; + break; + case SC_SHRIMP: + val2 = 10; // BATK%, MATK% + break; + case SC_CATNIPPOWDER: + val2 = 50; // WATK%, MATK% + val3 = 25 * val1; // Move speed reduction + break; default: if (calc_flag == SCB_NONE && status->dbs->SkillChangeTable[type] == 0 && status->dbs->IconChangeTable[type] == 0) { //Status change with no calc, no icon, and no skill associated...? @@ -9767,7 +9864,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_HANBOK: case SC_OKTOBERFEST: if( !vd ) break; - clif->changelook(bl,LOOK_BASE,vd->class_); + clif->changelook(bl, LOOK_BASE, vd->class); clif->changelook(bl,LOOK_WEAPON,0); clif->changelook(bl,LOOK_SHIELD,0); clif->changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color); @@ -9964,6 +10061,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_NEEDLE_OF_PARALYZE: case SC_DEATHBOUND: case SC_NETHERWORLD: + case SC_SV_ROOTTWIST: unit->stop_walking(bl, STOPWALKING_FLAG_FIXPOS); break; case SC_ANKLESNARE: @@ -9978,6 +10076,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_CAMOUFLAGE: case SC_SIREN: case SC_ALL_RIDING: + case SC_SUHIDE: unit->stop_attack(bl); break; case SC_SILENCE: @@ -10165,7 +10264,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t clif->changeoption(bl); if( sd && opt_flag&0x4 ) { if (vd) - clif->changelook(bl,LOOK_BASE,vd->class_); + clif->changelook(bl, LOOK_BASE, vd->class); clif->changelook(bl,LOOK_WEAPON,0); clif->changelook(bl,LOOK_SHIELD,0); if (vd) @@ -10821,10 +10920,11 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_NEUTRALBARRIER_MASTER: case SC_STEALTHFIELD_MASTER: - if( sce->val2 ) { + case SC_SV_ROOTTWIST: + if (sce->val2) { struct skill_unit_group* group = skill->id2group(sce->val2); sce->val2 = 0; - if( group ) /* might have been cleared before status ended, e.g. land protector */ + if (group) /* might have been cleared before status ended, e.g. land protector */ skill->del_unitgroup(group,ALC_MARK); } break; @@ -11102,7 +11202,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const else if(opt_flag) { clif->changeoption(bl); if( sd && opt_flag&0x4 ) { - clif->changelook(bl,LOOK_BASE,sd->vd.class_); + clif->changelook(bl, LOOK_BASE, sd->vd.class); clif->get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield); clif->changelook(bl,LOOK_WEAPON,sd->vd.weapon); clif->changelook(bl,LOOK_SHIELD,sd->vd.shield); @@ -12016,6 +12116,19 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) return 0; } break; + case SC_FRESHSHRIMP: + if (--(sce->val4) >= 0) { + status_heal(bl, st->max_hp / 100, 0, 2); + sc_timer_next((10000 - ((sce->val1 - 1) * 1000)) + tick, status->change_timer, bl->id, data); + } + break; + case SC_BITESCAR: + if (--(sce->val4) >= 0) { + status_percent_damage(bl, bl, -(sce->val2), 0, 0); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); + return 0; + } + break; } // default for all non-handled control paths is to end the status @@ -12202,6 +12315,10 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m // Any +MATK you get from skills and cards, including cards in weapon, is added here. if ( sd && sd->bonus.ematk > 0 && flag != 3 ) *matk_min += sd->bonus.ematk; + if (sd && pc->checkskill(sd, SU_POWEROFLAND) > 0) { + if (pc->checkskill(sd, SU_SV_STEMSPEAR) == 5 && pc->checkskill(sd, SU_CN_POWDERING) == 5 && pc->checkskill(sd, SU_CN_METEOR) == 5 && pc->checkskill(sd, SU_SV_ROOTTWIST) == 5) + *matk_min += *matk_min * 20 / 100; + } if ( flag != 3 ) *matk_min = status->calc_ematk(bl, sc, *matk_min); @@ -12213,6 +12330,8 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m if ( (st->rhw.matk + st->lhw.matk) > 0 ) { int wMatk = st->rhw.matk + st->lhw.matk; // Left and right matk stacks int variance = wMatk * st->rhw.wlv / 10; // Only use right hand weapon level + if (sc != NULL && sc->data[SC_CATNIPPOWDER]) + wMatk -= wMatk * sc->data[SC_CATNIPPOWDER]->val2 / 100; *matk_min += wMatk - variance; *matk_max += wMatk + variance; } @@ -12682,7 +12801,7 @@ int status_natural_heal(struct block_list* bl, va_list args) if ((rate = pc->checkskill(sd,TK_SPTIME))) sc_start(bl,bl,status->skill2sc(TK_SPTIME), 100,rate,skill->get_time(TK_SPTIME, rate)); - if ((sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR + if ((sd->job & MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR &&rnd()%10000 < battle_config.sg_angel_skill_ratio ) { //Angel of the Sun/Moon/Star @@ -12952,15 +13071,15 @@ void status_read_job_db(void) /* [malufett/Hercules] */ return; while ( (jdb = libconfig->setting_get_elem(job_db_conf.root, i++)) ) { - int class_, idx; + int class, idx; const char *name = config_setting_name(jdb); - if ( (class_ = pc->check_job_name(name)) == -1 ) { + if ((class = pc->check_job_name(name)) == -1) { ShowWarning("pc_read_job_db: '%s' unknown job name!\n", name); continue; } - idx = pc->class2idx(class_); + idx = pc->class2idx(class); status->read_job_db_sub(idx, name, jdb); } ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename); @@ -12969,17 +13088,16 @@ void status_read_job_db(void) /* [malufett/Hercules] */ bool status_readdb_job2(char* fields[], int columns, int current) { - int idx, class_, i; + int idx, class, i; nullpo_retr(false, fields); - class_ = atoi(fields[0]); + class = atoi(fields[0]); - if(!pc->db_checkid(class_)) - { - ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class_); + if (!pc->db_checkid(class)) { + ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class); return false; } - idx = pc->class2idx(class_); + idx = pc->class2idx(class); for(i = 1; i < columns; i++) { diff --git a/src/map/status.h b/src/map/status.h index e4a326e88..e6c205b1d 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -828,6 +828,18 @@ typedef enum sc_type { SC_M_LIFEPOTION, SC_G_LIFEPOTION, // 640 SC_MYSTICPOWDER, + + // Summoner + SC_SUHIDE, + SC_SU_STOOP, + SC_SPRITEMABLE, + SC_CATNIPPOWDER, + SC_SV_ROOTTWIST, + SC_BITESCAR, + SC_ARCLOUSEDASH, + SC_TUNAPARTY, + SC_SHRIMP, // 650 + SC_FRESHSHRIMP, #ifndef SC_MAX SC_MAX, //Automatically updated max, used in for's to check we are within bounds. #endif @@ -1747,10 +1759,10 @@ enum si_type { //SI_HEALTHSTATE_HEAVYPOISON = 890, //SI_HEALTHSTATE_FEAR = 891, //SI_CHERRY_BLOSSOM_CAKE = 892, - //SI_SU_STOOP = 893, - //SI_CATNIPPOWDER = 894, + SI_SU_STOOP = 893, + SI_CATNIPPOWDER = 894, SI_BLOSSOM_FLUTTERING = 895, - //SI_SV_ROOTTWIST = 896, + SI_SV_ROOTTWIST = 896, //SI_ATTACK_PROPERTY_NOTHING = 897, //SI_ATTACK_PROPERTY_WATER = 898, //SI_ATTACK_PROPERTY_GROUND = 899, @@ -1772,11 +1784,11 @@ enum si_type { //SI_RESIST_PROPERTY_DARKNESS = 914, //SI_RESIST_PROPERTY_TELEKINESIS = 915, //SI_RESIST_PROPERTY_UNDEAD = 916, - //SI_BITESCAR = 917, - //SI_ARCLOUSEDASH = 918, - //SI_TUNAPARTY = 919, - //SI_SHRIMP = 920, - //SI_FRESHSHRIMP = 921, + SI_BITESCAR = 917, + SI_ARCLOUSEDASH = 918, + SI_TUNAPARTY = 919, + SI_SHRIMP = 920, + SI_FRESHSHRIMP = 921, //SI_PERIOD_RECEIVEITEM = 922, //SI_PERIOD_PLUSEXP = 923, //SI_PERIOD_PLUSJOBEXP = 924, @@ -1788,11 +1800,11 @@ enum si_type { //SI_HELM_ISIA = 930, //SI_HELM_ASIR = 931, //SI_HELM_URJ = 932, - //SI_SUHIDE = 933, + SI_SUHIDE = 933, //SI_ = 934, //SI_DORAM_BUF_01 = 935, //SI_DORAM_BUF_02 = 936, - //SI_SPRITEMABLE = 937, + SI_SPRITEMABLE = 937, //SI_EP16_2_BUFF_SS = 963, //SI_EP16_2_BUFF_SC = 964, //SI_EP16_2_BUFF_AC = 965, diff --git a/src/map/storage.c b/src/map/storage.c index da76a0d30..acb72be81 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/storage.h b/src/map/storage.h index 94512c456..509862db7 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/trade.c b/src/map/trade.c index 6ada188c9..252dff709 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/trade.h b/src/map/trade.h index eba91a1d9..55ff31ed2 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/unit.c b/src/map/unit.c index 86fb6770c..feb11f89e 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1127,6 +1127,7 @@ int unit_can_move(struct block_list *bl) || sc->data[SC_VACUUM_EXTREME] || (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0) || sc->data[SC_NETHERWORLD] + || sc->data[SC_SUHIDE] || (sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) || (sc->data[SC_CLOAKING] && sc->data[SC_CLOAKING]->val1 < 3 && !(sc->data[SC_CLOAKING]->val4&1)) //Need wall at level 1-2 || ( @@ -1543,7 +1544,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui } break; case GD_EMERGENCYCALL: //Emergency Call double cast when the user has learned Leap [Daegaladh] - if( sd && pc->checkskill(sd,TK_HIGHJUMP) ) + if (sd && (pc->checkskill(sd,TK_HIGHJUMP) || pc->checkskill(sd,SU_LOPE) >= 3)) casttime *= 2; break; case RA_WUGDASH: @@ -2464,6 +2465,8 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i status_change_end(bl, SC_VACUUM_EXTREME, INVALID_TIMER); status_change_end(bl, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER); //callme before warp status_change_end(bl, SC_NETHERWORLD, INVALID_TIMER); + status_change_end(bl, SC_SUHIDE, INVALID_TIMER); + status_change_end(bl, SC_SV_ROOTTWIST, INVALID_TIMER); } if (bl->type&(BL_CHAR|BL_PET)) { diff --git a/src/map/unit.h b/src/map/unit.h index 8c4c34696..d065b3d57 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -80,11 +80,7 @@ struct unit_data { }; struct view_data { -#ifdef __64BIT__ - uint32 class_; // FIXME: This shouldn't really depend on the architecture. -#else // not __64BIT__ - uint16 class_; -#endif // __64BIT__ + int16 class; uint16 weapon, shield, //Or left-hand weapon. robe, diff --git a/src/map/vending.c b/src/map/vending.c index 80f57b9aa..9a9585d2f 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/map/vending.h b/src/map/vending.h index 1d2135076..9a236f75b 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 6b88ddf43..57abf25e0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -396,8 +396,8 @@ typedef int (*HPMHOOK_pre_chr_rename_char_sql) (struct char_session_data **sd, i typedef int (*HPMHOOK_post_chr_rename_char_sql) (int retVal___, struct char_session_data *sd, int char_id); typedef int (*HPMHOOK_pre_chr_check_char_name) (char **name, char **esc_name); typedef int (*HPMHOOK_post_chr_check_char_name) (int retVal___, char *name, char *esc_name); -typedef int (*HPMHOOK_pre_chr_make_new_char_sql) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style); -typedef int (*HPMHOOK_post_chr_make_new_char_sql) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); +typedef int (*HPMHOOK_pre_chr_make_new_char_sql) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job); +typedef int (*HPMHOOK_post_chr_make_new_char_sql) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); typedef int (*HPMHOOK_pre_chr_divorce_char_sql) (int *partner_id1, int *partner_id2); typedef int (*HPMHOOK_post_chr_divorce_char_sql) (int retVal___, int partner_id1, int partner_id2); typedef int (*HPMHOOK_pre_chr_count_users) (void); @@ -2500,8 +2500,8 @@ typedef int (*HPMHOOK_pre_guild_check_alliance) (int *guild_id1, int *guild_id2, typedef int (*HPMHOOK_post_guild_check_alliance) (int retVal___, int guild_id1, int guild_id2, int flag); typedef int (*HPMHOOK_pre_guild_send_memberinfoshort) (struct map_session_data **sd, int *online); typedef int (*HPMHOOK_post_guild_send_memberinfoshort) (int retVal___, struct map_session_data *sd, int online); -typedef int (*HPMHOOK_pre_guild_recv_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); -typedef int (*HPMHOOK_post_guild_recv_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); +typedef int (*HPMHOOK_pre_guild_recv_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); +typedef int (*HPMHOOK_post_guild_recv_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int16 class); typedef int (*HPMHOOK_pre_guild_change_memberposition) (int *guild_id, int *account_id, int *char_id, short *idx); typedef int (*HPMHOOK_post_guild_change_memberposition) (int retVal___, int guild_id, int account_id, int char_id, short idx); typedef int (*HPMHOOK_pre_guild_memberposition_changed) (struct guild **g, int *idx, int *pos); @@ -2852,8 +2852,8 @@ typedef bool (*HPMHOOK_pre_inter_msg_config_read) (const char **cfg_name, bool * typedef bool (*HPMHOOK_post_inter_msg_config_read) (bool retVal___, const char *cfg_name, bool allow_override); typedef void (*HPMHOOK_pre_inter_do_final_msg) (void); typedef void (*HPMHOOK_post_inter_do_final_msg) (void); -typedef const char* (*HPMHOOK_pre_inter_job_name) (int *class_); -typedef const char* (*HPMHOOK_post_inter_job_name) (const char* retVal___, int class_); +typedef const char* (*HPMHOOK_pre_inter_job_name) (int *class); +typedef const char* (*HPMHOOK_post_inter_job_name) (const char* retVal___, int class); typedef void (*HPMHOOK_pre_inter_vmsg_to_fd) (int *fd, int *u_fd, int *aid, char **msg, va_list ap); typedef void (*HPMHOOK_post_inter_vmsg_to_fd) (int fd, int u_fd, int aid, char *msg, va_list ap); typedef void (*HPMHOOK_pre_inter_savereg) (int *account_id, int *char_id, const char **key, unsigned int *index, intptr_t *val, bool *is_string); @@ -3030,8 +3030,8 @@ typedef int (*HPMHOOK_pre_intif_guild_addmember) (int *guild_id, struct guild_me typedef int (*HPMHOOK_post_intif_guild_addmember) (int retVal___, int guild_id, struct guild_member *m); typedef int (*HPMHOOK_pre_intif_guild_leave) (int *guild_id, int *account_id, int *char_id, int *flag, const char **mes); typedef int (*HPMHOOK_post_intif_guild_leave) (int retVal___, int guild_id, int account_id, int char_id, int flag, const char *mes); -typedef int (*HPMHOOK_pre_intif_guild_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); -typedef int (*HPMHOOK_post_intif_guild_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); +typedef int (*HPMHOOK_pre_intif_guild_memberinfoshort) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); +typedef int (*HPMHOOK_post_intif_guild_memberinfoshort) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int16 class); typedef int (*HPMHOOK_pre_intif_guild_break) (int *guild_id); typedef int (*HPMHOOK_post_intif_guild_break) (int retVal___, int guild_id); typedef int (*HPMHOOK_pre_intif_guild_message) (int *guild_id, int *account_id, const char **mes, int *len); @@ -3334,8 +3334,8 @@ typedef const char* (*HPMHOOK_pre_itemdb_typename) (int *type); typedef const char* (*HPMHOOK_post_itemdb_typename) (const char* retVal___, int type); typedef void (*HPMHOOK_pre_itemdb_jobmask2mapid) (uint64 **bclass, uint64 *jobmask); typedef void (*HPMHOOK_post_itemdb_jobmask2mapid) (uint64 *bclass, uint64 jobmask); -typedef void (*HPMHOOK_pre_itemdb_jobid2mapid) (uint64 **bclass, int *job_id, bool *enable); -typedef void (*HPMHOOK_post_itemdb_jobid2mapid) (uint64 *bclass, int job_id, bool enable); +typedef void (*HPMHOOK_pre_itemdb_jobid2mapid) (uint64 **bclass, int *job_class, bool *enable); +typedef void (*HPMHOOK_post_itemdb_jobid2mapid) (uint64 *bclass, int job_class, bool enable); typedef void (*HPMHOOK_pre_itemdb_create_dummy_data) (void); typedef void (*HPMHOOK_post_itemdb_create_dummy_data) (void); typedef struct item_data* (*HPMHOOK_pre_itemdb_create_item_data) (int *nameid); @@ -3480,8 +3480,8 @@ typedef void (*HPMHOOK_pre_libconfig_destroy) (struct config_t **config); typedef void (*HPMHOOK_post_libconfig_destroy) (struct config_t *config); typedef int (*HPMHOOK_pre_libconfig_setting_get_int) (const struct config_setting_t **setting); typedef int (*HPMHOOK_post_libconfig_setting_get_int) (int retVal___, const struct config_setting_t *setting); -typedef long long (*HPMHOOK_pre_libconfig_setting_get_int64) (const struct config_setting_t **setting); -typedef long long (*HPMHOOK_post_libconfig_setting_get_int64) (long long retVal___, const struct config_setting_t *setting); +typedef int64 (*HPMHOOK_pre_libconfig_setting_get_int64) (const struct config_setting_t **setting); +typedef int64 (*HPMHOOK_post_libconfig_setting_get_int64) (int64 retVal___, const struct config_setting_t *setting); typedef double (*HPMHOOK_pre_libconfig_setting_get_float) (const struct config_setting_t **setting); typedef double (*HPMHOOK_post_libconfig_setting_get_float) (double retVal___, const struct config_setting_t *setting); typedef int (*HPMHOOK_pre_libconfig_setting_get_bool) (const struct config_setting_t **setting); @@ -3492,8 +3492,8 @@ typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_lookup) (struct typedef struct config_setting_t* (*HPMHOOK_post_libconfig_setting_lookup) (struct config_setting_t* retVal___, struct config_setting_t *setting, const char *name); typedef int (*HPMHOOK_pre_libconfig_setting_lookup_int) (const struct config_setting_t **setting, const char **name, int **value); typedef int (*HPMHOOK_post_libconfig_setting_lookup_int) (int retVal___, const struct config_setting_t *setting, const char *name, int *value); -typedef int (*HPMHOOK_pre_libconfig_setting_lookup_int64) (const struct config_setting_t **setting, const char **name, long long **value); -typedef int (*HPMHOOK_post_libconfig_setting_lookup_int64) (int retVal___, const struct config_setting_t *setting, const char *name, long long *value); +typedef int (*HPMHOOK_pre_libconfig_setting_lookup_int64) (const struct config_setting_t **setting, const char **name, int64 **value); +typedef int (*HPMHOOK_post_libconfig_setting_lookup_int64) (int retVal___, const struct config_setting_t *setting, const char *name, int64 *value); typedef int (*HPMHOOK_pre_libconfig_setting_lookup_float) (const struct config_setting_t **setting, const char **name, double **value); typedef int (*HPMHOOK_post_libconfig_setting_lookup_float) (int retVal___, const struct config_setting_t *setting, const char *name, double *value); typedef int (*HPMHOOK_pre_libconfig_setting_lookup_bool) (const struct config_setting_t **setting, const char **name, int **value); @@ -3502,8 +3502,8 @@ typedef int (*HPMHOOK_pre_libconfig_setting_lookup_string) (const struct config_ typedef int (*HPMHOOK_post_libconfig_setting_lookup_string) (int retVal___, const struct config_setting_t *setting, const char *name, const char **value); typedef int (*HPMHOOK_pre_libconfig_setting_set_int) (struct config_setting_t **setting, int *value); typedef int (*HPMHOOK_post_libconfig_setting_set_int) (int retVal___, struct config_setting_t *setting, int value); -typedef int (*HPMHOOK_pre_libconfig_setting_set_int64) (struct config_setting_t **setting, long long *value); -typedef int (*HPMHOOK_post_libconfig_setting_set_int64) (int retVal___, struct config_setting_t *setting, long long value); +typedef int (*HPMHOOK_pre_libconfig_setting_set_int64) (struct config_setting_t **setting, int64 *value); +typedef int (*HPMHOOK_post_libconfig_setting_set_int64) (int retVal___, struct config_setting_t *setting, int64 value); typedef int (*HPMHOOK_pre_libconfig_setting_set_float) (struct config_setting_t **setting, double *value); typedef int (*HPMHOOK_post_libconfig_setting_set_float) (int retVal___, struct config_setting_t *setting, double value); typedef int (*HPMHOOK_pre_libconfig_setting_set_bool) (struct config_setting_t **setting, int *value); @@ -3516,8 +3516,8 @@ typedef short (*HPMHOOK_pre_libconfig_setting_get_format) (const struct config_s typedef short (*HPMHOOK_post_libconfig_setting_get_format) (short retVal___, const struct config_setting_t *setting); typedef int (*HPMHOOK_pre_libconfig_setting_get_int_elem) (const struct config_setting_t **setting, int *idx); typedef int (*HPMHOOK_post_libconfig_setting_get_int_elem) (int retVal___, const struct config_setting_t *setting, int idx); -typedef long long (*HPMHOOK_pre_libconfig_setting_get_int64_elem) (const struct config_setting_t **setting, int *idx); -typedef long long (*HPMHOOK_post_libconfig_setting_get_int64_elem) (long long retVal___, const struct config_setting_t *setting, int idx); +typedef int64 (*HPMHOOK_pre_libconfig_setting_get_int64_elem) (const struct config_setting_t **setting, int *idx); +typedef int64 (*HPMHOOK_post_libconfig_setting_get_int64_elem) (int64 retVal___, const struct config_setting_t *setting, int idx); typedef double (*HPMHOOK_pre_libconfig_setting_get_float_elem) (const struct config_setting_t **setting, int *idx); typedef double (*HPMHOOK_post_libconfig_setting_get_float_elem) (double retVal___, const struct config_setting_t *setting, int idx); typedef int (*HPMHOOK_pre_libconfig_setting_get_bool_elem) (const struct config_setting_t **setting, int *idx); @@ -3526,8 +3526,8 @@ typedef const char* (*HPMHOOK_pre_libconfig_setting_get_string_elem) (const stru typedef const char* (*HPMHOOK_post_libconfig_setting_get_string_elem) (const char* retVal___, const struct config_setting_t *setting, int idx); typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_set_int_elem) (struct config_setting_t **setting, int *idx, int *value); typedef struct config_setting_t* (*HPMHOOK_post_libconfig_setting_set_int_elem) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, int value); -typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_set_int64_elem) (struct config_setting_t **setting, int *idx, long long *value); -typedef struct config_setting_t* (*HPMHOOK_post_libconfig_setting_set_int64_elem) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, long long value); +typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_set_int64_elem) (struct config_setting_t **setting, int *idx, int64 *value); +typedef struct config_setting_t* (*HPMHOOK_post_libconfig_setting_set_int64_elem) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, int64 value); typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_set_float_elem) (struct config_setting_t **setting, int *idx, double *value); typedef struct config_setting_t* (*HPMHOOK_post_libconfig_setting_set_float_elem) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, double value); typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_setting_set_bool_elem) (struct config_setting_t **setting, int *idx, int *value); @@ -3554,8 +3554,8 @@ typedef struct config_setting_t* (*HPMHOOK_pre_libconfig_lookup) (const struct c typedef struct config_setting_t* (*HPMHOOK_post_libconfig_lookup) (struct config_setting_t* retVal___, const struct config_t *config, const char *filepath); typedef int (*HPMHOOK_pre_libconfig_lookup_int) (const struct config_t **config, const char **filepath, int **value); typedef int (*HPMHOOK_post_libconfig_lookup_int) (int retVal___, const struct config_t *config, const char *filepath, int *value); -typedef int (*HPMHOOK_pre_libconfig_lookup_int64) (const struct config_t **config, const char **filepath, long long **value); -typedef int (*HPMHOOK_post_libconfig_lookup_int64) (int retVal___, const struct config_t *config, const char *filepath, long long *value); +typedef int (*HPMHOOK_pre_libconfig_lookup_int64) (const struct config_t **config, const char **filepath, int64 **value); +typedef int (*HPMHOOK_post_libconfig_lookup_int64) (int retVal___, const struct config_t *config, const char *filepath, int64 *value); typedef int (*HPMHOOK_pre_libconfig_lookup_float) (const struct config_t **config, const char **filepath, double **value); typedef int (*HPMHOOK_post_libconfig_lookup_float) (int retVal___, const struct config_t *config, const char *filepath, double *value); typedef int (*HPMHOOK_pre_libconfig_lookup_bool) (const struct config_t **config, const char **filepath, int **value); @@ -3787,36 +3787,6 @@ typedef void (*HPMHOOK_post_mail_deliveryfail) (struct map_session_data *sd, str typedef bool (*HPMHOOK_pre_mail_invalid_operation) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_mail_invalid_operation) (bool retVal___, struct map_session_data *sd); #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -typedef void (*HPMHOOK_pre_iMalloc_init) (void); -typedef void (*HPMHOOK_post_iMalloc_init) (void); -typedef void (*HPMHOOK_pre_iMalloc_final) (void); -typedef void (*HPMHOOK_post_iMalloc_final) (void); -typedef void* (*HPMHOOK_pre_iMalloc_malloc) (size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_malloc) (void* retVal___, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_calloc) (size_t *num, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_calloc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_realloc) (void **p, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_realloc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_reallocz) (void **p, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_reallocz) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); -typedef char* (*HPMHOOK_pre_iMalloc_astrdup) (const char **p, const char **file, int *line, const char **func); -typedef char* (*HPMHOOK_post_iMalloc_astrdup) (char* retVal___, const char *p, const char *file, int line, const char *func); -typedef char* (*HPMHOOK_pre_iMalloc_astrndup) (const char **p, size_t *size, const char **file, int *line, const char **func); -typedef char* (*HPMHOOK_post_iMalloc_astrndup) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); -typedef void (*HPMHOOK_pre_iMalloc_free) (void **p, const char **file, int *line, const char **func); -typedef void (*HPMHOOK_post_iMalloc_free) (void *p, const char *file, int line, const char *func); -typedef void (*HPMHOOK_pre_iMalloc_memory_check) (void); -typedef void (*HPMHOOK_post_iMalloc_memory_check) (void); -typedef bool (*HPMHOOK_pre_iMalloc_verify_ptr) (void **ptr); -typedef bool (*HPMHOOK_post_iMalloc_verify_ptr) (bool retVal___, void *ptr); -typedef size_t (*HPMHOOK_pre_iMalloc_usage) (void); -typedef size_t (*HPMHOOK_post_iMalloc_usage) (size_t retVal___); -typedef void (*HPMHOOK_pre_iMalloc_post_shutdown) (void); -typedef void (*HPMHOOK_post_iMalloc_post_shutdown) (void); -typedef void (*HPMHOOK_pre_iMalloc_init_messages) (void); -typedef void (*HPMHOOK_post_iMalloc_init_messages) (void); -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ typedef void (*HPMHOOK_pre_map_zone_init) (void); typedef void (*HPMHOOK_post_map_zone_init) (void); @@ -4196,8 +4166,8 @@ typedef int (*HPMHOOK_pre_mapif_parse_GuildAddMember) (int *fd, int *guild_id, c typedef int (*HPMHOOK_post_mapif_parse_GuildAddMember) (int retVal___, int fd, int guild_id, const struct guild_member *m); typedef int (*HPMHOOK_pre_mapif_parse_GuildLeave) (int *fd, int *guild_id, int *account_id, int *char_id, int *flag, const char **mes); typedef int (*HPMHOOK_post_mapif_parse_GuildLeave) (int retVal___, int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); -typedef int (*HPMHOOK_pre_mapif_parse_GuildChangeMemberInfoShort) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); -typedef int (*HPMHOOK_post_mapif_parse_GuildChangeMemberInfoShort) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); +typedef int (*HPMHOOK_pre_mapif_parse_GuildChangeMemberInfoShort) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); +typedef int (*HPMHOOK_post_mapif_parse_GuildChangeMemberInfoShort) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class); typedef int (*HPMHOOK_pre_mapif_parse_BreakGuild) (int *fd, int *guild_id); typedef int (*HPMHOOK_post_mapif_parse_BreakGuild) (int retVal___, int fd, int guild_id); typedef int (*HPMHOOK_pre_mapif_parse_GuildMessage) (int *fd, int *guild_id, int *account_id, const char **mes, int *len); @@ -4492,8 +4462,8 @@ typedef bool (*HPMHOOK_post_mapreg_config_read) (bool retVal___, const char *fil #ifdef COMMON_MD5CALC_H /* md5 */ typedef void (*HPMHOOK_pre_md5_string) (const char **string, char **output); typedef void (*HPMHOOK_post_md5_string) (const char *string, char *output); -typedef void (*HPMHOOK_pre_md5_binary) (const char **string, unsigned char **output); -typedef void (*HPMHOOK_post_md5_binary) (const char *string, unsigned char *output); +typedef void (*HPMHOOK_pre_md5_binary) (const uint8 **buf, const int *buf_size, uint8 **output); +typedef void (*HPMHOOK_post_md5_binary) (const uint8 *buf, const int buf_size, uint8 *output); typedef void (*HPMHOOK_pre_md5_salt) (int *len, char **output); typedef void (*HPMHOOK_post_md5_salt) (int len, char *output); #endif // COMMON_MD5CALC_H @@ -5172,8 +5142,8 @@ typedef void (*HPMHOOK_pre_pc_final) (void); typedef void (*HPMHOOK_post_pc_final) (void); typedef struct map_session_data* (*HPMHOOK_pre_pc_get_dummy_sd) (void); typedef struct map_session_data* (*HPMHOOK_post_pc_get_dummy_sd) (struct map_session_data* retVal___); -typedef int (*HPMHOOK_pre_pc_class2idx) (int *class_); -typedef int (*HPMHOOK_post_pc_class2idx) (int retVal___, int class_); +typedef int (*HPMHOOK_pre_pc_class2idx) (int *class); +typedef int (*HPMHOOK_post_pc_class2idx) (int retVal___, int class); typedef bool (*HPMHOOK_pre_pc_can_talk) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_pc_can_talk) (bool retVal___, struct map_session_data *sd); typedef bool (*HPMHOOK_pre_pc_can_attack) (struct map_session_data **sd, int *target_id); @@ -5376,8 +5346,8 @@ typedef int (*HPMHOOK_pre_pc_itemheal) (struct map_session_data **sd, int *itemi typedef int (*HPMHOOK_post_pc_itemheal) (int retVal___, struct map_session_data *sd, int itemid, int hp, int sp); typedef int (*HPMHOOK_pre_pc_percentheal) (struct map_session_data **sd, int *hp, int *sp); typedef int (*HPMHOOK_post_pc_percentheal) (int retVal___, struct map_session_data *sd, int hp, int sp); -typedef int (*HPMHOOK_pre_pc_jobchange) (struct map_session_data **sd, int *job, int *upper); -typedef int (*HPMHOOK_post_pc_jobchange) (int retVal___, struct map_session_data *sd, int job, int upper); +typedef int (*HPMHOOK_pre_pc_jobchange) (struct map_session_data **sd, int *class, int *upper); +typedef int (*HPMHOOK_post_pc_jobchange) (int retVal___, struct map_session_data *sd, int class, int upper); typedef int (*HPMHOOK_pre_pc_setoption) (struct map_session_data **sd, int *type); typedef int (*HPMHOOK_post_pc_setoption) (int retVal___, struct map_session_data *sd, int type); typedef int (*HPMHOOK_pre_pc_setcart) (struct map_session_data **sd, int *type); @@ -5450,12 +5420,12 @@ typedef void (*HPMHOOK_pre_pc_setstand) (struct map_session_data **sd); typedef void (*HPMHOOK_post_pc_setstand) (struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_candrop) (struct map_session_data **sd, struct item **item); typedef int (*HPMHOOK_post_pc_candrop) (int retVal___, struct map_session_data *sd, struct item *item); -typedef int (*HPMHOOK_pre_pc_jobid2mapid) (unsigned short *b_class); -typedef int (*HPMHOOK_post_pc_jobid2mapid) (int retVal___, unsigned short b_class); +typedef int (*HPMHOOK_pre_pc_jobid2mapid) (int16 *class); +typedef int (*HPMHOOK_post_pc_jobid2mapid) (int retVal___, int16 class); typedef int (*HPMHOOK_pre_pc_mapid2jobid) (unsigned short *class_, int *sex); typedef int (*HPMHOOK_post_pc_mapid2jobid) (int retVal___, unsigned short class_, int sex); -typedef const char* (*HPMHOOK_pre_pc_job_name) (int *class_); -typedef const char* (*HPMHOOK_post_pc_job_name) (const char* retVal___, int class_); +typedef const char* (*HPMHOOK_pre_pc_job_name) (int *class); +typedef const char* (*HPMHOOK_post_pc_job_name) (const char* retVal___, int class); typedef void (*HPMHOOK_pre_pc_setinvincibletimer) (struct map_session_data **sd, int *val); typedef void (*HPMHOOK_post_pc_setinvincibletimer) (struct map_session_data *sd, int val); typedef void (*HPMHOOK_pre_pc_delinvincibletimer) (struct map_session_data **sd); @@ -5466,10 +5436,12 @@ typedef int (*HPMHOOK_pre_pc_delspiritball) (struct map_session_data **sd, int * typedef int (*HPMHOOK_post_pc_delspiritball) (int retVal___, struct map_session_data *sd, int count, int type); typedef int (*HPMHOOK_pre_pc_getmaxspiritball) (struct map_session_data **sd, int *min); typedef int (*HPMHOOK_post_pc_getmaxspiritball) (int retVal___, struct map_session_data *sd, int min); -typedef void (*HPMHOOK_pre_pc_addfame) (struct map_session_data **sd, int *count); -typedef void (*HPMHOOK_post_pc_addfame) (struct map_session_data *sd, int count); -typedef unsigned char (*HPMHOOK_pre_pc_famerank) (int *char_id, int *job); -typedef unsigned char (*HPMHOOK_post_pc_famerank) (unsigned char retVal___, int char_id, int job); +typedef void (*HPMHOOK_pre_pc_addfame) (struct map_session_data **sd, int *ranktype, int *count); +typedef void (*HPMHOOK_post_pc_addfame) (struct map_session_data *sd, int ranktype, int count); +typedef int (*HPMHOOK_pre_pc_fame_rank) (int *char_id, int *ranktype); +typedef int (*HPMHOOK_post_pc_fame_rank) (int retVal___, int char_id, int ranktype); +typedef int (*HPMHOOK_pre_pc_famelist_type) (uint16 *job_mapid); +typedef int (*HPMHOOK_post_pc_famelist_type) (int retVal___, uint16 job_mapid); typedef int (*HPMHOOK_pre_pc_set_hate_mob) (struct map_session_data **sd, int *pos, struct block_list **bl); typedef int (*HPMHOOK_post_pc_set_hate_mob) (int retVal___, struct map_session_data *sd, int pos, struct block_list *bl); typedef int (*HPMHOOK_pre_pc_readdb) (void); @@ -5484,8 +5456,8 @@ typedef int (*HPMHOOK_pre_pc_inventory_rental_clear) (struct map_session_data ** typedef int (*HPMHOOK_post_pc_inventory_rental_clear) (int retVal___, struct map_session_data *sd); typedef void (*HPMHOOK_pre_pc_inventory_rental_add) (struct map_session_data **sd, int *seconds); typedef void (*HPMHOOK_post_pc_inventory_rental_add) (struct map_session_data *sd, int seconds); -typedef int (*HPMHOOK_pre_pc_disguise) (struct map_session_data **sd, int *class_); -typedef int (*HPMHOOK_post_pc_disguise) (int retVal___, struct map_session_data *sd, int class_); +typedef int (*HPMHOOK_pre_pc_disguise) (struct map_session_data **sd, int *class); +typedef int (*HPMHOOK_post_pc_disguise) (int retVal___, struct map_session_data *sd, int class); typedef bool (*HPMHOOK_pre_pc_isautolooting) (struct map_session_data **sd, int *nameid); typedef bool (*HPMHOOK_post_pc_isautolooting) (bool retVal___, struct map_session_data *sd, int nameid); typedef void (*HPMHOOK_pre_pc_overheat) (struct map_session_data **sd, int *val); @@ -5578,8 +5550,8 @@ typedef int (*HPMHOOK_pre_pc_global_expiration_timer) (int *tid, int64 *tick, in typedef int (*HPMHOOK_post_pc_global_expiration_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); typedef void (*HPMHOOK_pre_pc_expire_check) (struct map_session_data **sd); typedef void (*HPMHOOK_post_pc_expire_check) (struct map_session_data *sd); -typedef bool (*HPMHOOK_pre_pc_db_checkid) (unsigned int *class_); -typedef bool (*HPMHOOK_post_pc_db_checkid) (bool retVal___, unsigned int class_); +typedef bool (*HPMHOOK_pre_pc_db_checkid) (int *class); +typedef bool (*HPMHOOK_post_pc_db_checkid) (bool retVal___, int class); typedef void (*HPMHOOK_pre_pc_validate_levels) (void); typedef void (*HPMHOOK_post_pc_validate_levels) (void); typedef void (*HPMHOOK_pre_pc_autotrade_load) (void); @@ -5604,6 +5576,8 @@ typedef bool (*HPMHOOK_pre_pc_process_chat_message) (struct map_session_data **s typedef bool (*HPMHOOK_post_pc_process_chat_message) (bool retVal___, struct map_session_data *sd, const char *message); typedef void (*HPMHOOK_pre_pc_check_supernovice_call) (struct map_session_data **sd, const char **message); typedef void (*HPMHOOK_post_pc_check_supernovice_call) (struct map_session_data *sd, const char *message); +typedef bool (*HPMHOOK_pre_pc_check_basicskill) (struct map_session_data **sd, int *level); +typedef bool (*HPMHOOK_post_pc_check_basicskill) (bool retVal___, struct map_session_data *sd, int level); #endif // MAP_PC_H #ifdef MAP_NPC_H /* libpcre */ typedef pcre* (*HPMHOOK_pre_libpcre_compile) (const char **pattern, int *options, const char ***errptr, int **erroffset, const unsigned char **tableptr); @@ -6246,8 +6220,8 @@ typedef int (*HPMHOOK_pre_skill_get_unit_range) (uint16 *skill_id, uint16 *skill typedef int (*HPMHOOK_post_skill_get_unit_range) (int retVal___, uint16 skill_id, uint16 skill_lv); typedef int (*HPMHOOK_pre_skill_get_cooldown) (uint16 *skill_id, uint16 *skill_lv); typedef int (*HPMHOOK_post_skill_get_cooldown) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_tree_get_max) (uint16 *skill_id, int *b_class); -typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, uint16 skill_id, int b_class); +typedef int (*HPMHOOK_pre_skill_tree_get_max) (uint16 *skill_id, int *class); +typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, uint16 skill_id, int class); typedef const char* (*HPMHOOK_pre_skill_get_name) (uint16 *skill_id); typedef const char* (*HPMHOOK_post_skill_get_name) (const char* retVal___, uint16 skill_id); typedef const char* (*HPMHOOK_pre_skill_get_desc) (uint16 *skill_id); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 836e51f3f..eb5583035 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -804,34 +804,6 @@ struct { struct HPMHookPoint *HP_loginif_send_users_count_post; struct HPMHookPoint *HP_loginif_connect_to_server_pre; struct HPMHookPoint *HP_loginif_connect_to_server_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_mapif_ban_pre; struct HPMHookPoint *HP_mapif_ban_post; struct HPMHookPoint *HP_mapif_server_init_pre; @@ -2309,34 +2281,6 @@ struct { int HP_loginif_send_users_count_post; int HP_loginif_connect_to_server_pre; int HP_loginif_connect_to_server_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_mapif_ban_pre; int HP_mapif_ban_post; int HP_mapif_server_init_pre; @@ -3057,7 +3001,6 @@ struct { struct inter_storage_interface inter_storage; struct libconfig_interface libconfig; struct loginif_interface loginif; - struct malloc_interface iMalloc; struct mapif_interface mapif; struct mapindex_interface mapindex; struct md5_interface md5; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 047373f77..29720bf40 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -436,21 +436,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(loginif->auth, HP_loginif_auth) }, { HP_POP(loginif->send_users_count, HP_loginif_send_users_count) }, { HP_POP(loginif->connect_to_server, HP_loginif_connect_to_server) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* mapif_interface */ { HP_POP(mapif->ban, HP_mapif_ban) }, { HP_POP(mapif->server_init, HP_mapif_server_init) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 63afcab3c..e2108c8f8 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -744,15 +744,15 @@ int HP_chr_check_char_name(char *name, char *esc_name) { } return retVal___; } -int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) { +int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_chr_make_new_char_sql_pre ) { - int (*preHookFunc) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style); + int (*preHookFunc) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style); + retVal___ = preHookFunc(&sd, &name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style, &starting_job); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -760,13 +760,13 @@ int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, in } } { - retVal___ = HPMHooks.source.chr.make_new_char_sql(sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style); + retVal___ = HPMHooks.source.chr.make_new_char_sql(sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job); } if( HPMHooks.count.HP_chr_make_new_char_sql_post ) { - int (*postHookFunc) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*postHookFunc) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style); + retVal___ = postHookFunc(retVal___, sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job); } } return retVal___; @@ -6694,15 +6694,15 @@ void HP_inter_do_final_msg(void) { } return; } -const char* HP_inter_job_name(int class_) { +const char* HP_inter_job_name(int class) { int hIndex = 0; const char* retVal___ = NULL; if( HPMHooks.count.HP_inter_job_name_pre ) { - const char* (*preHookFunc) (int *class_); + const char* (*preHookFunc) (int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_inter_job_name_pre[hIndex].func; - retVal___ = preHookFunc(&class_); + retVal___ = preHookFunc(&class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -6710,13 +6710,13 @@ const char* HP_inter_job_name(int class_) { } } { - retVal___ = HPMHooks.source.inter.job_name(class_); + retVal___ = HPMHooks.source.inter.job_name(class); } if( HPMHooks.count.HP_inter_job_name_post ) { - const char* (*postHookFunc) (const char* retVal___, int class_); + const char* (*postHookFunc) (const char* retVal___, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_inter_job_name_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class_); + retVal___ = postHookFunc(retVal___, class); } } return retVal___; @@ -8593,11 +8593,11 @@ int HP_libconfig_setting_get_int(const struct config_setting_t *setting) { } return retVal___; } -long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { +int64 HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting); + int64 (*preHookFunc) (const struct config_setting_t **setting); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_pre[hIndex].func; @@ -8612,7 +8612,7 @@ long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) retVal___ = HPMHooks.source.libconfig.setting_get_int64(setting); } if( HPMHooks.count.HP_libconfig_setting_get_int64_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting); @@ -8755,11 +8755,11 @@ int HP_libconfig_setting_lookup_int(const struct config_setting_t *setting, cons } return retVal___; } -int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, long long *value) { +int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_setting_t **setting, const char **name, long long **value); + int (*preHookFunc) (const struct config_setting_t **setting, const char **name, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_pre[hIndex].func; @@ -8774,7 +8774,7 @@ int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, co retVal___ = HPMHooks.source.libconfig.setting_lookup_int64(setting, name, value); } if( HPMHooks.count.HP_libconfig_setting_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, long long *value); + int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, name, value); @@ -8890,11 +8890,11 @@ int HP_libconfig_setting_set_int(struct config_setting_t *setting, int value) { } return retVal___; } -int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long value) { +int HP_libconfig_setting_set_int64(struct config_setting_t *setting, int64 value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_set_int64_pre ) { - int (*preHookFunc) (struct config_setting_t **setting, long long *value); + int (*preHookFunc) (struct config_setting_t **setting, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_pre[hIndex].func; @@ -8909,7 +8909,7 @@ int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long v retVal___ = HPMHooks.source.libconfig.setting_set_int64(setting, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_post ) { - int (*postHookFunc) (int retVal___, struct config_setting_t *setting, long long value); + int (*postHookFunc) (int retVal___, struct config_setting_t *setting, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, value); @@ -9079,11 +9079,11 @@ int HP_libconfig_setting_get_int_elem(const struct config_setting_t *setting, in } return retVal___; } -long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { +int64 HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting, int *idx); + int64 (*preHookFunc) (const struct config_setting_t **setting, int *idx); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_pre[hIndex].func; @@ -9098,7 +9098,7 @@ long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *set retVal___ = HPMHooks.source.libconfig.setting_get_int64_elem(setting, idx); } if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting, int idx); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting, int idx); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx); @@ -9214,11 +9214,11 @@ struct config_setting_t* HP_libconfig_setting_set_int_elem(struct config_setting } return retVal___; } -struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, long long value) { +struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, int64 value) { int hIndex = 0; struct config_setting_t* retVal___ = NULL; if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre ) { - struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, long long *value); + struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_pre[hIndex].func; @@ -9233,7 +9233,7 @@ struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setti retVal___ = HPMHooks.source.libconfig.setting_set_int64_elem(setting, idx, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_post ) { - struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, long long value); + struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx, value); @@ -9591,11 +9591,11 @@ int HP_libconfig_lookup_int(const struct config_t *config, const char *filepath, } return retVal___; } -int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, long long *value) { +int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_t **config, const char **filepath, long long **value); + int (*preHookFunc) (const struct config_t **config, const char **filepath, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_pre[hIndex].func; @@ -9610,7 +9610,7 @@ int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepat retVal___ = HPMHooks.source.libconfig.lookup_int64(config, filepath, value); } if( HPMHooks.count.HP_libconfig_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, long long *value); + int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, config, filepath, value); @@ -10440,379 +10440,6 @@ void HP_loginif_connect_to_server(void) { } return; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* mapif_interface */ void HP_mapif_ban(int id, unsigned int flag, int status) { int hIndex = 0; @@ -12246,15 +11873,15 @@ int HP_mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, } return retVal___; } -int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { +int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre ) { - int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &online, &lv, &class_); + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &online, &lv, &class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -12262,13 +11889,13 @@ int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_ } } { - retVal___ = HPMHooks.source.mapif.parse_GuildChangeMemberInfoShort(fd, guild_id, account_id, char_id, online, lv, class_); + retVal___ = HPMHooks.source.mapif.parse_GuildChangeMemberInfoShort(fd, guild_id, account_id, char_id, online, lv, class); } if( HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post ) { - int (*postHookFunc) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*postHookFunc) (int retVal___, int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class); for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, guild_id, account_id, char_id, online, lv, class_); + retVal___ = postHookFunc(retVal___, fd, guild_id, account_id, char_id, online, lv, class); } } return retVal___; @@ -15580,14 +15207,14 @@ void HP_md5_string(const char *string, char *output) { } return; } -void HP_md5_binary(const char *string, unsigned char *output) { +void HP_md5_binary(const uint8 *buf, const int buf_size, uint8 *output) { int hIndex = 0; if( HPMHooks.count.HP_md5_binary_pre ) { - void (*preHookFunc) (const char **string, unsigned char **output); + void (*preHookFunc) (const uint8 **buf, const int *buf_size, uint8 **output); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_md5_binary_pre[hIndex].func; - preHookFunc(&string, &output); + preHookFunc(&buf, &buf_size, &output); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -15595,13 +15222,13 @@ void HP_md5_binary(const char *string, unsigned char *output) { } } { - HPMHooks.source.md5.binary(string, output); + HPMHooks.source.md5.binary(buf, buf_size, output); } if( HPMHooks.count.HP_md5_binary_post ) { - void (*postHookFunc) (const char *string, unsigned char *output); + void (*postHookFunc) (const uint8 *buf, const int buf_size, uint8 *output); for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_md5_binary_post[hIndex].func; - postHookFunc(string, output); + postHookFunc(buf, buf_size, output); } } return; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index 54ae8f030..07cd94cb2 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,6 @@ memcpy(&HPMHooks.source.inter_quest, inter_quest, sizeof(struct inter_quest_inte memcpy(&HPMHooks.source.inter_storage, inter_storage, sizeof(struct inter_storage_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.loginif, loginif, sizeof(struct loginif_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.mapif, mapif, sizeof(struct mapif_interface)); memcpy(&HPMHooks.source.mapindex, mapindex, sizeof(struct mapindex_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index b97b6ea7f..57c1e0233 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -376,34 +376,6 @@ struct { struct HPMHookPoint *HP_login_config_set_defaults_post; struct HPMHookPoint *HP_login_config_read_pre; struct HPMHookPoint *HP_login_config_read_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_md5_string_pre; struct HPMHookPoint *HP_md5_string_post; struct HPMHookPoint *HP_md5_binary_pre; @@ -1077,34 +1049,6 @@ struct { int HP_login_config_set_defaults_post; int HP_login_config_read_pre; int HP_login_config_read_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_md5_string_pre; int HP_md5_string_post; int HP_md5_binary_pre; @@ -1438,7 +1382,6 @@ struct { struct lclif_interface_private PRIV__lclif; struct libconfig_interface libconfig; struct login_interface login; - struct malloc_interface iMalloc; struct md5_interface md5; struct mutex_interface mutex; struct nullpo_interface nullpo; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 2d3e37bc3..125c54a12 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -211,21 +211,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(login->parse_request_connection, HP_login_parse_request_connection) }, { HP_POP(login->config_set_defaults, HP_login_config_set_defaults) }, { HP_POP(login->config_read, HP_login_config_read) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* md5_interface */ { HP_POP(md5->string, HP_md5_string) }, { HP_POP(md5->binary, HP_md5_binary) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 290c2283a..a7e7afa4e 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1899,11 +1899,11 @@ int HP_libconfig_setting_get_int(const struct config_setting_t *setting) { } return retVal___; } -long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { +int64 HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting); + int64 (*preHookFunc) (const struct config_setting_t **setting); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_pre[hIndex].func; @@ -1918,7 +1918,7 @@ long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) retVal___ = HPMHooks.source.libconfig.setting_get_int64(setting); } if( HPMHooks.count.HP_libconfig_setting_get_int64_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting); @@ -2061,11 +2061,11 @@ int HP_libconfig_setting_lookup_int(const struct config_setting_t *setting, cons } return retVal___; } -int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, long long *value) { +int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_setting_t **setting, const char **name, long long **value); + int (*preHookFunc) (const struct config_setting_t **setting, const char **name, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_pre[hIndex].func; @@ -2080,7 +2080,7 @@ int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, co retVal___ = HPMHooks.source.libconfig.setting_lookup_int64(setting, name, value); } if( HPMHooks.count.HP_libconfig_setting_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, long long *value); + int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, name, value); @@ -2196,11 +2196,11 @@ int HP_libconfig_setting_set_int(struct config_setting_t *setting, int value) { } return retVal___; } -int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long value) { +int HP_libconfig_setting_set_int64(struct config_setting_t *setting, int64 value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_set_int64_pre ) { - int (*preHookFunc) (struct config_setting_t **setting, long long *value); + int (*preHookFunc) (struct config_setting_t **setting, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_pre[hIndex].func; @@ -2215,7 +2215,7 @@ int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long v retVal___ = HPMHooks.source.libconfig.setting_set_int64(setting, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_post ) { - int (*postHookFunc) (int retVal___, struct config_setting_t *setting, long long value); + int (*postHookFunc) (int retVal___, struct config_setting_t *setting, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, value); @@ -2385,11 +2385,11 @@ int HP_libconfig_setting_get_int_elem(const struct config_setting_t *setting, in } return retVal___; } -long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { +int64 HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting, int *idx); + int64 (*preHookFunc) (const struct config_setting_t **setting, int *idx); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_pre[hIndex].func; @@ -2404,7 +2404,7 @@ long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *set retVal___ = HPMHooks.source.libconfig.setting_get_int64_elem(setting, idx); } if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting, int idx); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting, int idx); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx); @@ -2520,11 +2520,11 @@ struct config_setting_t* HP_libconfig_setting_set_int_elem(struct config_setting } return retVal___; } -struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, long long value) { +struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, int64 value) { int hIndex = 0; struct config_setting_t* retVal___ = NULL; if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre ) { - struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, long long *value); + struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_pre[hIndex].func; @@ -2539,7 +2539,7 @@ struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setti retVal___ = HPMHooks.source.libconfig.setting_set_int64_elem(setting, idx, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_post ) { - struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, long long value); + struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx, value); @@ -2897,11 +2897,11 @@ int HP_libconfig_lookup_int(const struct config_t *config, const char *filepath, } return retVal___; } -int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, long long *value) { +int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_t **config, const char **filepath, long long **value); + int (*preHookFunc) (const struct config_t **config, const char **filepath, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_pre[hIndex].func; @@ -2916,7 +2916,7 @@ int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepat retVal___ = HPMHooks.source.libconfig.lookup_int64(config, filepath, value); } if( HPMHooks.count.HP_libconfig_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, long long *value); + int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, config, filepath, value); @@ -4716,379 +4716,6 @@ bool HP_login_config_read(const char *filename, bool included) { } return retVal___; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* md5_interface */ void HP_md5_string(const char *string, char *output) { int hIndex = 0; @@ -5116,14 +4743,14 @@ void HP_md5_string(const char *string, char *output) { } return; } -void HP_md5_binary(const char *string, unsigned char *output) { +void HP_md5_binary(const uint8 *buf, const int buf_size, uint8 *output) { int hIndex = 0; if( HPMHooks.count.HP_md5_binary_pre ) { - void (*preHookFunc) (const char **string, unsigned char **output); + void (*preHookFunc) (const uint8 **buf, const int *buf_size, uint8 **output); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_md5_binary_pre[hIndex].func; - preHookFunc(&string, &output); + preHookFunc(&buf, &buf_size, &output); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -5131,13 +4758,13 @@ void HP_md5_binary(const char *string, unsigned char *output) { } } { - HPMHooks.source.md5.binary(string, output); + HPMHooks.source.md5.binary(buf, buf_size, output); } if( HPMHooks.count.HP_md5_binary_post ) { - void (*postHookFunc) (const char *string, unsigned char *output); + void (*postHookFunc) (const uint8 *buf, const int buf_size, uint8 *output); for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_md5_binary_post[hIndex].func; - postHookFunc(string, output); + postHookFunc(buf, buf_size, output); } } return; diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index 6677a0c55..8239d64ce 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,6 @@ memcpy(&HPMHooks.source.lclif, lclif, sizeof(struct lclif_interface)); memcpy(&HPMHooks.source.PRIV__lclif, lclif->p, sizeof(struct lclif_interface_private)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.login, login, sizeof(struct login_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); memcpy(&HPMHooks.source.mutex, mutex, sizeof(struct mutex_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index d71ecc52f..bd055cac2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2984,34 +2984,6 @@ struct { struct HPMHookPoint *HP_mail_deliveryfail_post; struct HPMHookPoint *HP_mail_invalid_operation_pre; struct HPMHookPoint *HP_mail_invalid_operation_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_map_zone_init_pre; struct HPMHookPoint *HP_map_zone_init_post; struct HPMHookPoint *HP_map_zone_remove_pre; @@ -4294,8 +4266,10 @@ struct { struct HPMHookPoint *HP_pc_getmaxspiritball_post; struct HPMHookPoint *HP_pc_addfame_pre; struct HPMHookPoint *HP_pc_addfame_post; - struct HPMHookPoint *HP_pc_famerank_pre; - struct HPMHookPoint *HP_pc_famerank_post; + struct HPMHookPoint *HP_pc_fame_rank_pre; + struct HPMHookPoint *HP_pc_fame_rank_post; + struct HPMHookPoint *HP_pc_famelist_type_pre; + struct HPMHookPoint *HP_pc_famelist_type_post; struct HPMHookPoint *HP_pc_set_hate_mob_pre; struct HPMHookPoint *HP_pc_set_hate_mob_post; struct HPMHookPoint *HP_pc_readdb_pre; @@ -4430,6 +4404,8 @@ struct { struct HPMHookPoint *HP_pc_process_chat_message_post; struct HPMHookPoint *HP_pc_check_supernovice_call_pre; struct HPMHookPoint *HP_pc_check_supernovice_call_post; + struct HPMHookPoint *HP_pc_check_basicskill_pre; + struct HPMHookPoint *HP_pc_check_basicskill_post; struct HPMHookPoint *HP_libpcre_compile_pre; struct HPMHookPoint *HP_libpcre_compile_post; struct HPMHookPoint *HP_libpcre_study_pre; @@ -9047,34 +9023,6 @@ struct { int HP_mail_deliveryfail_post; int HP_mail_invalid_operation_pre; int HP_mail_invalid_operation_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_map_zone_init_pre; int HP_map_zone_init_post; int HP_map_zone_remove_pre; @@ -10357,8 +10305,10 @@ struct { int HP_pc_getmaxspiritball_post; int HP_pc_addfame_pre; int HP_pc_addfame_post; - int HP_pc_famerank_pre; - int HP_pc_famerank_post; + int HP_pc_fame_rank_pre; + int HP_pc_fame_rank_post; + int HP_pc_famelist_type_pre; + int HP_pc_famelist_type_post; int HP_pc_set_hate_mob_pre; int HP_pc_set_hate_mob_post; int HP_pc_readdb_pre; @@ -10493,6 +10443,8 @@ struct { int HP_pc_process_chat_message_post; int HP_pc_check_supernovice_call_pre; int HP_pc_check_supernovice_call_post; + int HP_pc_check_basicskill_pre; + int HP_pc_check_basicskill_post; int HP_libpcre_compile_pre; int HP_libpcre_compile_post; int HP_libpcre_study_pre; @@ -12179,7 +12131,6 @@ struct { struct libconfig_interface libconfig; struct log_interface logs; struct mail_interface mail; - struct malloc_interface iMalloc; struct map_interface map; struct mapindex_interface mapindex; struct mapit_interface mapit; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index b6ee443a3..53f65bcd3 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1532,21 +1532,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mail->openmail, HP_mail_openmail) }, { HP_POP(mail->deliveryfail, HP_mail_deliveryfail) }, { HP_POP(mail->invalid_operation, HP_mail_invalid_operation) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* map_interface */ { HP_POP(map->zone_init, HP_map_zone_init) }, { HP_POP(map->zone_remove, HP_map_zone_remove) }, @@ -2203,7 +2188,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->delspiritball, HP_pc_delspiritball) }, { HP_POP(pc->getmaxspiritball, HP_pc_getmaxspiritball) }, { HP_POP(pc->addfame, HP_pc_addfame) }, - { HP_POP(pc->famerank, HP_pc_famerank) }, + { HP_POP(pc->fame_rank, HP_pc_fame_rank) }, + { HP_POP(pc->famelist_type, HP_pc_famelist_type) }, { HP_POP(pc->set_hate_mob, HP_pc_set_hate_mob) }, { HP_POP(pc->readdb, HP_pc_readdb) }, { HP_POP(pc->map_day_timer, HP_pc_map_day_timer) }, @@ -2271,6 +2257,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->have_magnifier, HP_pc_have_magnifier) }, { HP_POP(pc->process_chat_message, HP_pc_process_chat_message) }, { HP_POP(pc->check_supernovice_call, HP_pc_check_supernovice_call) }, + { HP_POP(pc->check_basicskill, HP_pc_check_basicskill) }, /* pcre_interface */ { HP_POP(libpcre->compile, HP_libpcre_compile) }, { HP_POP(libpcre->study, HP_libpcre_study) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 0c81e557f..654c902d8 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27588,15 +27588,15 @@ int HP_guild_send_memberinfoshort(struct map_session_data *sd, int online) { } return retVal___; } -int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_) { +int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_guild_recv_memberinfoshort_pre ) { - int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_recv_memberinfoshort_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_guild_recv_memberinfoshort_pre[hIndex].func; - retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class_); + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -27604,13 +27604,13 @@ int HP_guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int } } { - retVal___ = HPMHooks.source.guild.recv_memberinfoshort(guild_id, account_id, char_id, online, lv, class_); + retVal___ = HPMHooks.source.guild.recv_memberinfoshort(guild_id, account_id, char_id, online, lv, class); } if( HPMHooks.count.HP_guild_recv_memberinfoshort_post ) { - int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int16 class); for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_recv_memberinfoshort_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_guild_recv_memberinfoshort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class_); + retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class); } } return retVal___; @@ -31727,15 +31727,15 @@ int HP_intif_guild_leave(int guild_id, int account_id, int char_id, int flag, co } return retVal___; } -int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_) { +int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_intif_guild_memberinfoshort_pre ) { - int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *online, int *lv, int16 *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_memberinfoshort_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_intif_guild_memberinfoshort_pre[hIndex].func; - retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class_); + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &online, &lv, &class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -31743,13 +31743,13 @@ int HP_intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, in } } { - retVal___ = HPMHooks.source.intif.guild_memberinfoshort(guild_id, account_id, char_id, online, lv, class_); + retVal___ = HPMHooks.source.intif.guild_memberinfoshort(guild_id, account_id, char_id, online, lv, class); } if( HPMHooks.count.HP_intif_guild_memberinfoshort_post ) { - int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*postHookFunc) (int retVal___, int guild_id, int account_id, int char_id, int online, int lv, int16 class); for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_memberinfoshort_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_intif_guild_memberinfoshort_post[hIndex].func; - retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class_); + retVal___ = postHookFunc(retVal___, guild_id, account_id, char_id, online, lv, class); } } return retVal___; @@ -35710,14 +35710,14 @@ void HP_itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) { } return; } -void HP_itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) { +void HP_itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable) { int hIndex = 0; if( HPMHooks.count.HP_itemdb_jobid2mapid_pre ) { - void (*preHookFunc) (uint64 **bclass, int *job_id, bool *enable); + void (*preHookFunc) (uint64 **bclass, int *job_class, bool *enable); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_jobid2mapid_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_itemdb_jobid2mapid_pre[hIndex].func; - preHookFunc(&bclass, &job_id, &enable); + preHookFunc(&bclass, &job_class, &enable); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -35725,13 +35725,13 @@ void HP_itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable) { } } { - HPMHooks.source.itemdb.jobid2mapid(bclass, job_id, enable); + HPMHooks.source.itemdb.jobid2mapid(bclass, job_class, enable); } if( HPMHooks.count.HP_itemdb_jobid2mapid_post ) { - void (*postHookFunc) (uint64 *bclass, int job_id, bool enable); + void (*postHookFunc) (uint64 *bclass, int job_class, bool enable); for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_jobid2mapid_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_itemdb_jobid2mapid_post[hIndex].func; - postHookFunc(bclass, job_id, enable); + postHookFunc(bclass, job_class, enable); } } return; @@ -36972,11 +36972,11 @@ int HP_libconfig_setting_get_int(const struct config_setting_t *setting) { } return retVal___; } -long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { +int64 HP_libconfig_setting_get_int64(const struct config_setting_t *setting) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting); + int64 (*preHookFunc) (const struct config_setting_t **setting); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_pre[hIndex].func; @@ -36991,7 +36991,7 @@ long long HP_libconfig_setting_get_int64(const struct config_setting_t *setting) retVal___ = HPMHooks.source.libconfig.setting_get_int64(setting); } if( HPMHooks.count.HP_libconfig_setting_get_int64_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting); @@ -37134,11 +37134,11 @@ int HP_libconfig_setting_lookup_int(const struct config_setting_t *setting, cons } return retVal___; } -int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, long long *value) { +int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, const char *name, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_setting_t **setting, const char **name, long long **value); + int (*preHookFunc) (const struct config_setting_t **setting, const char **name, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_pre[hIndex].func; @@ -37153,7 +37153,7 @@ int HP_libconfig_setting_lookup_int64(const struct config_setting_t *setting, co retVal___ = HPMHooks.source.libconfig.setting_lookup_int64(setting, name, value); } if( HPMHooks.count.HP_libconfig_setting_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, long long *value); + int (*postHookFunc) (int retVal___, const struct config_setting_t *setting, const char *name, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, name, value); @@ -37269,11 +37269,11 @@ int HP_libconfig_setting_set_int(struct config_setting_t *setting, int value) { } return retVal___; } -int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long value) { +int HP_libconfig_setting_set_int64(struct config_setting_t *setting, int64 value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_set_int64_pre ) { - int (*preHookFunc) (struct config_setting_t **setting, long long *value); + int (*preHookFunc) (struct config_setting_t **setting, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_pre[hIndex].func; @@ -37288,7 +37288,7 @@ int HP_libconfig_setting_set_int64(struct config_setting_t *setting, long long v retVal___ = HPMHooks.source.libconfig.setting_set_int64(setting, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_post ) { - int (*postHookFunc) (int retVal___, struct config_setting_t *setting, long long value); + int (*postHookFunc) (int retVal___, struct config_setting_t *setting, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, value); @@ -37458,11 +37458,11 @@ int HP_libconfig_setting_get_int_elem(const struct config_setting_t *setting, in } return retVal___; } -long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { +int64 HP_libconfig_setting_get_int64_elem(const struct config_setting_t *setting, int idx) { int hIndex = 0; - long long retVal___ = 0; + int64 retVal___ = 0; if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre ) { - long long (*preHookFunc) (const struct config_setting_t **setting, int *idx); + int64 (*preHookFunc) (const struct config_setting_t **setting, int *idx); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_pre[hIndex].func; @@ -37477,7 +37477,7 @@ long long HP_libconfig_setting_get_int64_elem(const struct config_setting_t *set retVal___ = HPMHooks.source.libconfig.setting_get_int64_elem(setting, idx); } if( HPMHooks.count.HP_libconfig_setting_get_int64_elem_post ) { - long long (*postHookFunc) (long long retVal___, const struct config_setting_t *setting, int idx); + int64 (*postHookFunc) (int64 retVal___, const struct config_setting_t *setting, int idx); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_get_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_get_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx); @@ -37593,11 +37593,11 @@ struct config_setting_t* HP_libconfig_setting_set_int_elem(struct config_setting } return retVal___; } -struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, long long value) { +struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setting_t *setting, int idx, int64 value) { int hIndex = 0; struct config_setting_t* retVal___ = NULL; if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre ) { - struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, long long *value); + struct config_setting_t* (*preHookFunc) (struct config_setting_t **setting, int *idx, int64 *value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_pre[hIndex].func; @@ -37612,7 +37612,7 @@ struct config_setting_t* HP_libconfig_setting_set_int64_elem(struct config_setti retVal___ = HPMHooks.source.libconfig.setting_set_int64_elem(setting, idx, value); } if( HPMHooks.count.HP_libconfig_setting_set_int64_elem_post ) { - struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, long long value); + struct config_setting_t* (*postHookFunc) (struct config_setting_t* retVal___, struct config_setting_t *setting, int idx, int64 value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_setting_set_int64_elem_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_setting_set_int64_elem_post[hIndex].func; retVal___ = postHookFunc(retVal___, setting, idx, value); @@ -37970,11 +37970,11 @@ int HP_libconfig_lookup_int(const struct config_t *config, const char *filepath, } return retVal___; } -int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, long long *value) { +int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepath, int64 *value) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_libconfig_lookup_int64_pre ) { - int (*preHookFunc) (const struct config_t **config, const char **filepath, long long **value); + int (*preHookFunc) (const struct config_t **config, const char **filepath, int64 **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_pre[hIndex].func; @@ -37989,7 +37989,7 @@ int HP_libconfig_lookup_int64(const struct config_t *config, const char *filepat retVal___ = HPMHooks.source.libconfig.lookup_int64(config, filepath, value); } if( HPMHooks.count.HP_libconfig_lookup_int64_post ) { - int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, long long *value); + int (*postHookFunc) (int retVal___, const struct config_t *config, const char *filepath, int64 *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_lookup_int64_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_libconfig_lookup_int64_post[hIndex].func; retVal___ = postHookFunc(retVal___, config, filepath, value); @@ -39298,379 +39298,6 @@ bool HP_mail_invalid_operation(struct map_session_data *sd) { } return retVal___; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* map_interface */ void HP_map_zone_init(void) { int hIndex = 0; @@ -44185,14 +43812,14 @@ void HP_md5_string(const char *string, char *output) { } return; } -void HP_md5_binary(const char *string, unsigned char *output) { +void HP_md5_binary(const uint8 *buf, const int buf_size, uint8 *output) { int hIndex = 0; if( HPMHooks.count.HP_md5_binary_pre ) { - void (*preHookFunc) (const char **string, unsigned char **output); + void (*preHookFunc) (const uint8 **buf, const int *buf_size, uint8 **output); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_md5_binary_pre[hIndex].func; - preHookFunc(&string, &output); + preHookFunc(&buf, &buf_size, &output); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -44200,13 +43827,13 @@ void HP_md5_binary(const char *string, unsigned char *output) { } } { - HPMHooks.source.md5.binary(string, output); + HPMHooks.source.md5.binary(buf, buf_size, output); } if( HPMHooks.count.HP_md5_binary_post ) { - void (*postHookFunc) (const char *string, unsigned char *output); + void (*postHookFunc) (const uint8 *buf, const int buf_size, uint8 *output); for(hIndex = 0; hIndex < HPMHooks.count.HP_md5_binary_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_md5_binary_post[hIndex].func; - postHookFunc(string, output); + postHookFunc(buf, buf_size, output); } } return; @@ -53203,15 +52830,15 @@ struct map_session_data* HP_pc_get_dummy_sd(void) { } return retVal___; } -int HP_pc_class2idx(int class_) { +int HP_pc_class2idx(int class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_pc_class2idx_pre ) { - int (*preHookFunc) (int *class_); + int (*preHookFunc) (int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_class2idx_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_class2idx_pre[hIndex].func; - retVal___ = preHookFunc(&class_); + retVal___ = preHookFunc(&class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -53219,13 +52846,13 @@ int HP_pc_class2idx(int class_) { } } { - retVal___ = HPMHooks.source.pc.class2idx(class_); + retVal___ = HPMHooks.source.pc.class2idx(class); } if( HPMHooks.count.HP_pc_class2idx_post ) { - int (*postHookFunc) (int retVal___, int class_); + int (*postHookFunc) (int retVal___, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_class2idx_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_class2idx_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class_); + retVal___ = postHookFunc(retVal___, class); } } return retVal___; @@ -55950,15 +55577,15 @@ int HP_pc_percentheal(struct map_session_data *sd, int hp, int sp) { } return retVal___; } -int HP_pc_jobchange(struct map_session_data *sd, int job, int upper) { +int HP_pc_jobchange(struct map_session_data *sd, int class, int upper) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_pc_jobchange_pre ) { - int (*preHookFunc) (struct map_session_data **sd, int *job, int *upper); + int (*preHookFunc) (struct map_session_data **sd, int *class, int *upper); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobchange_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_jobchange_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &job, &upper); + retVal___ = preHookFunc(&sd, &class, &upper); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -55966,13 +55593,13 @@ int HP_pc_jobchange(struct map_session_data *sd, int job, int upper) { } } { - retVal___ = HPMHooks.source.pc.jobchange(sd, job, upper); + retVal___ = HPMHooks.source.pc.jobchange(sd, class, upper); } if( HPMHooks.count.HP_pc_jobchange_post ) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int job, int upper); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class, int upper); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobchange_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_jobchange_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, job, upper); + retVal___ = postHookFunc(retVal___, sd, class, upper); } } return retVal___; @@ -56939,15 +56566,15 @@ int HP_pc_candrop(struct map_session_data *sd, struct item *item) { } return retVal___; } -int HP_pc_jobid2mapid(unsigned short b_class) { +int HP_pc_jobid2mapid(int16 class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_pc_jobid2mapid_pre ) { - int (*preHookFunc) (unsigned short *b_class); + int (*preHookFunc) (int16 *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobid2mapid_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_jobid2mapid_pre[hIndex].func; - retVal___ = preHookFunc(&b_class); + retVal___ = preHookFunc(&class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -56955,13 +56582,13 @@ int HP_pc_jobid2mapid(unsigned short b_class) { } } { - retVal___ = HPMHooks.source.pc.jobid2mapid(b_class); + retVal___ = HPMHooks.source.pc.jobid2mapid(class); } if( HPMHooks.count.HP_pc_jobid2mapid_post ) { - int (*postHookFunc) (int retVal___, unsigned short b_class); + int (*postHookFunc) (int retVal___, int16 class); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_jobid2mapid_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_jobid2mapid_post[hIndex].func; - retVal___ = postHookFunc(retVal___, b_class); + retVal___ = postHookFunc(retVal___, class); } } return retVal___; @@ -56993,15 +56620,15 @@ int HP_pc_mapid2jobid(unsigned short class_, int sex) { } return retVal___; } -const char* HP_pc_job_name(int class_) { +const char* HP_pc_job_name(int class) { int hIndex = 0; const char* retVal___ = NULL; if( HPMHooks.count.HP_pc_job_name_pre ) { - const char* (*preHookFunc) (int *class_); + const char* (*preHookFunc) (int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_job_name_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_job_name_pre[hIndex].func; - retVal___ = preHookFunc(&class_); + retVal___ = preHookFunc(&class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -57009,13 +56636,13 @@ const char* HP_pc_job_name(int class_) { } } { - retVal___ = HPMHooks.source.pc.job_name(class_); + retVal___ = HPMHooks.source.pc.job_name(class); } if( HPMHooks.count.HP_pc_job_name_post ) { - const char* (*postHookFunc) (const char* retVal___, int class_); + const char* (*postHookFunc) (const char* retVal___, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_job_name_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_job_name_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class_); + retVal___ = postHookFunc(retVal___, class); } } return retVal___; @@ -57153,14 +56780,14 @@ int HP_pc_getmaxspiritball(struct map_session_data *sd, int min) { } return retVal___; } -void HP_pc_addfame(struct map_session_data *sd, int count) { +void HP_pc_addfame(struct map_session_data *sd, int ranktype, int count) { int hIndex = 0; if( HPMHooks.count.HP_pc_addfame_pre ) { - void (*preHookFunc) (struct map_session_data **sd, int *count); + void (*preHookFunc) (struct map_session_data **sd, int *ranktype, int *count); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_addfame_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_addfame_pre[hIndex].func; - preHookFunc(&sd, &count); + preHookFunc(&sd, &ranktype, &count); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -57168,26 +56795,26 @@ void HP_pc_addfame(struct map_session_data *sd, int count) { } } { - HPMHooks.source.pc.addfame(sd, count); + HPMHooks.source.pc.addfame(sd, ranktype, count); } if( HPMHooks.count.HP_pc_addfame_post ) { - void (*postHookFunc) (struct map_session_data *sd, int count); + void (*postHookFunc) (struct map_session_data *sd, int ranktype, int count); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_addfame_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_addfame_post[hIndex].func; - postHookFunc(sd, count); + postHookFunc(sd, ranktype, count); } } return; } -unsigned char HP_pc_famerank(int char_id, int job) { +int HP_pc_fame_rank(int char_id, int ranktype) { int hIndex = 0; - unsigned char retVal___ = 0; - if( HPMHooks.count.HP_pc_famerank_pre ) { - unsigned char (*preHookFunc) (int *char_id, int *job); + int retVal___ = 0; + if( HPMHooks.count.HP_pc_fame_rank_pre ) { + int (*preHookFunc) (int *char_id, int *ranktype); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_famerank_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_pc_famerank_pre[hIndex].func; - retVal___ = preHookFunc(&char_id, &job); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_fame_rank_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_fame_rank_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &ranktype); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -57195,13 +56822,40 @@ unsigned char HP_pc_famerank(int char_id, int job) { } } { - retVal___ = HPMHooks.source.pc.famerank(char_id, job); + retVal___ = HPMHooks.source.pc.fame_rank(char_id, ranktype); } - if( HPMHooks.count.HP_pc_famerank_post ) { - unsigned char (*postHookFunc) (unsigned char retVal___, int char_id, int job); - for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_famerank_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_pc_famerank_post[hIndex].func; - retVal___ = postHookFunc(retVal___, char_id, job); + if( HPMHooks.count.HP_pc_fame_rank_post ) { + int (*postHookFunc) (int retVal___, int char_id, int ranktype); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_fame_rank_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_fame_rank_post[hIndex].func; + retVal___ = postHookFunc(retVal___, char_id, ranktype); + } + } + return retVal___; +} +int HP_pc_famelist_type(uint16 job_mapid) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_pc_famelist_type_pre ) { + int (*preHookFunc) (uint16 *job_mapid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_famelist_type_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_famelist_type_pre[hIndex].func; + retVal___ = preHookFunc(&job_mapid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.famelist_type(job_mapid); + } + if( HPMHooks.count.HP_pc_famelist_type_post ) { + int (*postHookFunc) (int retVal___, uint16 job_mapid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_famelist_type_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_famelist_type_post[hIndex].func; + retVal___ = postHookFunc(retVal___, job_mapid); } } return retVal___; @@ -57393,15 +57047,15 @@ void HP_pc_inventory_rental_add(struct map_session_data *sd, int seconds) { } return; } -int HP_pc_disguise(struct map_session_data *sd, int class_) { +int HP_pc_disguise(struct map_session_data *sd, int class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_pc_disguise_pre ) { - int (*preHookFunc) (struct map_session_data **sd, int *class_); + int (*preHookFunc) (struct map_session_data **sd, int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_disguise_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_disguise_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &class_); + retVal___ = preHookFunc(&sd, &class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -57409,13 +57063,13 @@ int HP_pc_disguise(struct map_session_data *sd, int class_) { } } { - retVal___ = HPMHooks.source.pc.disguise(sd, class_); + retVal___ = HPMHooks.source.pc.disguise(sd, class); } if( HPMHooks.count.HP_pc_disguise_post ) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class_); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_disguise_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_disguise_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, class_); + retVal___ = postHookFunc(retVal___, sd, class); } } return retVal___; @@ -58671,15 +58325,15 @@ void HP_pc_expire_check(struct map_session_data *sd) { } return; } -bool HP_pc_db_checkid(unsigned int class_) { +bool HP_pc_db_checkid(int class) { int hIndex = 0; bool retVal___ = false; if( HPMHooks.count.HP_pc_db_checkid_pre ) { - bool (*preHookFunc) (unsigned int *class_); + bool (*preHookFunc) (int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_db_checkid_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_db_checkid_pre[hIndex].func; - retVal___ = preHookFunc(&class_); + retVal___ = preHookFunc(&class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -58687,13 +58341,13 @@ bool HP_pc_db_checkid(unsigned int class_) { } } { - retVal___ = HPMHooks.source.pc.db_checkid(class_); + retVal___ = HPMHooks.source.pc.db_checkid(class); } if( HPMHooks.count.HP_pc_db_checkid_post ) { - bool (*postHookFunc) (bool retVal___, unsigned int class_); + bool (*postHookFunc) (bool retVal___, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_db_checkid_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_db_checkid_post[hIndex].func; - retVal___ = postHookFunc(retVal___, class_); + retVal___ = postHookFunc(retVal___, class); } } return retVal___; @@ -59020,6 +58674,33 @@ void HP_pc_check_supernovice_call(struct map_session_data *sd, const char *messa } return; } +bool HP_pc_check_basicskill(struct map_session_data *sd, int level) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_pc_check_basicskill_pre ) { + bool (*preHookFunc) (struct map_session_data **sd, int *level); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_basicskill_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_check_basicskill_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &level); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.check_basicskill(sd, level); + } + if( HPMHooks.count.HP_pc_check_basicskill_post ) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int level); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_basicskill_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_check_basicskill_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, level); + } + } + return retVal___; +} /* pcre_interface */ pcre* HP_libpcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr) { int hIndex = 0; @@ -67257,15 +66938,15 @@ int HP_skill_get_cooldown(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_tree_get_max(uint16 skill_id, int b_class) { +int HP_skill_tree_get_max(uint16 skill_id, int class) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_skill_tree_get_max_pre ) { - int (*preHookFunc) (uint16 *skill_id, int *b_class); + int (*preHookFunc) (uint16 *skill_id, int *class); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_skill_tree_get_max_pre[hIndex].func; - retVal___ = preHookFunc(&skill_id, &b_class); + retVal___ = preHookFunc(&skill_id, &class); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -67273,13 +66954,13 @@ int HP_skill_tree_get_max(uint16 skill_id, int b_class) { } } { - retVal___ = HPMHooks.source.skill.tree_get_max(skill_id, b_class); + retVal___ = HPMHooks.source.skill.tree_get_max(skill_id, class); } if( HPMHooks.count.HP_skill_tree_get_max_post ) { - int (*postHookFunc) (int retVal___, uint16 skill_id, int b_class); + int (*postHookFunc) (int retVal___, uint16 skill_id, int class); for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_skill_tree_get_max_post[hIndex].func; - retVal___ = postHookFunc(retVal___, skill_id, b_class); + retVal___ = postHookFunc(retVal___, skill_id, class); } } return retVal___; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 54861ed6f..4cd69d005 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,6 @@ memcpy(&HPMHooks.source.itemdb, itemdb, sizeof(struct itemdb_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.logs, logs, sizeof(struct log_interface)); memcpy(&HPMHooks.source.mail, mail, sizeof(struct mail_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.map, map, sizeof(struct map_interface)); memcpy(&HPMHooks.source.mapindex, mapindex, sizeof(struct mapindex_interface)); memcpy(&HPMHooks.source.mapit, mapit, sizeof(struct mapit_interface)); diff --git a/src/plugins/dbghelpplug.c b/src/plugins/dbghelpplug.c index cf8be0901..78517419f 100644 --- a/src/plugins/dbghelpplug.c +++ b/src/plugins/dbghelpplug.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify diff --git a/src/test/Makefile.in b/src/test/Makefile.in index c8006e5cf..3e7549943 100644 --- a/src/test/Makefile.in +++ b/src/test/Makefile.in @@ -87,8 +87,8 @@ $(TESTS_ALL): test_%: ../../test_%@EXEEXT@ ../../test_%@EXEEXT@: obj/test_%.o $(TEST_DEPENDS) Makefile @echo " LD $(notdir $@)" - @$(CC) @STATIC@ @LDFLAGS@ -o $@ $< $(COMMON_D)/obj_sql/common_sql.a \ - $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ + @$(CC) @STATIC@ @LDFLAGS@ -o $@ $< $(COMMON_D)/obj_all/common.a $(COMMON_D)/obj_sql/common_sql.a \ + $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ # object files diff --git a/src/test/test_libconfig.c b/src/test/test_libconfig.c index e0a470e21..e1a767195 100644 --- a/src/test/test_libconfig.c +++ b/src/test/test_libconfig.c @@ -86,6 +86,8 @@ static const char *test_libconfig_init_destroy(void) static const char *test_libconfig_read_file_src(void) { struct config_t config; + libconfig->init(&config); + #define FILENAME "src/test/libconfig/test.conf" if (libconfig->read_file_src(&config, FILENAME) == CONFIG_FALSE) { libconfig->destroy(&config); @@ -108,6 +110,9 @@ static const char *test_libconfig_read(void) if (!fp) { return "File not found: '" FILENAME "'."; } + + libconfig->init(&config); + if (libconfig->read(&config, fp) == CONFIG_FALSE) { fclose(fp); libconfig->destroy(&config); @@ -154,6 +159,8 @@ static const char *test_libconfig_write_file(void) static const char *test_libconfig_read_string(void) { struct config_t config; + libconfig->init(&config); + if (libconfig->read_string(&config, "") == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to read from string."; @@ -180,6 +187,8 @@ static const char *test_libconfig_syntax(void) "Setting_List: ( );\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to read from string."; @@ -216,6 +225,8 @@ static const char *test_libconfig_lookup(void) "Setting_List: ( );\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -278,6 +289,8 @@ static const char *test_libconfig_setting_get(void) "Setting_List: ( );\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -366,8 +379,8 @@ static const char *test_libconfig_setting_get(void) static const char *test_libconfig_set(void) { - //int (*setting_set_int) (struct config_setting_t *setting ,int value); - //int (*setting_set_int64) (struct config_setting_t *setting, long long value); + //int (*setting_set_int) (struct config_setting_t *setting, int value); + //int (*setting_set_int64) (struct config_setting_t *setting, int64 value); //int (*setting_set_float) (struct config_setting_t *setting, double value); //int (*setting_set_bool) (struct config_setting_t *setting, int value); //int (*setting_set_string) (struct config_setting_t *setting, const char *value); @@ -392,6 +405,8 @@ static const char *test_libconfig_setting_lookup(void) "Setting_List: ( );\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -442,6 +457,8 @@ static const char *test_libconfig_setting_types(void) "Setting_List: ( );\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -536,6 +553,8 @@ static const char *test_libconfig_values(void) "Setting_IntSignedMax: 0x7fffffff;\n" "/* End test file */\n"; + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -599,6 +618,9 @@ static const char *test_libconfig_path_lookup(void) " 10,\n" ");\n" "/* End test file */\n"; + + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -669,28 +691,34 @@ static const char *test_libconfig_setting_names(void) struct config_t config; int32 i32; const char *input = "/* Test File */\n" - "Setting'with'apostrophes: 1;\n" + "1st_setting_with_numbers: 1;\n" "Setting.with.periods: 2;\n" "Setting: {\n" " with: {\n" " periods: 3;\n" + " 2nested: {\n" + " numbers1: 4;\n" + " };\n" " };\n" " nested: {\n" " in: {\n" - " groups: 4;\n" + " groups: 5;\n" " };\n" " };\n" "};\n" - "1st_setting_with_numbers: 5;\n" + "Setting_with_2_numbers_000: 6;\n" "/* End test file */\n"; + + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; } - if (libconfig->lookup_int(&config, "Setting'with'apostrophes", &i32) == CONFIG_FALSE || i32 != 1) { + if (libconfig->lookup_int(&config, "1st_setting_with_numbers", &i32) == CONFIG_FALSE || i32 != 1) { libconfig->destroy(&config); - return "Setting'with'apostrophes failed."; + return "1st_setting_with_numbers failed."; } if (libconfig->lookup_int(&config, "Setting.with.periods", &i32) == CONFIG_FALSE || i32 != 2) { @@ -703,19 +731,24 @@ static const char *test_libconfig_setting_names(void) return "Setting:with:periods failed."; } - if (libconfig->lookup_int(&config, "Setting:nested:in:groups", &i32) == CONFIG_FALSE || i32 != 4) { + if (libconfig->lookup_int(&config, "Setting/with/2nested/numbers1", &i32) == CONFIG_FALSE || i32 != 4) { + libconfig->destroy(&config); + return "Setting/with/2nested/numbers1 failed."; + } + + if (libconfig->lookup_int(&config, "Setting:nested:in:groups", &i32) == CONFIG_FALSE || i32 != 5) { libconfig->destroy(&config); return "Setting:nested:in:groups failed."; } - if (libconfig->lookup_int(&config, "Setting/nested/in/groups", &i32) == CONFIG_FALSE || i32 != 4) { + if (libconfig->lookup_int(&config, "Setting/nested/in/groups", &i32) == CONFIG_FALSE || i32 != 5) { libconfig->destroy(&config); return "Setting/nested/in/groups failed."; } - if (libconfig->lookup_int(&config, "1st_setting_with_numbers", &i32) == CONFIG_FALSE || i32 != 5) { + if (libconfig->lookup_int(&config, "Setting_with_2_numbers_000", &i32) == CONFIG_FALSE || i32 != 6) { libconfig->destroy(&config); - return "1st_setting_with_numbers failed."; + return "Setting_with_2_numbers_000 failed."; } libconfig->destroy(&config); @@ -736,6 +769,9 @@ static const char *test_libconfig_duplicate_keys(void) " Duplicate: 4;\n" "};\n" "/* End test file */\n"; + + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -780,6 +816,9 @@ static const char *test_libconfig_special_string_syntax(void) const char *input = "/* Test File */\n" "SpecialString: <\"This is an \"Item_Script\" Special String\n\tWith a line-break inside.\">;\n" "/* End test file */\n"; + + libconfig->init(&config); + if (libconfig->read_string(&config, input) == CONFIG_FALSE) { libconfig->destroy(&config); return "Unable to parse configuration."; @@ -818,7 +857,7 @@ int do_init(int argc, char **argv) //int (*setting_set_format) (struct config_setting_t *setting, short format); //short (*setting_get_format) (const struct config_setting_t *setting); //struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); - //struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + //struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, int64 value); //struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); //struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); //struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); diff --git a/src/test/test_spinlock.c b/src/test/test_spinlock.c index 34102a845..1c0390d66 100644 --- a/src/test/test_spinlock.c +++ b/src/test/test_spinlock.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -81,6 +81,7 @@ int do_init(int argc, char **argv) for(i =0; i < THRC; i++){ t[i] = thread->create_opt(worker, NULL, 1024*512, THREADPRIO_NORMAL); } + (void)t; while(1){ if(InterlockedCompareExchange(&done_threads, THRC, THRC) == THRC) @@ -100,14 +101,13 @@ int do_init(int argc, char **argv) } - if(ok != LOOPS){ + if (ok != LOOPS) { ShowFatalError("Test failed.\n"); exit(1); - }else{ - ShowStatus("Test passed.\n"); - exit(0); } - return 0; + + core->runflag = CORE_ST_STOP; + return EXIT_SUCCESS; }//end: do_init() void do_abort(void) { @@ -118,6 +118,8 @@ void set_server_type(void) { }//end: set_server_type() int do_final(void) { + ShowStatus("Test passed.\n"); + return EXIT_SUCCESS; }//end: do_final() diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in index eb1362780..6e8643c56 100644 --- a/src/tool/Makefile.in +++ b/src/tool/Makefile.in @@ -39,7 +39,7 @@ LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \ MAPCACHE_OBJ = obj_all/mapcache.o MAPCACHE_C = mapcache.c MAPCACHE_H = -MAPCACHE_DEPENDS = $(MAPCACHE_OBJ) $(COMMON_D)/obj_all/common_mini.a $(LIBCONFIG_OBJ $(SYSINFO_INC)) +MAPCACHE_DEPENDS = $(MAPCACHE_OBJ) $(COMMON_D)/obj_all/common_mini.a $(LIBCONFIG_OBJ) $(SYSINFO_INC) @SET_MAKE@ @@ -55,7 +55,7 @@ mapcache: ../../mapcache@EXEEXT@ ../../mapcache@EXEEXT@: $(MAPCACHE_DEPENDS) Makefile @echo " LD $(notdir $@)" - @$(CC) @STATIC@ @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_DEPENDS) @LIBS@ + @$(CC) @STATIC@ @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_D)/obj_all/common_mini.a $(LIBCONFIG_OBJ) @LIBS@ buildclean: @echo " CLEAN tool (build temp files)" diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c index 7bb2f4465..5eb0843aa 100644 --- a/src/tool/mapcache.c +++ b/src/tool/mapcache.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify |