summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/Makefile.in6
-rw-r--r--src/char/char.c71
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/geoip.c2
-rw-r--r--src/char/geoip.h2
-rw-r--r--src/char/int_auction.c2
-rw-r--r--src/char/int_auction.h2
-rw-r--r--src/char/int_elemental.h2
-rw-r--r--src/char/int_guild.h2
-rw-r--r--src/char/int_homun.h2
-rw-r--r--src/char/int_mail.c2
-rw-r--r--src/char/int_mail.h2
-rw-r--r--src/char/int_mercenary.h2
-rw-r--r--src/char/int_party.h2
-rw-r--r--src/char/int_pet.h2
-rw-r--r--src/char/int_quest.c4
-rw-r--r--src/char/int_quest.h2
-rw-r--r--src/char/int_storage.c2
-rw-r--r--src/char/int_storage.h2
-rw-r--r--src/char/inter.c3
-rw-r--r--src/char/loginif.c2
-rw-r--r--src/char/loginif.h2
-rw-r--r--src/char/mapif.c2
-rw-r--r--src/char/mapif.h2
-rw-r--r--src/common/HPM.c51
-rw-r--r--src/common/HPMSymbols.inc.h6
-rw-r--r--src/common/HPMi.h1
-rw-r--r--src/common/atomic.h2
-rw-r--r--src/common/cbasetypes.h21
-rw-r--r--src/common/conf.c88
-rw-r--r--src/common/conf.h16
-rw-r--r--src/common/console.c45
-rw-r--r--src/common/core.c39
-rw-r--r--src/common/core.h2
-rw-r--r--src/common/db.c28
-rw-r--r--src/common/db.h19
-rw-r--r--src/common/des.c7
-rw-r--r--src/common/ers.c18
-rw-r--r--src/common/ers.h2
-rw-r--r--src/common/grfio.c24
-rw-r--r--src/common/mapindex.c37
-rw-r--r--src/common/mapindex.h2
-rw-r--r--src/common/memmgr.c2
-rw-r--r--src/common/memmgr.h6
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/common/mutex.c12
-rw-r--r--src/common/nullpo.c2
-rw-r--r--src/common/nullpo.h2
-rw-r--r--src/common/showmsg.c2
-rw-r--r--src/common/showmsg.h2
-rw-r--r--src/common/socket.c44
-rw-r--r--src/common/socket.h2
-rw-r--r--src/common/sql.c35
-rw-r--r--src/common/strlib.c1
-rw-r--r--src/common/sysinfo.c84
-rw-r--r--src/common/timer.c6
-rw-r--r--src/common/timer.h2
-rw-r--r--src/common/utils.c31
-rw-r--r--src/common/utils.h2
-rw-r--r--src/common/winapi.h2
-rw-r--r--src/config/classes/general.h2
-rw-r--r--src/config/const.h2
-rw-r--r--src/config/core.h2
-rw-r--r--src/config/renewal.h2
-rw-r--r--src/config/secure.h2
-rw-r--r--src/login/Makefile.in6
-rw-r--r--src/map/Makefile.in6
-rw-r--r--src/map/atcommand.h2
-rw-r--r--src/map/battle.c85
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/battleground.c12
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/buyingstore.c4
-rw-r--r--src/map/buyingstore.h2
-rw-r--r--src/map/chat.c2
-rw-r--r--src/map/chat.h2
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/clif.c466
-rw-r--r--src/map/clif.h7
-rw-r--r--src/map/date.c2
-rw-r--r--src/map/date.h2
-rw-r--r--src/map/duel.c2
-rw-r--r--src/map/duel.h2
-rw-r--r--src/map/elemental.c2
-rw-r--r--src/map/elemental.h2
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/homunculus.h2
-rw-r--r--src/map/instance.c2
-rw-r--r--src/map/instance.h2
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/itemdb.c31
-rw-r--r--src/map/itemdb.h30
-rw-r--r--src/map/mail.c2
-rw-r--r--src/map/mail.h2
-rw-r--r--src/map/map.c28
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/mercenary.c2
-rw-r--r--src/map/mercenary.h2
-rw-r--r--src/map/mob.c9
-rw-r--r--src/map/mob.h2
-rw-r--r--src/map/npc.c51
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/npc_chat.c4
-rw-r--r--src/map/packets.h369
-rw-r--r--src/map/party.c16
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/path.c4
-rw-r--r--src/map/path.h2
-rw-r--r--src/map/pc.c51
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/pc_groups.c9
-rw-r--r--src/map/pc_groups.h2
-rw-r--r--src/map/pet.c28
-rw-r--r--src/map/pet.h2
-rw-r--r--src/map/quest.c13
-rw-r--r--src/map/quest.h2
-rw-r--r--src/map/script.c356
-rw-r--r--src/map/script.h11
-rw-r--r--src/map/searchstore.c69
-rw-r--r--src/map/searchstore.h2
-rw-r--r--src/map/skill.c764
-rw-r--r--src/map/skill.h53
-rw-r--r--src/map/status.c524
-rw-r--r--src/map/status.h34
-rw-r--r--src/map/storage.c55
-rw-r--r--src/map/storage.h2
-rw-r--r--src/map/trade.c26
-rw-r--r--src/map/trade.h2
-rw-r--r--src/map/unit.c121
-rw-r--r--src/map/unit.h2
-rw-r--r--src/map/vending.c39
-rw-r--r--src/map/vending.h2
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc76
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc57
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc15
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc425
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.sources.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc57
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc15
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.Hooks.inc413
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.sources.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc77
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc20
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc571
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.sources.inc1
-rw-r--r--src/plugins/db2sql.c2
-rw-r--r--src/plugins/dbghelpplug.c2
-rw-r--r--src/test/Makefile.in4
-rw-r--r--src/test/test_libconfig.c63
-rw-r--r--src/test/test_spinlock.c14
-rw-r--r--src/tool/Makefile.in4
-rw-r--r--src/tool/mapcache.c2
156 files changed, 3477 insertions, 2486 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..d69ea0d53 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -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, short starting_job)
{
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_job) {
+ 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_job, 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_job, 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_job, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color))
Sql_ShowDebug(inter->sql_handle);
}
@@ -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 */
@@ -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 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.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.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 cf93db51e..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
@@ -182,7 +182,7 @@ bool mapif_quest_update(int char_id, struct quest qd)
int i;
StrBuf->Init(&buf);
- StrBuf->Printf(&buf, "UPDATE `%s` SET `state`='%u'", quest_db, qd.state);
+ StrBuf->Printf(&buf, "UPDATE `%s` SET `state`='%u', `time`='%u'", quest_db, qd.state, qd.time);
for (i = 0; i < MAX_QUEST_OBJECTIVES; i++) {
StrBuf->Printf(&buf, ", `count%d`='%d'", i+1, qd.count[i]);
}
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..fd3fe8c16 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -389,6 +389,9 @@ const char* inter_job_name(int 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"
}
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..0c0a68654 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
diff --git a/src/char/mapif.h b/src/char/mapif.h
index 37d9444e2..7f1d53b3e 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
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/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 7ccb960de..8dd0f1cd7 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -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 d3db86543..8c3b5ad04 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
@@ -291,12 +291,19 @@ typedef uintptr_t uintptr;
#define GCC_VERSION 0
#endif
-// Pragma macro only enabled on gcc >= 4.5 or clang - borrowed from Mana Plus
-#if defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500)
-#define PRAGMA_GCC45(str) _Pragma(#str)
-#else // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500)
-#define PRAGMA_GCC45(str)
-#endif // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500)
+// Pragma macro only enabled on gcc >= 4.6 or clang - borrowed from Mana Plus
+#if defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40600)
+#define PRAGMA_GCC46(str) _Pragma(#str)
+#else // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40600)
+#define PRAGMA_GCC46(str)
+#endif // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40600)
+
+// fallthrough attribute only enabled on gcc >= 7.0
+#if defined(__GNUC__) && (GCC_VERSION >= 70000)
+#define FALLTHROUGH __attribute__ ((fallthrough));
+#else // ! defined(__GNUC__) && (GCC_VERSION >= 70000)
+#define FALLTHROUGH
+#endif // ! defined(__GNUC__) && (GCC_VERSION >= 70000)
// boolean types for C
#if !defined(_MSC_VER) || _MSC_VER >= 1800
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..74c63a6d6 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,6 +397,8 @@ 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;
@@ -423,6 +441,7 @@ int cmdline_exec(int argc, char **argv, unsigned int options)
}
return count;
}
+
/**
* Defines the global command-line arguments.
*/
@@ -466,10 +485,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 bbcac4b33..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"
@@ -2418,6 +2419,7 @@ enum DBOptions db_fix_options(enum DBType type, enum DBOptions options)
default:
ShowError("db_fix_options: Unknown database type %u with options %x\n", type, options);
+ FALLTHROUGH
case DB_STRING:
case DB_ISTRING: // String databases, no fix required
return options;
@@ -2794,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);
@@ -2906,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 ;
@@ -2927,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;
@@ -2940,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;
@@ -2972,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;
@@ -2994,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;
@@ -3021,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 ;
@@ -3033,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;
@@ -3054,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/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..93151d3ca 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
@@ -993,6 +993,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 cee2875d5..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
@@ -892,13 +897,12 @@ int do_sockets(int next)
#ifdef SEND_SHORTLIST
send_shortlist_do_sends();
#else // SEND_SHORTLIST
- for (i = 1; i < sockt->fd_max; i++)
- {
- if(!sockt->session[fd]
+ for (i = 1; i < sockt->fd_max; i++) {
+ if (sockt->session[i] == NULL)
continue;
- if(sockt->session[fd]>wdata_size)
- sockt->session[fd]>func_send(i);
+ if (sockt->session[i]->wdata_size > 0)
+ sockt->session[i]->func_send(i);
}
#endif // SEND_SHORTLIST
@@ -1019,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])
@@ -1200,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;
@@ -1236,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;
@@ -1737,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;
}
@@ -1772,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[] = {
@@ -2056,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 be0bd43e3..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 )
{
@@ -422,39 +425,48 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
break;
// fixed size
case SQLDT_UINT8: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_INT8: bind->buffer_type = MYSQL_TYPE_TINY;
buffer_len = 1;
break;
case SQLDT_UINT16: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_INT16: bind->buffer_type = MYSQL_TYPE_SHORT;
buffer_len = 2;
break;
case SQLDT_UINT32: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_INT32: bind->buffer_type = MYSQL_TYPE_LONG;
buffer_len = 4;
break;
case SQLDT_UINT64: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_INT64: bind->buffer_type = MYSQL_TYPE_LONGLONG;
buffer_len = 8;
break;
// platform dependent size
case SQLDT_UCHAR: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_CHAR: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(char));
buffer_len = sizeof(char);
break;
case SQLDT_USHORT: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_SHORT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(short));
buffer_len = sizeof(short);
break;
case SQLDT_UINT: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_INT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int));
buffer_len = sizeof(int);
break;
case SQLDT_ULONG: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_LONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long));
buffer_len = sizeof(long);
break;
case SQLDT_ULONGLONG: bind->is_unsigned = 1;
+ FALLTHROUGH
case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int64));
buffer_len = sizeof(int64);
break;
@@ -485,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) {
@@ -526,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);
@@ -655,8 +669,8 @@ int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_
if (idx >= self->max_params)
return SQL_SUCCESS; // out of range - ignore
-PRAGMA_GCC45(GCC diagnostic push)
-PRAGMA_GCC45(GCC diagnostic ignored "-Wcast-qual")
+PRAGMA_GCC46(GCC diagnostic push)
+PRAGMA_GCC46(GCC diagnostic ignored "-Wcast-qual")
/*
* MySQL uses the same struct with a non-const buffer for both
* parameters (input) and columns (output).
@@ -664,7 +678,7 @@ PRAGMA_GCC45(GCC diagnostic ignored "-Wcast-qual")
* dropping a const qualifier here.
*/
return Sql_P_BindSqlDataType(self->params+idx, buffer_type, (void *)buffer, buffer_len, NULL, NULL);
-PRAGMA_GCC45(GCC diagnostic pop)
+PRAGMA_GCC46(GCC diagnostic pop)
}
/// Executes the prepared statement.
@@ -865,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 ) {
@@ -1032,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(&timestamp));
+ size_t len;
+ nullpo_retr(NULL, str);
+ len = strftime(str, size, format, localtime(&timestamp));
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.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 01072702d..8c1a3f364 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -693,6 +693,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
#ifdef RENEWAL
if((skill_lv = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill_lv * 3);
+ FALLTHROUGH
#endif
case W_DAGGER:
if((skill_lv = pc->checkskill(sd,SM_SWORD)) > 0)
@@ -737,6 +738,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
if((skill_lv = pc->checkskill(sd,TK_RUN)) > 0)
damage += (skill_lv * 10);
// No break, fall through to Knuckles
+ FALLTHROUGH
case W_KNUCKLE:
if((skill_lv = pc->checkskill(sd,MO_IRONHAND)) > 0)
damage += (skill_lv * 3);
@@ -1664,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);
@@ -1884,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;
@@ -3005,6 +3034,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
case W_WHIP:
if(!t_sd->state.arrow_atk)
break;
+ FALLTHROUGH
case W_BOW:
case W_REVOLVER:
case W_RIFLE:
@@ -3065,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);
@@ -3173,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;
@@ -3673,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) );
@@ -4256,7 +4308,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
switch( skill_id ) {
case RA_FIRINGTRAP:
case RA_ICEBOUNDTRAP:
- if( md.damage == 1 ) break;
+ if (md.damage == 1)
+ break;
+ FALLTHROUGH
case RA_CLUSTERBOMB:
{
struct Damage wd;
@@ -4556,16 +4610,19 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.div_ = 5;
break;
}
+ FALLTHROUGH
case 4:
if( chance < 7){// 6 % chance to attack 4 times.
wd.div_ = 4;
break;
}
+ FALLTHROUGH
case 3:
if( chance < 10){// 9 % chance to attack 3 times.
wd.div_ = 3;
break;
}
+ FALLTHROUGH
case 2:
case 1:
if( chance < 13){// 12 % chance to attack 2 times.
@@ -4619,6 +4676,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(!(sc && sc->data[SC_AUTOCOUNTER]))
break;
status_change_end(src, SC_AUTOCOUNTER, INVALID_TIMER);
+ FALLTHROUGH
case KN_AUTOCOUNTER:
if(battle_config.auto_counter_type &&
(battle_config.auto_counter_type&src->type))
@@ -5074,7 +5132,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.damage = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage, wd.div_, 0, flag.weapon);
wd.damage = battle->calc_cardfix2(src, target, wd.damage, s_ele, nk, wd.flag);
}
- /* Fall through */
+ FALLTHROUGH
#endif
default:
ATK_RATE(battle->calc_skillratio(BF_WEAPON, src, target, skill_id, skill_lv, skillratio, wflag));
@@ -5190,8 +5248,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] &&
@@ -5254,6 +5320,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);
@@ -5999,20 +6068,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();
}
@@ -6546,6 +6613,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case RK_DRAGONBREATH_WATER:
if( !map->list[m].flag.pvp && !map->list[m].flag.gvg )
break;
+ FALLTHROUGH
case 0://you can hit them without skills
case MA_REMOVETRAP:
case HT_REMOVETRAP:
@@ -7250,6 +7318,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..7e7048a38 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -544,6 +544,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 5231ce3d2..4bb2b9b2e 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
@@ -862,11 +862,11 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
count++;
}
if ( count < arena->min_team_players ) {
- char response[117];
+ char response[121];
if( count != sd->guild->connect_member && sd->guild->connect_member >= arena->min_team_players )
- sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d",arena->min_team_players);
+ sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d", arena->min_team_players);
else
- sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d",arena->min_team_players);
+ sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d", arena->min_team_players);
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_TEAM_COUNT;
}
@@ -894,9 +894,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
return BGQA_NOT_PARTY_GUILD_LEADER;
if( count < arena->min_team_players ) {
- char response[117];
+ char response[121];
if( count != p->party.count && p->party.count >= arena->min_team_players )
- sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d",arena->min_team_players);
+ sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d", arena->min_team_players);
else
sprintf(response, "Can't apply: not enough members in your team/party, minimum is %d",arena->min_team_players);
clif->messagecolor_self(sd->fd, COLOR_RED, response);
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 58a1f925f..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
@@ -383,7 +383,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
// notify clients
clif->buyingstore_delete_item(sd, index, amount, pl_sd->buyingstore.items[listidx].price);
- clif->buyingstore_update_item(pl_sd, nameid, amount);
+ clif->buyingstore_update_item(pl_sd, nameid, amount, sd->status.char_id, zeny);
}
if( map->save_settings&128 ) {
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..6e567a402 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
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 ce88b32da..5d9802b57 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1360,6 +1360,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 >= 20110809
nullpo_retv(sd);
WFIFOHEAD(fd, packet_len(0x08cf));
WFIFOW(fd,0) = 0x08cf;
@@ -1367,6 +1368,7 @@ void clif_charm_single(int fd, struct map_session_data *sd)
WFIFOW(fd,6) = sd->charm_type;
WFIFOW(fd,8) = sd->charm_count;
WFIFOSET(fd, packet_len(0x08cf));
+#endif
}
/*==========================================
@@ -1495,6 +1497,15 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
struct status_data *hstatus;
unsigned char buf[128];
enum homun_type htype;
+ int offset = 0;
+
+// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513
+#if PACKETVER < 20150513
+ int cmd = 0x22e;
+#else
+ int cmd = 0x9f7;
+#endif
+ int len = packet_len(cmd);
nullpo_retv(sd);
nullpo_retv(hd);
@@ -1502,65 +1513,75 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
hstatus = &hd->battle_status;
htype = homun->class2type(hd->homunculus.class_);
- memset(buf,0,packet_len(0x22e));
- WBUFW(buf,0)=0x22e;
- memcpy(WBUFP(buf,2),hd->homunculus.name,NAME_LENGTH);
+ memset(buf, 0, len);
+ WBUFW(buf, 0) = cmd;
+ memcpy(WBUFP(buf, 2), hd->homunculus.name, NAME_LENGTH);
// Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
- WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0);
- WBUFW(buf,27)=hd->homunculus.level;
- WBUFW(buf,29)=hd->homunculus.hunger;
- WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ;
- WBUFW(buf,33)=0; // equip id
+ WBUFB(buf, 26) = (!battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0);
+ WBUFW(buf, 27) = hd->homunculus.level;
+ WBUFW(buf, 29) = hd->homunculus.hunger;
+ WBUFW(buf, 31) = (unsigned short) (hd->homunculus.intimacy / 100) ;
+ WBUFW(buf, 33) = 0; // equip id
#ifdef RENEWAL
WBUFW(buf, 35) = cap_value(hstatus->rhw.atk2, 0, INT16_MAX);
#else
- WBUFW(buf,35)=cap_value(hstatus->rhw.atk2+hstatus->batk, 0, INT16_MAX);
+ WBUFW(buf,35) = cap_value(hstatus->rhw.atk2 + hstatus->batk, 0, INT16_MAX);
#endif
- WBUFW(buf,37)=cap_value(hstatus->matk_max, 0, INT16_MAX);
- WBUFW(buf,39)=hstatus->hit;
+ WBUFW(buf,37) = cap_value(hstatus->matk_max, 0, INT16_MAX);
+ WBUFW(buf,39) = hstatus->hit;
if (battle_config.hom_setting&0x10)
- WBUFW(buf,41)=hstatus->luk/3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious]
+ WBUFW(buf, 41) = hstatus->luk / 3 + 1; //crit is a +1 decimal value! Just display purpose.[Vicious]
else
- WBUFW(buf,41)=hstatus->cri/10;
+ WBUFW(buf, 41) = hstatus->cri / 10;
#ifdef RENEWAL
WBUFW(buf, 43) = hstatus->def + hstatus->def2;
WBUFW(buf, 45) = hstatus->mdef + hstatus->mdef2;
#else
- WBUFW(buf,43)=hstatus->def + hstatus->vit ;
+ WBUFW(buf, 43) =hstatus->def + hstatus->vit ;
WBUFW(buf, 45) = hstatus->mdef;
#endif
- WBUFW(buf,47)=hstatus->flee;
- WBUFW(buf,49)=(flag)?0:hstatus->amotion;
+ WBUFW(buf, 47) = hstatus->flee;
+ WBUFW(buf, 49) = (flag) ? 0 : hstatus->amotion;
+
+// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513
+#if PACKETVER < 20150513
if (hstatus->max_hp > INT16_MAX) {
- WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100);
- WBUFW(buf,53) = 100;
+ WBUFW(buf, 51) = hstatus->hp / (hstatus->max_hp / 100);
+ WBUFW(buf, 53) = 100;
} else {
- WBUFW(buf,51)=hstatus->hp;
- WBUFW(buf,53)=hstatus->max_hp;
+ WBUFW(buf, 51) = hstatus->hp;
+ WBUFW(buf, 53) = hstatus->max_hp;
}
+#else
+ WBUFL(buf, 51) = hstatus->hp;
+ WBUFL(buf, 55) = hstatus->max_hp;
+ offset = 4;
+#endif
+
if (hstatus->max_sp > INT16_MAX) {
- WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100);
- WBUFW(buf,57) = 100;
+ WBUFW(buf, 55 + offset) = hstatus->sp / (hstatus->max_sp / 100);
+ WBUFW(buf, 57 + offset) = 100;
} else {
- WBUFW(buf,55)=hstatus->sp;
- WBUFW(buf,57)=hstatus->max_sp;
+ WBUFW(buf, 55 + offset) = hstatus->sp;
+ WBUFW(buf, 57 + offset) = hstatus->max_sp;
}
- WBUFL(buf,59)=hd->homunculus.exp;
- WBUFL(buf,63)=hd->exp_next;
- switch( htype ) {
+ WBUFL(buf, 59 + offset) = hd->homunculus.exp;
+ WBUFL(buf, 63 + offset) = hd->exp_next;
+ switch (htype) {
case HT_REG:
case HT_EVO:
- if( hd->homunculus.level >= battle_config.hom_max_level )
- WBUFL(buf,63)=0;
+ if (hd->homunculus.level >= battle_config.hom_max_level)
+ WBUFL(buf, 63 + offset) = 0;
break;
case HT_S:
- if( hd->homunculus.level >= battle_config.hom_S_max_level )
- WBUFL(buf,63)=0;
+ if (hd->homunculus.level >= battle_config.hom_S_max_level)
+ WBUFL(buf, 63 + offset) = 0;
break;
}
- WBUFW(buf,67)=hd->homunculus.skillpts;
- WBUFW(buf,69)=status_get_range(&hd->bl);
- clif->send(buf,packet_len(0x22e),&sd->bl,SELF);
+ WBUFW(buf, 67 + offset) = hd->homunculus.skillpts;
+ WBUFW(buf, 69 + offset) = status_get_range(&hd->bl);
+
+ clif->send(buf, len, &sd->bl, SELF);
}
/// Notification about a change in homunuculus' state (ZC_CHANGESTATE_MER).
@@ -3228,10 +3249,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;
@@ -5208,33 +5226,46 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tic
}
#endif // 0
-/// Non-damaging skill effect (ZC_USE_SKILL).
-/// 011a <skill id>.W <skill lv>.W <dst id>.L <src id>.L <result>.B
-int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail)
+/// Non-damaging skill effect.
+/// 011a <skill id>.W <skill lv>.W <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL)
+/// 09cb <skill id>.W <skill lv>.L <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL2)
+int clif_skill_nodamage(struct block_list *src, struct block_list *dst, uint16 skill_id, int heal, int fail)
{
unsigned char buf[32];
+ short offset = 0;
+#if PACKETVER < 20131223
+ short cmd = 0x11a;
+#else
+ short cmd = 0x9cb;
+#endif
+ int len = packet_len(cmd);
nullpo_ret(dst);
- WBUFW(buf,0)=0x11a;
- WBUFW(buf,2)=skill_id;
- WBUFW(buf,4)=min(heal, INT16_MAX);
- WBUFL(buf,6)=dst->id;
- WBUFL(buf,10)=src?src->id:0;
- WBUFB(buf,14)=fail;
+ WBUFW(buf, 0) = cmd;
+ WBUFW(buf, 2) = skill_id;
+#if PACKETVER < 20131223
+ WBUFW(buf, 4) = min(heal, INT16_MAX);
+#else
+ WBUFL(buf, 4) = min(heal, INT_MAX);
+ offset += 2;
+#endif
+ WBUFL(buf, 6 + offset) = dst->id;
+ WBUFL(buf, 10 + offset) = src ? src->id : 0;
+ WBUFB(buf, 14 + offset) = fail;
if (clif->isdisguised(dst)) {
- clif->send(buf,packet_len(0x11a),dst,AREA_WOS);
- WBUFL(buf,6)=-dst->id;
- clif->send(buf,packet_len(0x11a),dst,SELF);
+ clif->send(buf, len, dst, AREA_WOS);
+ WBUFL(buf, 6 + offset) = -dst->id;
+ clif->send(buf, len, dst, SELF);
} else
- clif->send(buf,packet_len(0x11a),dst,AREA);
+ clif->send(buf, len, dst, AREA);
if (src && clif->isdisguised(src)) {
- WBUFL(buf,10)=-src->id;
+ WBUFL(buf, 10 + offset) = -src->id;
if (clif->isdisguised(dst))
- WBUFL(buf,6)=dst->id;
- clif->send(buf,packet_len(0x11a),src,SELF);
+ WBUFL(buf, 6 + offset) = dst->id;
+ clif->send(buf, len, src, SELF);
}
return fail;
@@ -5708,13 +5739,24 @@ void clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned i
/// 5 = HP (SP_HP)
/// 7 = SP (SP_SP)
/// ? = ignored
-void clif_heal(int fd,int type,int val)
+void clif_heal(int fd, int type, int val)
{
- WFIFOHEAD(fd,packet_len(0x13d));
- WFIFOW(fd,0)=0x13d;
- WFIFOW(fd,2)=type;
- WFIFOW(fd,4)=cap_value(val,0,INT16_MAX);
- WFIFOSET(fd,packet_len(0x13d));
+#if PACKETVER < 20150513
+ short cmd = 0x13d;
+#else
+ short cmd = 0xa27;
+#endif
+ int len = packet_len(cmd);
+
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = cmd;
+ WFIFOW(fd, 2) = type;
+#if PACKETVER < 20150513
+ WFIFOW(fd, 4) = cap_value(val, 0, INT16_MAX);
+#else
+ WFIFOL(fd, 4) = cap_value(val, 0, INT_MAX);
+#endif
+ WFIFOSET(fd, len);
}
/// Displays resurrection effect (ZC_RESURRECTION).
@@ -6376,29 +6418,41 @@ 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
}
-/// Inform merchant that someone has bought an item (ZC_DELETEITEM_FROM_MCSTORE).
-/// 0137 <index>.W <amount>.W
-void clif_vendingreport(struct map_session_data* sd, int index, int amount)
+/// Inform merchant that someone has bought an item.
+/// 0137 <index>.W <amount>.W (ZC_DELETEITEM_FROM_MCSTORE).
+/// 09e5 <index>.W <amount>.W <GID>.L <Date>.L <zeny>.L (ZC_DELETEITEM_FROM_MCSTORE2).
+void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny)
{
int fd;
+#if PACKETVER < 20141016 // TODO : not sure for client date [Napster]
+ const int cmd = 0x137;
+#else
+ const int cmd = 0x9e5;
+#endif
+ const int len = packet_len(cmd);
nullpo_retv(sd);
fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x137));
- WFIFOW(fd,0) = 0x137;
- WFIFOW(fd,2) = index+2;
- WFIFOW(fd,4) = amount;
- WFIFOSET(fd,packet_len(0x137));
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = cmd;
+ WFIFOW(fd, 2) = index + 2;
+ WFIFOW(fd, 4) = amount;
+#if PACKETVER >= 20141016
+ WFIFOL(fd,6) = char_id; // GID
+ WFIFOL(fd,10) = (int)time(NULL); // Date
+ WFIFOL(fd,14) = zeny; // zeny
+#endif
+ WFIFOSET(fd, len);
}
/// Result of organizing a party (ZC_ACK_MAKE_GROUP).
@@ -7050,21 +7104,31 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd)
if( src->type == BL_MER )
{
struct mercenary_data *md = BL_CAST(BL_MER,src);
+ int skill_lvl;
if( md && md->master && md->devotion_flag )
WBUFL(buf,6) = md->master->bl.id;
- WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION));
+ skill_lvl = mercenary->checkskill(md, ML_DEVOTION);
+ if (skill_lvl > 0)
+ WBUFW(buf, 26) = skill->get_range2(src, ML_DEVOTION, skill_lvl);
+ else
+ WBUFW(buf, 26) = 0;
}
else
{
int i;
struct map_session_data *sd = BL_CAST(BL_PC,src);
+ int skill_lvl;
if( sd == NULL )
return;
for( i = 0; i < MAX_PC_DEVOTION; i++ )
WBUFL(buf,6+4*i) = sd->devotion[i];
- WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION));
+ skill_lvl = pc->checkskill(sd, CR_DEVOTION);
+ if (skill_lvl > 0)
+ WBUFW(buf, 26) = skill->get_range2(src, CR_DEVOTION, skill_lvl);
+ else
+ WBUFW(buf, 26) = 0;
}
if( tsd )
@@ -9755,11 +9819,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);
@@ -9991,7 +10053,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;
@@ -10051,7 +10113,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;
@@ -10091,7 +10154,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;
}
@@ -10176,7 +10239,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.
@@ -10364,6 +10427,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;
@@ -10696,7 +10760,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;
}
@@ -10813,7 +10877,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;
}
@@ -11859,7 +11923,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;
}
@@ -11881,7 +11945,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;
}
@@ -13766,6 +13830,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd)
case MAPID_TAEKWON:
if (!sd->state.rest)
break;
+ FALLTHROUGH
case MAPID_SUPER_NOVICE:
sd->state.doridori=1;
break;
@@ -14151,15 +14216,18 @@ 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);
@@ -14174,7 +14242,8 @@ void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) {
}
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)));
@@ -14194,8 +14263,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;
@@ -14204,15 +14274,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
}
@@ -15197,10 +15268,10 @@ void clif_Auction_message(int fd, unsigned char flag)
/// 2 = Auction ID is incorrect
void clif_Auction_close(int fd, unsigned char flag)
{
- WFIFOHEAD(fd,packet_len(0x25e));
+ WFIFOHEAD(fd, 4);
WFIFOW(fd,0) = 0x25d; // BUG: The client identifies this packet as 0x25d (CZ_AUCTION_REQ_MY_SELL_STOP)
WFIFOW(fd,2) = flag;
- WFIFOSET(fd,packet_len(0x25e));
+ WFIFOSET(fd, 4);
}
void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -16126,28 +16197,46 @@ void clif_readbook(int fd, int book_id, int page)
/// Battlegrounds
///
-/// Updates HP bar of a camp member (ZC_BATTLEFIELD_NOTIFY_HP).
-/// 02e0 <account id>.L <name>.24B <hp>.W <max hp>.W
+/// Updates HP bar of a camp member.
+/// 02e0 <account id>.L <name>.24B <hp>.W <max hp>.W (ZC_BATTLEFIELD_NOTIFY_HP).
+/// 0a0e <account id>.L <hp>.L <max hp>.L (ZC_BATTLEFIELD_NOTIFY_HP2)
void clif_bg_hp(struct map_session_data *sd)
{
unsigned char buf[34];
+
+// packet version can be wrong, because inconsistend data in other servers.
+#if PACKETVER < 20140613
const int cmd = 0x2e0;
nullpo_retv(sd);
- WBUFW(buf,0) = cmd;
- WBUFL(buf,2) = sd->status.account_id;
- memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH);
+ WBUFW(buf, 0) = cmd;
+ WBUFL(buf, 2) = sd->status.account_id;
+ memcpy(WBUFP(buf, 6), sd->status.name, NAME_LENGTH);
- if( sd->battle_status.max_hp > INT16_MAX )
+ if (sd->battle_status.max_hp > INT16_MAX)
{ // To correctly display the %hp bar. [Skotlex]
- WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100);
- WBUFW(buf,32) = 100;
+ WBUFW(buf, 30) = sd->battle_status.hp / (sd->battle_status.max_hp / 100);
+ WBUFW(buf, 32) = 100;
}
else
{
- WBUFW(buf,30) = sd->battle_status.hp;
- WBUFW(buf,32) = sd->battle_status.max_hp;
+ WBUFW(buf, 30) = sd->battle_status.hp;
+ WBUFW(buf, 32) = sd->battle_status.max_hp;
}
+#else
+ const int cmd = 0xa0e;
+ nullpo_retv(sd);
+
+ WBUFW(buf, 0) = cmd;
+ WBUFL(buf, 2) = sd->status.account_id;
+ if (sd->battle_status.max_hp > INT32_MAX) {
+ WBUFL(buf, 6) = sd->battle_status.hp / (sd->battle_status.max_hp / 100);
+ WBUFL(buf, 10) = 100;
+ } else {
+ WBUFL(buf, 6) = sd->battle_status.hp;
+ WBUFL(buf, 10) = sd->battle_status.max_hp;
+ }
+#endif
clif->send(buf, packet_len(cmd), &sd->bl, BG_AREA_WOS);
}
@@ -16606,6 +16695,7 @@ void clif_elemental_info(struct map_session_data *sd) {
/// 0810 <slots>.B
void clif_buyingstore_open(struct map_session_data* sd)
{
+#if PACKETVER >= 20100303
int fd;
nullpo_retv(sd);
@@ -16614,6 +16704,7 @@ void clif_buyingstore_open(struct map_session_data* sd)
WFIFOW(fd,0) = 0x810;
WFIFOB(fd,2) = sd->buyingstore.slots;
WFIFOSET(fd,packet_len(0x810));
+#endif
}
void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -16667,6 +16758,7 @@ void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) {
/// ? = nothing
void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight)
{
+#if PACKETVER >= 20100420
int fd;
nullpo_retv(sd);
@@ -16676,6 +16768,7 @@ void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short re
WFIFOW(fd,2) = result;
WFIFOL(fd,4) = weight;
WFIFOSET(fd,packet_len(0x812));
+#endif
}
/// Notification, that the requested buying store was created (ZC_MYITEMLIST_BUYING_STORE).
@@ -16708,6 +16801,7 @@ void clif_buyingstore_myitemlist(struct map_session_data* sd)
/// 0814 <account id>.L <store name>.80B
void clif_buyingstore_entry(struct map_session_data* sd)
{
+#if PACKETVER >= 20100420
uint8 buf[86];
nullpo_retv(sd);
@@ -16716,9 +16810,11 @@ void clif_buyingstore_entry(struct map_session_data* sd)
memcpy(WBUFP(buf,6), sd->message, MESSAGE_SIZE);
clif->send(buf, packet_len(0x814), &sd->bl, AREA_WOS);
+#endif
}
void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd)
{
+#if PACKETVER >= 20100420
int fd;
nullpo_retv(sd);
@@ -16728,6 +16824,7 @@ void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_sessi
WFIFOL(fd,2) = pl_sd->bl.id;
memcpy(WFIFOP(fd,6), pl_sd->message, MESSAGE_SIZE);
WFIFOSET(fd,packet_len(0x814));
+#endif
}
void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -16741,6 +16838,7 @@ void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) {
/// 0816 <account id>.L
void clif_buyingstore_disappear_entry(struct map_session_data* sd)
{
+#if PACKETVER >= 20100309
uint8 buf[6];
nullpo_retv(sd);
@@ -16748,9 +16846,12 @@ void clif_buyingstore_disappear_entry(struct map_session_data* sd)
WBUFL(buf,2) = sd->bl.id;
clif->send(buf, packet_len(0x816), &sd->bl, AREA_WOS);
+#endif
}
+
void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd)
{
+#if PACKETVER >= 20100309
int fd;
nullpo_retv(sd);
@@ -16760,6 +16861,7 @@ void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct
WFIFOW(fd,0) = 0x816;
WFIFOL(fd,2) = pl_sd->bl.id;
WFIFOSET(fd,packet_len(0x816));
+#endif
}
/// Request to open someone else's buying store (CZ_REQ_CLICK_TO_BUYING_STORE).
@@ -16844,6 +16946,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) {
/// ? = nothing
void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result)
{
+#if PACKETVER >= 20100420
int fd;
nullpo_retv(sd);
@@ -16852,22 +16955,36 @@ void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short resu
WFIFOW(fd,0) = 0x81a;
WFIFOW(fd,2) = result;
WFIFOSET(fd,packet_len(0x81a));
+#endif
}
/// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE).
/// 081b <name id>.W <amount>.W <limit zeny>.L
-void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount)
+void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny)
{
int fd;
+#if PACKETVER < 20141016 // TODO : not sure for client date [Napster]
+ const int cmd = 0x81b;
+#else
+ const int cmd = 0x9e6;
+#endif
+ const int len = packet_len(cmd);
nullpo_retv(sd);
fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x81b));
- WFIFOW(fd,0) = 0x81b;
- WFIFOW(fd,2) = nameid;
- WFIFOW(fd,4) = amount; // amount of nameid received
- WFIFOL(fd,6) = sd->buyingstore.zenylimit;
- WFIFOSET(fd,packet_len(0x81b));
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = cmd;
+ WFIFOW(fd, 2) = nameid;
+ WFIFOW(fd, 4) = amount; // amount of nameid received
+#if PACKETVER < 20141016
+ WFIFOL(fd, 6) = sd->buyingstore.zenylimit;
+#else
+ WFIFOL(fd, 6) = zeny; // zeny
+ WFIFOL(fd, 10) = sd->buyingstore.zenylimit;
+ WFIFOL(fd, 14) = char_id; // GID
+ WFIFOL(fd, 18) = (int)time(NULL); // date
+#endif
+ WFIFOSET(fd, len);
}
/// Deletes item from inventory, that was sold to a buying store (ZC_ITEM_DELETE_BUYING_STORE).
@@ -16878,6 +16995,7 @@ void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short na
/// NOTE: This function has to be called _instead_ of clif_delitem/clif_dropitem.
void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price)
{
+#if PACKETVER >= 20100420
int fd;
nullpo_retv(sd);
@@ -16888,6 +17006,7 @@ void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsi
WFIFOW(fd,4) = amount;
WFIFOL(fd,6) = price; // price per item, client calculates total Zeny by itself
WFIFOSET(fd,packet_len(0x81c));
+#endif
}
/// Notifies the seller, that a buying store trade failed (ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER).
@@ -16899,6 +17018,7 @@ void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsi
/// ? = nothing
void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid)
{
+#if PACKETVER >= 20100420
int fd;
nullpo_retv(sd);
@@ -16908,6 +17028,7 @@ void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short res
WFIFOW(fd,2) = result;
WFIFOW(fd,4) = nameid;
WFIFOSET(fd,packet_len(0x824));
+#endif
}
void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -17027,6 +17148,7 @@ void clif_search_store_info_ack(struct map_session_data* sd)
/// 4 = "No sale (purchase) information available." (0x705)
void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason)
{
+#if PACKETVER >= 20100601
int fd;
nullpo_retv(sd);
@@ -17035,6 +17157,7 @@ void clif_search_store_info_failed(struct map_session_data* sd, unsigned char re
WFIFOW(fd,0) = 0x837;
WFIFOB(fd,2) = reason;
WFIFOSET(fd,packet_len(0x837));
+#endif
}
void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -17052,6 +17175,7 @@ void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd)
/// 1 = Search Stores (Cash), asks for confirmation, when clicking a store
void clif_open_search_store_info(struct map_session_data* sd)
{
+#if PACKETVER >= 20100608
int fd;
nullpo_retv(sd);
@@ -17063,6 +17187,7 @@ void clif_open_search_store_info(struct map_session_data* sd)
WFIFOB(fd,4) = (unsigned char)min(sd->searchstore.uses, UINT8_MAX);
#endif
WFIFOSET(fd,packet_len(0x83a));
+#endif
}
void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -17093,6 +17218,7 @@ void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd
/// 083d <xPos>.W <yPos>.W
void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y)
{
+#if PACKETVER >= 20100608
int fd;
nullpo_retv(sd);
@@ -17102,6 +17228,7 @@ void clif_search_store_info_click_ack(struct map_session_data* sd, short x, shor
WFIFOW(fd,2) = x;
WFIFOW(fd,4) = y;
WFIFOSET(fd,packet_len(0x83d));
+#endif
}
/// Parse function for packet debugging.
@@ -17370,6 +17497,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) {
*------------------------------------------*/
void clif_charm(struct map_session_data *sd)
{
+#if PACKETVER >= 20110809
unsigned char buf[10];
nullpo_retv(sd);
@@ -17379,6 +17507,7 @@ void clif_charm(struct map_session_data *sd)
WBUFW(buf,6) = sd->charm_type;
WBUFW(buf,8) = sd->charm_count;
clif->send(buf,packet_len(0x08cf),&sd->bl,AREA);
+#endif
}
void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -17480,6 +17609,7 @@ void clif_cashshop_db(void) {
/// Items that are in favorite tab of inventory (ZC_ITEM_FAVORITE).
/// 0900 <index>.W <favorite>.B
void clif_favorite_item(struct map_session_data* sd, unsigned short index) {
+#if PACKETVER >= 20120410
int fd;
nullpo_retv(sd);
@@ -17489,9 +17619,11 @@ void clif_favorite_item(struct map_session_data* sd, unsigned short index) {
WFIFOW(fd,2) = index+2;
WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1;
WFIFOSET(fd,packet_len(0x908));
+#endif
}
void clif_snap( struct block_list *bl, short x, short y ) {
+#if PACKETVER >= 20110809
unsigned char buf[10];
nullpo_retv(bl);
@@ -17501,9 +17633,12 @@ void clif_snap( struct block_list *bl, short x, short y ) {
WBUFW(buf,8) = y;
clif->send(buf,packet_len(0x8d2),bl,AREA);
+#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);
@@ -17514,6 +17649,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) */
@@ -17542,7 +17678,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++ ) {
@@ -17562,6 +17700,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)));
@@ -17655,7 +17794,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;
@@ -17674,9 +17815,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;
@@ -17729,6 +17873,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);
@@ -17748,6 +17893,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) {
@@ -17904,14 +18050,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! */
@@ -18033,7 +18182,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) {
@@ -18046,6 +18197,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)));
@@ -18058,7 +18210,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);
@@ -18068,9 +18222,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);
@@ -18080,6 +18237,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.) */
@@ -18336,6 +18494,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 ) {
@@ -18354,10 +18513,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;
@@ -18380,7 +18542,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)));
@@ -18454,7 +18616,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 ) {
@@ -18497,7 +18661,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) {
@@ -18592,7 +18756,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);
@@ -18606,6 +18772,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
}
/**
@@ -18613,6 +18780,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};
@@ -18655,6 +18823,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)
@@ -18671,6 +18840,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;
@@ -18750,6 +18920,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)
@@ -18760,6 +18931,7 @@ void clif_cancelmergeitem (int fd, struct map_session_data *sd)
void clif_dressroom_open(struct map_session_data *sd, int view)
{
+#if PACKETVER >= 20150513
int fd;
nullpo_retv(sd);
@@ -18769,6 +18941,7 @@ void clif_dressroom_open(struct map_session_data *sd, int view)
WFIFOW(fd,0)=0xa02;
WFIFOW(fd,2)=view;
WFIFOSET(fd,packet_len(0xa02));
+#endif
}
/// Request to select cart's visual look for new cart design (ZC_SELECTCART).
@@ -18793,6 +18966,48 @@ void clif_selectcart(struct map_session_data *sd)
#endif
}
+/// 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)
+{
+// 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, packet_len(0x8e2));
+ WFIFOW(fd, 0) = 0x8e2;
+
+ // How detailed will our navigation be?
+ if (mob_id > 0) {
+ x = 0;
+ y = 0;
+ WFIFOB(fd, 2) = 3; // monster with destination field
+ } else if (x > 0 && y > 0) {
+ WFIFOB(fd, 2) = 0; // with coordinates
+ } else {
+ x = 0;
+ y = 0;
+ WFIFOB(fd, 2) = 1; // without coordinates(will fail if you are already on the map)
+ }
+
+ // Which services can be used for transportation?
+ WFIFOB(fd, 3) = flag;
+ // If this flag is set, the navigation window will not be opened up
+ WFIFOB(fd, 4) = hideWindow;
+ // Target map
+ safestrncpy((char*)WFIFOP(fd, 5), mapname, MAP_NAME_LENGTH_EXT);
+ // Target x
+ WFIFOW(fd, 21) = x;
+ // Target y
+ WFIFOW(fd, 23) = y;
+ // Target monster ID
+ WFIFOW(fd, 25) = mob_id;
+ WFIFOSET(fd, packet_len(0x8e2));
+#endif
+}
+
/**
* Returns the name of the given bl, in a client-friendly format.
*
@@ -19636,6 +19851,7 @@ void clif_defaults(void) {
clif->selectcart = clif_selectcart;
/* */
clif->isdisguised = clif_isdisguised;
+ clif->navigate_to = clif_navigate_to;
clif->bl_type = clif_bl_type;
/*------------------------
diff --git a/src/map/clif.h b/src/map/clif.h
index 8b75a32f3..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
@@ -896,7 +896,7 @@ struct clif_interface {
void (*vendinglist) (struct map_session_data* sd, unsigned int id, struct s_vending* vending_list);
void (*buyvending) (struct map_session_data* sd, int index, int amount, int fail);
void (*openvending) (struct map_session_data* sd, int id, struct s_vending* vending_list);
- void (*vendingreport) (struct map_session_data* sd, int index, int amount);
+ void (*vendingreport) (struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny);
/* storage handling */
void (*storagelist) (struct map_session_data* sd, struct item* items, int items_length);
void (*updatestorageamount) (struct map_session_data* sd, int amount, int max_amount);
@@ -1058,7 +1058,7 @@ struct clif_interface {
void (*buyingstore_disappear_entry_single) (struct map_session_data* sd, struct map_session_data* pl_sd);
void (*buyingstore_itemlist) (struct map_session_data* sd, struct map_session_data* pl_sd);
void (*buyingstore_trade_failed_buyer) (struct map_session_data* sd, short result);
- void (*buyingstore_update_item) (struct map_session_data* sd, unsigned short nameid, unsigned short amount);
+ void (*buyingstore_update_item) (struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny);
void (*buyingstore_delete_item) (struct map_session_data* sd, short index, unsigned short amount, int price);
void (*buyingstore_trade_failed_seller) (struct map_session_data* sd, short result, unsigned short nameid);
/* search store-related */
@@ -1111,6 +1111,7 @@ struct clif_interface {
void (*ackmergeitems) (int fd, struct map_session_data *sd);
/* */
bool (*isdisguised) (struct block_list* bl);
+ void (*navigate_to) (struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id);
unsigned char (*bl_type) (struct block_list *bl);
/*------------------------
*- Parse Incoming Packet
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..76b7ba24b 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
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..5de8d5d02 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
diff --git a/src/map/guild.h b/src/map/guild.h
index 4fe7106d3..feb374e4a 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
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 080a314b8..cc920b888 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -1215,7 +1215,7 @@ void homunculus_read_db(void) {
if( i > 0 ) {
char filepath[256];
- sprintf(filepath, "%s/%s", map->db_path, filename[i]);
+ snprintf(filepath, 256, "%s/%s", map->db_path, filename[i]);
if( !exists(filepath) ) {
continue;
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..55a5f8340 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
diff --git a/src/map/intif.h b/src/map/intif.h
index 5e7f86fc2..c4d960256 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
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 350697a08..58397a2ee 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -437,6 +437,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;
@@ -538,6 +541,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)
@@ -1376,7 +1381,7 @@ void itemdb_read_combos(void)
char filepath[256];
FILE* fp;
- sprintf(filepath, "%s/%s", map->db_path, DBPATH"item_combo_db.txt");
+ snprintf(filepath, 256, "%s/%s", map->db_path, DBPATH"item_combo_db.txt");
if ((fp = fopen(filepath, "r")) == NULL) {
ShowError("itemdb_read_combos: File not found \"%s\".\n", filepath);
@@ -1535,6 +1540,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..77e702638 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)
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 e901eb6b9..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);
@@ -1929,6 +1930,7 @@ int map_quit(struct map_session_data *sd) {
case SC_GDSKILL_REGENERATION:
if( !sd->sc.data[i]->val4 )
break;
+ FALLTHROUGH
default:
status_change_end(&sd->bl, (sc_type)i, INVALID_TIMER);
}
@@ -3738,8 +3740,8 @@ int map_readallmaps (void) {
if( map->enable_grf )
ShowStatus("Loading maps (using GRF files)...\n");
else {
- char mapcachefilepath[254];
- sprintf(mapcachefilepath,"%s/%s%s",map->db_path,DBPATH,"map_cache.dat");
+ char mapcachefilepath[256];
+ snprintf(mapcachefilepath, 256, "%s/%s%s", map->db_path, DBPATH, "map_cache.dat");
ShowStatus("Loading maps (using %s as map cache)...\n", mapcachefilepath);
if( (fp = fopen(mapcachefilepath, "rb")) == NULL ) {
ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", mapcachefilepath);
@@ -3996,7 +3998,7 @@ bool map_config_read_map_list(const char *filename, struct config_t *config, boo
nullpo_retr(false, filename);
nullpo_retr(false, config);
- deleted_maps = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY, MAP_NAME_LENGTH);
+ deleted_maps = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, MAP_NAME_LENGTH);
// Remove maps
if ((setting = libconfig->lookup(config, "map_configuration/map_removed")) != NULL) {
@@ -4128,6 +4130,7 @@ bool map_read_npclist(const char *filename, bool imported)
struct config_setting_t *setting = NULL;
const char *import = NULL;
bool retval = true;
+ bool remove_all = false;
struct DBMap *deleted_npcs;
@@ -4136,9 +4139,9 @@ 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_RELEASE_KEY, MAP_NAME_LENGTH);
+ deleted_npcs = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, 0);
- // Remove maps
+ // Remove NPCs
if ((setting = libconfig->lookup(&config, "npc_removed_list")) != NULL) {
int i, del_count = libconfig->setting_length(setting);
for (i = 0; i < del_count; i++) {
@@ -4147,10 +4150,13 @@ bool map_read_npclist(const char *filename, bool imported)
if ((scriptname = libconfig->setting_get_string_elem(setting, i)) == NULL || scriptname[0] == '\0')
continue;
- strdb_put(deleted_npcs, scriptname, NULL);
-
- if (imported) // Map list is empty on the first run, only do this for imported files.
+ if (strcmp(scriptname, "all") == 0) {
+ remove_all = true;
+ npc->clearsrcfile();
+ } else {
+ strdb_put(deleted_npcs, scriptname, NULL);
npc->delsrcfile(scriptname);
+ }
}
}
@@ -4168,7 +4174,7 @@ bool map_read_npclist(const char *filename, bool imported)
if ((scriptname = libconfig->setting_get_string_elem(setting, i)) == NULL || scriptname[0] == '\0')
continue;
- if (strdb_exists(deleted_npcs, scriptname))
+ if (remove_all || strdb_exists(deleted_npcs, scriptname))
continue;
npc->addsrcfile(scriptname);
@@ -4208,7 +4214,7 @@ bool map_read_npclist(const char *filename, bool imported)
void map_reloadnpc(bool clear) {
int i;
if (clear)
- npc->addsrcfile("clear"); // this will clear the current script list
+ npc->clearsrcfile();
#ifdef RENEWAL
map->read_npclist("npc/re/scripts_main.conf", false);
@@ -4390,7 +4396,7 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone
nullpo_retr(NULL, main);
nullpo_retr(NULL, other);
- sprintf(newzone, "%s+%s",main->name,other->name);
+ snprintf(newzone, MAP_ZONE_NAME_LENGTH, "%s+%s", main->name, other->name);
if( (zone = strdb_get(map->zone_db, newzone)) )
return zone;/* this zone has already been merged */
diff --git a/src/map/map.h b/src/map/map.h
index 723691971..c186dab4a 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -88,6 +88,7 @@ enum {
MAPID_XMAS,
MAPID_SUMMER,
MAPID_GANGSI,
+ MAPID_SUMMONER,
//2-1 Jobs
MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
MAPID_KNIGHT,
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 0b055bedf..95c1f9be3 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
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 bede7deed..0aadd989d 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
@@ -1099,6 +1099,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap)
case BL_PC:
if (BL_UCCAST(BL_PC, bl)->state.gangsterparadise && !(status_get_mode(&md->bl)&MD_BOSS))
return 0; //Gangster paradise protection.
+ FALLTHROUGH
default:
if (battle_config.hom_setting&0x4 &&
(*target) && (*target)->type == BL_HOM && bl->type != BL_HOM)
@@ -1326,6 +1327,7 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) {
break;
//Because it is not unset when the mob finishes walking.
md->state.skillstate = MSS_IDLE;
+ FALLTHROUGH
case MSS_IDLE:
// Idle skill.
if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mob->skill_use(md, tick, -1))
@@ -3289,6 +3291,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
+ FALLTHROUGH
case MST_FRIEND:
bl = fbl?fbl:(fmd?&fmd->bl:&md->bl);
break;
@@ -3331,6 +3334,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
+ FALLTHROUGH
case MST_FRIEND:
if (fbl) {
bl = fbl;
@@ -3339,6 +3343,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = &fmd->bl;
break;
} // else fall through
+ FALLTHROUGH
default:
bl = &md->bl;
break;
@@ -5057,7 +5062,7 @@ void mob_readskilldb(void) {
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
if(fi > 0) {
char filepath[256];
- sprintf(filepath, "%s/%s", map->db_path, filename[fi]);
+ snprintf(filepath, 256, "%s/%s", map->db_path, filename[fi]);
if(!exists(filepath)) {
continue;
}
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 945a84957..72c451ef9 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
@@ -2167,12 +2167,15 @@ int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
}
if( nd->subtype != SHOP ) {
- if( !(nd->subtype == SCRIPT && nd->u.scr.shop && nd->u.scr.shop->type == NST_ZENY) )
+ if (!(nd->subtype == SCRIPT && nd->u.scr.shop && (nd->u.scr.shop->type == NST_ZENY || nd->u.scr.shop->type == NST_MARKET)))
return 1;
}
z = 0;
+ if (sd->status.zeny >= MAX_ZENY && nd->master_nd == NULL)
+ return 1;
+
// verify the sell list
for (i = 0; i < VECTOR_LENGTH(*item_list); i++) {
struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
@@ -2222,7 +2225,10 @@ int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
pc->delitem(sd, idx, entry->amount, 0, DELITEM_SOLD, LOG_TYPE_NPC);
}
- if( z > MAX_ZENY )
+ if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL)
+ return 1;
+
+ if (z > MAX_ZENY)
z = MAX_ZENY;
pc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
@@ -2426,24 +2432,22 @@ void npc_clearsrcfile(void)
npc->src_files = NULL;
}
-/// Adds a npc source file (or removes all)
-void npc_addsrcfile(const char* name)
+/**
+ * Adds a npc source file.
+ *
+ * @param name The file name to add.
+ */
+void npc_addsrcfile(const char *name)
{
struct npc_src_list* file;
struct npc_src_list* file_prev = NULL;
nullpo_retv(name);
- if( strcmpi(name, "clear") == 0 )
- {
- npc->clearsrcfile();
- return;
- }
// prevent multiple insert of source files
file = npc->src_files;
- while( file != NULL )
- {
- if( strcmp(name, file->name) == 0 )
+ while (file != NULL) {
+ if (strcmp(name, file->name) == 0)
return;// found the file, no need to insert it again
file_prev = file;
file = file->next;
@@ -2458,24 +2462,21 @@ void npc_addsrcfile(const char* name)
file_prev->next = file;
}
-/// Removes a npc source file (or all)
-void npc_delsrcfile(const char* name)
+/**
+ * Removes a npc source file.
+ *
+ * @param name The file name to remove.
+ */
+void npc_delsrcfile(const char *name)
{
struct npc_src_list* file = npc->src_files;
struct npc_src_list* file_prev = NULL;
nullpo_retv(name);
- if( strcmpi(name, "all") == 0 )
- {
- npc->clearsrcfile();
- return;
- }
- while( file != NULL )
- {
- if( strcmp(file->name, name) == 0 )
- {
- if( npc->src_files == file )
+ while (file != NULL) {
+ if (strcmp(file->name, name) == 0) {
+ if (npc->src_files == file)
npc->src_files = file->next;
else
file_prev->next = file->next;
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 4bd7d416d..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
@@ -393,7 +393,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
// save out the matched strings
for (i = 0; i < r; i++)
{
- char var[12], val[255];
+ char var[15], val[255];
snprintf(var, sizeof(var), "$@p%i$", i);
libpcre->copy_substring(msg, offsets, r, i, val, sizeof(val));
script->set_var(sd, var, val);
diff --git a/src/map/packets.h b/src/map/packets.h
index 0badd94f5..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,15 +2679,16 @@ 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
// 2013-12-30aRagexe - Yommy
@@ -2605,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);
@@ -2640,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);
@@ -2673,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
@@ -2707,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
@@ -2741,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
@@ -2775,17 +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);
@@ -2809,16 +2930,18 @@ 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
+ packet(0x09e6,22); // ZC_UPDATE_ITEM_FROM_BUYING_STORE2
#endif
/* Roulette System [Yommy/Hercules] */
@@ -2858,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);
@@ -2902,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);
@@ -2914,13 +3038,150 @@ packet(0x96e,-1,clif->ackmergeitems);
packet(0x0A2E,6,clif->pDull); // TITLE
packet(0x0A02,4); // ZC_DRESSROOM_OPEN
packet(0x0A35,4,clif->pOneClick_ItemIdentify,2);
+ packet(0x0a27,8); // ZC_RECOVERY2
+ packet(0x09f7,75); // ZC_PROPERTY_HOMUN_2
#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 */
@@ -3166,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..1c505bacc 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
@@ -236,24 +236,28 @@ 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_) {
case JOB_MONK:
case JOB_BABY_MONK:
case JOB_CHAMPION:
+ case JOB_SURA:
+ case JOB_SURA_T:
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;
}
}
}
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 51d02ff40..674eeb90f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -490,7 +490,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:
@@ -1749,7 +1749,7 @@ 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) {
+ if(skill_point < novice_skills && (sd->class_&MAPID_BASEMASK) != MAPID_SUMMONER) {
c = MAPID_NOVICE;
}
// limit 2nd class and above to first class job levels (super novices are exempt)
@@ -4965,6 +4965,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 +4977,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 +5004,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);
@@ -5881,6 +5882,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;
@@ -6023,6 +6025,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;
@@ -6362,6 +6365,9 @@ const char* job_name(int class_)
case JOB_REBELLION:
return msg_txt(655);
+ case JOB_SUMMONER:
+ return msg_txt(669);
+
default:
return msg_txt(620); // "Unknown Job"
}
@@ -6487,6 +6493,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);
@@ -7398,6 +7405,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++ ) {
@@ -7422,7 +7432,9 @@ int pc_resetskill(struct map_session_data* sd, int flag)
}
// do not reset basic skill
- if( skill_id == NV_BASIC && (sd->class_&(MAPID_BASEMASK|JOBL_2)) != MAPID_NOVICE )
+ if (skill_id == NV_BASIC && (sd->class_&(MAPID_BASEMASK|JOBL_2)) != MAPID_NOVICE)
+ continue;
+ if (skill_id == SU_BASIC_SKILL && (sd->class_&MAPID_BASEMASK) != MAPID_SUMMONER)
continue;
if( sd->status.skill[i].flag == SKILL_FLAG_PERM_GRANTED )
@@ -8396,6 +8408,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);
@@ -8618,6 +8633,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);
@@ -11504,7 +11522,7 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update
))
Sql_ShowDebug(map->mysql_handle);
}
- /* yes we want it to fall */
+ FALLTHROUGH
case PAUC_REFRESH:
for( i = 0; i < sd->vend_num; i++ ) {
if( sd->vending[i].amount == 0 )
@@ -11644,7 +11662,8 @@ bool pc_db_checkid(unsigned int class_)
|| (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 );
+ || (class_ == JOB_REBELLION)
+ || (class_ >= JOB_SUMMONER && class_ < JOB_MAX );
}
/**
@@ -11655,13 +11674,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.
*
@@ -12117,4 +12148,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..5d1404b2a 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -635,6 +635,7 @@ 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_BASEMASK) == MAPID_SUMMONER ? battle->bc->max_summoner_parameter : \
( ((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \
|| ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION \
|| ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \
@@ -1094,6 +1095,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 ccda34b1c..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
@@ -310,6 +310,7 @@ static void read_config(void) {
*/
bool pc_group_has_permission(GroupSettings *group, unsigned int permission)
{
+ nullpo_retr(false, group);
return ((group->e_permissions&permission) != 0);
}
@@ -319,6 +320,7 @@ bool pc_group_has_permission(GroupSettings *group, unsigned int permission)
*/
bool pc_group_should_log_commands(GroupSettings *group)
{
+ nullpo_retr(true, group);
return group->log_commands;
}
@@ -348,6 +350,7 @@ GroupSettings* pc_group_id2group(int group_id)
*/
const char* pc_group_get_name(GroupSettings *group)
{
+ nullpo_retr(NULL, group);
return group->name;
}
@@ -359,6 +362,7 @@ const char* pc_group_get_name(GroupSettings *group)
*/
int pc_group_get_level(GroupSettings *group)
{
+ nullpo_ret(group);
return group->level;
}
@@ -370,6 +374,7 @@ int pc_group_get_level(GroupSettings *group)
*/
int pc_group_get_idx(GroupSettings *group)
{
+ nullpo_ret(group);
return group->index;
}
@@ -380,6 +385,7 @@ int pc_group_get_idx(GroupSettings *group)
unsigned int pc_groups_add_permission(const char *name) {
uint64 key = 0x1;
unsigned char i;
+ nullpo_ret(name);
for(i = 0; i < pcg->permission_count; i++) {
if( strcmpi(name,pcg->permissions[i].name) == 0 ) {
@@ -468,6 +474,7 @@ void do_init_pc_groups(void) {
static int group_db_clear_sub(union DBKey key, struct DBData *data, va_list args)
{
GroupSettings *group = DB->data2ptr(data);
+ nullpo_ret(group);
if (group->name)
aFree(group->name);
return 0;
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 e2b257e10..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
@@ -91,6 +91,7 @@ void pet_set_intimate(struct pet_data *pd, int value)
int pet_create_egg(struct map_session_data *sd, int item_id)
{
int pet_id = pet->search_petDB_index(item_id, PET_EGG);
+ nullpo_ret(sd);
if (pet_id < 0) return 0; //No pet egg here.
if (!pc->inventoryblank(sd)) return 0; // Inventory full
sd->catch_target_class = pet->db[pet_id].class_;
@@ -117,6 +118,7 @@ int pet_unlocktarget(struct pet_data *pd)
* Pet Attack Skill [Skotlex]
*------------------------------------------*/
int pet_attackskill(struct pet_data *pd, int target_id) {
+ nullpo_ret(pd);
if (!battle_config.pet_status_support || !pd->a_skill ||
(battle_config.pet_equip_required && !pd->pet.equip))
return 0;
@@ -148,6 +150,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type)
struct pet_data *pd;
int rate;
+ nullpo_ret(sd);
pd = sd->pd;
Assert_ret(pd->msd == 0 || pd->msd->pd == pd);
@@ -291,6 +294,7 @@ int pet_performance(struct map_session_data *sd, struct pet_data *pd)
{
int val;
+ nullpo_retr(1, pd);
if (pd->pet.intimate > 900)
val = (pd->petDB->s_perfor > 0)? 4:3;
else if(pd->pet.intimate > 750) //TODO: this is way too high
@@ -309,6 +313,8 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
struct item tmp_item;
int flag;
+ nullpo_retr(1, sd);
+ nullpo_retr(1, pd);
pet->lootitem_drop(pd,sd);
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = pd->petDB->EggID;
@@ -336,6 +342,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
int i=0,interval=0;
nullpo_retr(1, sd);
+ nullpo_retr(1, petinfo);
Assert_retr(1, sd->status.pet_id == 0 || sd->pd == 0 || sd->pd->msd == sd);
if(sd->status.account_id != petinfo->account_id || sd->status.char_id != petinfo->char_id) {
@@ -407,6 +414,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo)
{
nullpo_retr(1, sd);
+ nullpo_retr(1, petinfo);
Assert_retr(1, sd->status.pet_id == 0 || sd->pd == 0 || sd->pd->msd == sd);
if(sd->status.pet_id && petinfo->incubate == 1) {
@@ -443,6 +451,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo)
int pet_recv_petdata(int account_id,struct s_pet *p,int flag) {
struct map_session_data *sd;
+ nullpo_retr(1, p);
sd = map->id2sd(account_id);
if(sd == NULL)
return 1;
@@ -651,6 +660,7 @@ int pet_change_name(struct map_session_data *sd, const char *name)
int i;
struct pet_data *pd;
nullpo_retr(1, sd);
+ nullpo_retr(1, name);
pd = sd->pd;
if((pd == NULL) || (pd->pet.rename_flag == 1 && !battle_config.pet_rename))
@@ -666,9 +676,12 @@ int pet_change_name(struct map_session_data *sd, const char *name)
int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag)
{
- struct pet_data *pd = sd->pd;
+ struct pet_data *pd;
char *newname = NULL;
- if (!pd) return 0;
+ nullpo_ret(sd);
+ nullpo_ret(name);
+ pd = sd->pd;
+ if (pd == NULL) return 0;
newname = aStrndup(name, NAME_LENGTH-1);
normalize_name(newname, " ");//bugreport:3032 // FIXME[Haru]: This should be normalized by the inter-server (so that it's const here)
@@ -724,6 +737,8 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) {
struct item tmp_item;
int nameid,flag;
+ nullpo_retr(1, sd);
+ nullpo_retr(1, pd);
if(pd->pet.equip == 0)
return 1;
@@ -762,6 +777,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) {
int pet_food(struct map_session_data *sd, struct pet_data *pd) {
int i, food_id;
+ nullpo_retr(1, pd);
food_id = pd->petDB->FoodID;
i = pc->search_inventory(sd, food_id);
if(i == INDEX_NOT_FOUND) {
@@ -847,6 +863,7 @@ int pet_randomwalk(struct pet_data *pd, int64 tick)
int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick) {
struct block_list *target = NULL;
+ nullpo_ret(pd);
if(pd->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL)
return 0;
@@ -959,6 +976,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick
int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) {
int64 tick = va_arg(ap,int64);
+ nullpo_ret(sd);
if(sd->status.pet_id && sd->pd)
pet->ai_sub_hard(sd->pd,sd,tick);
@@ -1114,7 +1132,8 @@ int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) {
if(sd==NULL || sd->pd == NULL || sd->pd->recovery == NULL)
return 1;
- pd=sd->pd;
+ pd = sd->pd;
+ nullpo_retr(1, pd);
if(pd->recovery->timer != tid) {
ShowError("pet_recovery_timer %d != %d\n",pd->recovery->timer,tid);
@@ -1146,6 +1165,7 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
return 1;
pd=sd->pd;
+ nullpo_retr(1, pd);
if(pd->s_skill->timer != tid) {
ShowError("pet_skill_support_timer %d != %d\n",pd->s_skill->timer,tid);
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 79328ae9d..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
@@ -81,6 +81,7 @@ int quest_pc_login(struct map_session_data *sd)
int i;
#endif
+ nullpo_retr(1, sd);
if(sd->avail_quests == 0)
return 1;
@@ -111,6 +112,7 @@ int quest_add(struct map_session_data *sd, int quest_id)
int n;
struct quest_db *qi = quest->db(quest_id);
+ nullpo_retr(-1, sd);
if( qi == &quest->dummy ) {
ShowError("quest_add: quest %d not found in DB.\n", quest_id);
return -1;
@@ -122,6 +124,7 @@ int quest_add(struct map_session_data *sd, int quest_id)
}
n = sd->avail_quests; // Insertion point
+ Assert_retr(-1, sd->avail_quests <= sd->num_quests);
sd->num_quests++;
sd->avail_quests++;
@@ -163,6 +166,7 @@ int quest_change(struct map_session_data *sd, int qid1, int qid2)
int i;
struct quest_db *qi = quest->db(qid2);
+ nullpo_retr(-1, sd);
if( qi == &quest->dummy ) {
ShowError("quest_change: quest %d not found in DB.\n", qid2);
return -1;
@@ -213,6 +217,7 @@ int quest_delete(struct map_session_data *sd, int quest_id)
{
int i;
+ nullpo_retr(-1, sd);
//Search for quest
ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
@@ -283,6 +288,7 @@ void quest_update_objective(struct map_session_data *sd, int mob_id)
{
int i,j;
+ nullpo_retv(sd);
for (i = 0; i < sd->avail_quests; i++) {
struct quest_db *qi = NULL;
@@ -338,6 +344,7 @@ int quest_update_status(struct map_session_data *sd, int quest_id, enum quest_st
{
int i;
+ nullpo_retr(-1, sd);
ARR_FIND(0, sd->avail_quests, i, sd->quest_log[i].quest_id == quest_id);
if( i == sd->avail_quests ) {
ShowError("quest_update_status: Character %d doesn't have quest %d.\n", sd->status.char_id, quest_id);
@@ -388,6 +395,7 @@ int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type
{
int i;
+ nullpo_retr(-1, sd);
ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
if (i == sd->num_quests)
return -1;
@@ -431,6 +439,7 @@ struct quest_db *quest_read_db_sub(struct config_setting_t *cs, int n, const cha
struct config_setting_t *t = NULL;
int i32 = 0, quest_id;
const char *str = NULL;
+ nullpo_retr(NULL, cs);
/*
* Id: Quest ID [int]
* Name: Quest Name [string]
@@ -532,7 +541,7 @@ int quest_read_db(void)
int i = 0, count = 0;
const char *filename = "quest_db.conf";
- sprintf(filepath, "%s/%s", map->db_path, filename);
+ snprintf(filepath, 256, "%s/%s", map->db_path, filename);
if (!libconfig->load_file(&quest_db_conf, filepath))
return -1;
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 10f9c9f00..24faa6756 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -83,12 +83,15 @@
struct script_interface script_s;
struct script_interface *script;
+static inline int GETVALUE(const struct script_buf *buf, int i) __attribute__((nonnull (1)));
static inline int GETVALUE(const struct script_buf *buf, int i)
{
Assert_ret(VECTOR_LENGTH(*buf) > i + 2);
return (int)MakeDWord(MakeWord(VECTOR_INDEX(*buf, i), VECTOR_INDEX(*buf, i+1)),
MakeWord(VECTOR_INDEX(*buf, i+2), 0));
}
+
+static inline void SETVALUE(struct script_buf *buf, int i, int n) __attribute__((nonnull (1)));
static inline void SETVALUE(struct script_buf *buf, int i, int n)
{
Assert_retv(VECTOR_LENGTH(*buf) > i + 2);
@@ -158,6 +161,7 @@ const char* script_op2name(int op) {
static void script_dump_stack(struct script_state* st)
{
int i;
+ nullpo_retv(st);
ShowMessage("\tstart = %d\n", st->start);
ShowMessage("\tend = %d\n", st->end);
ShowMessage("\tdefsp = %d\n", st->stack->defsp);
@@ -200,6 +204,7 @@ static void script_dump_stack(struct script_state* st)
void script_reportsrc(struct script_state *st) {
struct block_list* bl;
+ nullpo_retv(st);
if( st->oid == 0 )
return; //Can't report source.
@@ -304,7 +309,7 @@ void script_reportfunc(struct script_state* st)
/*==========================================
* Output error message
*------------------------------------------*/
-static void disp_error_message2(const char *mes,const char *pos,int report) analyzer_noreturn;
+static void disp_error_message2(const char *mes,const char *pos,int report) __attribute__((nonnull (1))) analyzer_noreturn;
static void disp_error_message2(const char *mes,const char *pos,int report) {
script->error_msg = aStrdup(mes);
script->error_pos = pos;
@@ -333,6 +338,7 @@ void check_event(struct script_state *st, const char *evt)
unsigned int calc_hash(const char* p) {
unsigned int h;
+ nullpo_ret(p);
#if defined(SCRIPT_HASH_DJB2)
h = 5381;
while( *p ) // hash*33 + c
@@ -368,6 +374,7 @@ unsigned int calc_hash_ci(const char* p) {
unsigned int h = 0;
#ifdef ENABLE_CASE_CHECK
+ nullpo_ret(p);
#if defined(SCRIPT_HASH_DJB2)
h = 5381;
while( *p ) // hash*33 + c
@@ -422,8 +429,10 @@ int script_search_str(const char* p)
return -1;
}
-void script_casecheck_clear_sub(struct casecheck_data *ccd) {
+void script_casecheck_clear_sub(struct casecheck_data *ccd)
+{
#ifdef ENABLE_CASE_CHECK
+ nullpo_retv(ccd);
if (ccd->str_data) {
aFree(ccd->str_data);
ccd->str_data = NULL;
@@ -453,6 +462,7 @@ const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char
#ifdef ENABLE_CASE_CHECK
int len;
int h = script->calc_hash_ci(p);
+ nullpo_retr(NULL, ccd);
if (ccd->str_hash[h] == 0) {
//empty bucket, add new node here
ccd->str_hash[h] = ccd->str_num;
@@ -744,7 +754,9 @@ const char* script_skip_space(const char* p)
/// Skips a word.
/// A word consists of undercores and/or alphanumeric characters,
/// and valid variable prefixes/postfixes.
-const char* skip_word(const char* p) {
+const char* skip_word(const char* p)
+{
+ nullpo_retr(NULL, p);
// prefix
switch( *p ) {
case '@':// temporary char variable
@@ -759,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
@@ -775,6 +787,7 @@ int add_word(const char* p) {
size_t len;
int i;
+ nullpo_retr(0, p);
// Check for a word
len = script->skip_word(p) - p;
if( len == 0 )
@@ -805,6 +818,7 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom)
int func;
bool macro = false;
+ nullpo_retr(NULL, p);
// is need add check for arg null pointer below?
func = script->add_word(p);
if (script->str_data[func].type == C_FUNC) {
@@ -983,6 +997,7 @@ const char* parse_variable(const char* p)
const char *p2 = NULL;
const char *var = p;
+ nullpo_retr(NULL, p);
if( ( p[0] == '+' && p[1] == '+' && (type = C_ADD_PRE, true) ) // pre ++
|| ( p[0] == '-' && p[1] == '-' && (type = C_SUB_PRE, true) ) // pre --
) {
@@ -1162,9 +1177,12 @@ bool is_number(const char *p) {
*/
int script_string_dup(char *str)
{
- int len = (int)strlen(str);
+ int len;
int pos = script->string_list_pos;
+ nullpo_retr(pos, str);
+ len = (int)strlen(str);
+
while (pos+len+1 >= script->string_list_size) {
script->string_list_size += (1024*1024)/2;
RECREATE(script->string_list,char,script->string_list_size);
@@ -1183,6 +1201,7 @@ const char *parse_simpleexpr(const char *p)
{
p=script->skip_space(p);
+ nullpo_retr(NULL, p);
if (*p == ';' || *p == ',')
disp_error_message("parse_simpleexpr: unexpected end of expression",p);
if (*p == '(') {
@@ -1199,6 +1218,7 @@ const char *parse_simpleexpr(const char *p)
const char *parse_simpleexpr_paren(const char *p)
{
int i = script->syntax.curly_count - 1;
+ nullpo_retr(NULL, p);
if (i >= 0 && script->syntax.curly[i].type == TYPE_ARGLIST)
++script->syntax.curly[i].count;
@@ -1227,6 +1247,7 @@ const char *parse_simpleexpr_number(const char *p)
char *np = NULL;
long long lli;
+ nullpo_retr(NULL, p);
while (*p == '0' && ISDIGIT(p[1]))
p++; // Skip leading zeros, we don't support octal literals
@@ -1247,6 +1268,7 @@ const char *parse_simpleexpr_string(const char *p)
{
const char *start_point = p;
+ nullpo_retr(NULL, p);
do {
p++;
while (*p != '\0' && *p != '"') {
@@ -1337,6 +1359,7 @@ void script_add_translatable_string(const struct script_string_buf *string, cons
{
struct string_translation *st = NULL;
+ nullpo_retv(string);
if (script->syntax.translation_db == NULL
|| (st = strdb_get(script->syntax.translation_db, VECTOR_DATA(*string))) == NULL) {
script->addc(C_STR);
@@ -1376,6 +1399,7 @@ const char* script_parse_subexpr(const char* p,int limit)
{
int op,opl,len;
+ nullpo_retr(NULL, p);
p=script->skip_space(p);
if( *p == '-' ) {
@@ -1441,6 +1465,7 @@ const char* script_parse_subexpr(const char* p,int limit)
*------------------------------------------*/
const char* parse_expr(const char *p)
{
+ nullpo_retr(NULL, p);
switch(*p) {
case ')': case ';': case ':': case '[': case ']':
case '}':
@@ -1457,6 +1482,7 @@ const char* parse_line(const char* p)
{
const char* p2;
+ nullpo_retr(NULL, p);
p=script->skip_space(p);
if(*p==';') {
//Close decision for if(); for(); while();
@@ -1517,6 +1543,7 @@ const char* parse_line(const char* p)
// { ... } Closing process
const char* parse_curly_close(const char* p)
{
+ nullpo_retr(NULL, p);
if(script->syntax.curly_count <= 0) {
disp_error_message("parse_curly_close: unexpected string",p);
return p + 1;
@@ -1577,6 +1604,7 @@ const char* parse_syntax(const char* p)
{
const char *p2 = script->skip_word(p);
+ nullpo_retr(NULL, p);
switch(*p) {
case 'B':
case 'b':
@@ -2006,6 +2034,7 @@ const char* parse_syntax_close(const char *p) {
// If (...) for (...) hoge (); as to make sure closed closed once again
int flag;
+ nullpo_retr(NULL, p);
do {
p = script->parse_syntax_close_sub(p,&flag);
} while(flag);
@@ -2192,6 +2221,7 @@ bool script_get_constant(const char* name, int* value)
{
int n = script->search_str(name);
+ nullpo_retr(false, value);
if( n == -1 || script->str_data[n].type != C_INT )
{// not found or not a constant
return false;
@@ -2261,7 +2291,7 @@ void read_constdb(void)
struct config_setting_t *t;
int i = 0;
- sprintf(filepath, "%s/constants.conf", map->db_path);
+ snprintf(filepath, 256, "%s/constants.conf", map->db_path);
if (!libconfig->load_file(&constants_conf, filepath))
return;
@@ -2706,6 +2736,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
struct map_session_data *script_rid2sd(struct script_state *st)
{
struct map_session_data *sd;
+ nullpo_retr(NULL, st);
if( !( sd = map->id2sd(st->rid) ) ) {
ShowError("script_rid2sd: fatal error ! player not attached!\n");
script->reportfunc(st);
@@ -2756,6 +2787,7 @@ char *get_val_npcscope_str(struct script_state* st, struct reg_db *n, struct scr
}
char *get_val_instance_str(struct script_state* st, const char* name, struct script_data* data) {
+ nullpo_retr(NULL, st);
if (st->instance_id >= 0) {
return (char*)i64db_get(instance->list[st->instance_id].regs.vars, reference_getuid(data));
} else {
@@ -2923,6 +2955,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) {
const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref)
{
struct script_data* data;
+ nullpo_retr(NULL, st);
script->push_val(st->stack, C_NAME, uid, ref);
data = script_getdatatop(st, -1);
script->get_val(st, data);
@@ -2937,14 +2970,18 @@ const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref)
**/
void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct reg_db *ref) {
const char *name = script->get_str(script_getvarid(uid));
- // is here st can be null pointer and st->rid is wrong?
- struct reg_db *src = script->array_src(st, sd ? sd : st->rid ? map->id2sd(st->rid) : NULL, name, ref);
+ struct reg_db *src = NULL;
bool insert = false;
- if (sd && !st) {
- /* when sd comes, st isn't available */
+ if (st == NULL) {
+ // Special case with no st available, only sd
+ nullpo_retv(sd);
+ src = script->array_src(NULL, sd, name, ref);
insert = true;
} else {
+ if (sd == NULL && st->rid != 0)
+ sd = map->id2sd(st->rid); // Retrieve the missing sd
+ src = script->array_src(st, sd, name, ref);
if( is_string_variable(name) ) {
const char *str = script->get_val2(st, uid, ref);
if (str != NULL && *str != '\0')
@@ -3022,6 +3059,8 @@ int script_free_array_db(union DBKey key, struct DBData *data, va_list ap)
* Clears script_array and removes it from script->array_db
**/
void script_array_delete(struct reg_db *src, struct script_array *sa) {
+ nullpo_retv(src);
+ nullpo_retv(sa);
aFree(sa->members);
idb_remove(src->arrays, sa->id);
ers_free(script->array_ers, sa);
@@ -3034,6 +3073,7 @@ void script_array_delete(struct reg_db *src, struct script_array *sa) {
void script_array_remove_member(struct reg_db *src, struct script_array *sa, unsigned int idx) {
unsigned int i, cursor;
+ nullpo_retv(sa);
/* its the only member left, no need to do anything other than delete the array data */
if( sa->size == 1 ) {
script->array_delete(src,sa);
@@ -3058,8 +3098,8 @@ void script_array_remove_member(struct reg_db *src, struct script_array *sa, uns
* @param idx the index of the array member being inserted
**/
void script_array_add_member(struct script_array *sa, unsigned int idx) {
+ nullpo_retv(sa);
RECREATE(sa->members, unsigned int, ++sa->size);
-
sa->members[sa->size - 1] = idx;
}
/**
@@ -3069,23 +3109,28 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) {
struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) {
struct reg_db *src = NULL;
+ nullpo_retr(NULL, name);
switch( name[0] ) {
/* from player */
default: /* char reg */
case '@':/* temp char reg */
case '#':/* account reg */
+ nullpo_retr(NULL, sd);
src = &sd->regs;
break;
case '$':/* map reg */
src = &mapreg->regs;
break;
case '.':/* npc/script */
- if( ref )
+ if (ref != NULL) {
src = ref;
- else
+ } else {
+ nullpo_retr(NULL, st);
src = (name[1] == '@') ? &st->stack->scope : &st->script->local;
+ }
break;
case '\'':/* instance */
+ nullpo_retr(NULL, st);
if( st->instance_id >= 0 ) {
src = &instance->list[st->instance_id].regs;
}
@@ -3112,6 +3157,7 @@ void script_array_update(struct reg_db *src, int64 num, bool empty) {
int id = script_getvarid(num);
unsigned int index = script_getvaridx(num);
+ nullpo_retv(src);
if (!src->arrays) {
src->arrays = idb_alloc(DB_OPT_BASE);
} else {
@@ -3151,6 +3197,7 @@ void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num,
{
if (n)
{
+ nullpo_retv(str);
if (str[0]) {
i64db_put(n->vars, num, aStrdup(str));
if (script_getvaridx(num))
@@ -3180,6 +3227,7 @@ void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num,
void set_reg_instance_str(struct script_state* st, int64 num, const char* name, const char *str)
{
+ nullpo_retv(st);
if (st->instance_id >= 0) {
if (str[0]) {
i64db_put(instance->list[st->instance_id].regs.vars, num, aStrdup(str));
@@ -3198,6 +3246,7 @@ void set_reg_instance_str(struct script_state* st, int64 num, const char* name,
void set_reg_instance_num(struct script_state* st, int64 num, const char* name, int val)
{
+ nullpo_retv(st);
if (st->instance_id >= 0) {
if (val != 0) {
i64db_iput(instance->list[st->instance_id].regs.vars, num, val);
@@ -3230,12 +3279,16 @@ void set_reg_instance_num(struct script_state* st, int64 num, const char* name,
*------------------------------------------*/
int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref)
{
- char prefix = name[0];
+ char prefix;
+ nullpo_ret(name);
+ prefix = name[0];
if (strlen(name) > SCRIPT_VARNAME_LENGTH) {
ShowError("script:set_reg: variable name too long. '%s'\n", name);
- script->reportsrc(st);
- st->state = END;
+ if (st) {
+ script->reportsrc(st);
+ st->state = END;
+ }
return 0;
}
@@ -3418,6 +3471,7 @@ int conv_num(struct script_state *st, struct script_data *data)
/// Increases the size of the stack
void stack_expand(struct script_stack* stack) {
+ nullpo_retv(stack);
stack->sp_max += 64;
stack->stack_data = (struct script_data*)aRealloc(stack->stack_data,
stack->sp_max * sizeof(stack->stack_data[0]) );
@@ -3427,6 +3481,7 @@ void stack_expand(struct script_stack* stack) {
/// Pushes a value into the stack (with reference)
struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref) {
+ nullpo_retr(NULL, stack);
if( stack->sp >= stack->sp_max )
script->stack_expand(stack);
stack->stack_data[stack->sp].type = type;
@@ -3439,6 +3494,7 @@ struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 v
/// Pushes a string into the stack
struct script_data *push_str(struct script_stack *stack, char *str)
{
+ nullpo_retr(NULL, stack);
if( stack->sp >= stack->sp_max )
script->stack_expand(stack);
stack->stack_data[stack->sp].type = C_STR;
@@ -3451,6 +3507,7 @@ struct script_data *push_str(struct script_stack *stack, char *str)
/// Pushes a constant string into the stack
struct script_data *push_conststr(struct script_stack *stack, const char *str)
{
+ nullpo_retr(NULL, stack);
if( stack->sp >= stack->sp_max )
script->stack_expand(stack);
stack->stack_data[stack->sp].type = C_CONSTSTR;
@@ -3462,6 +3519,7 @@ struct script_data *push_conststr(struct script_stack *stack, const char *str)
/// Pushes a retinfo into the stack
struct script_data* push_retinfo(struct script_stack* stack, struct script_retinfo* ri, struct reg_db *ref) {
+ nullpo_retr(NULL, stack);
if( stack->sp >= stack->sp_max )
script->stack_expand(stack);
stack->stack_data[stack->sp].type = C_RETINFO;
@@ -3473,6 +3531,7 @@ struct script_data* push_retinfo(struct script_stack* stack, struct script_retin
/// Pushes a copy of the target position into the stack
struct script_data* push_copy(struct script_stack* stack, int pos) {
+ nullpo_retr(NULL, stack);
switch( stack->stack_data[pos].type ) {
case C_CONSTSTR:
return script->push_conststr(stack, stack->stack_data[pos].u.str);
@@ -3497,10 +3556,13 @@ struct script_data* push_copy(struct script_stack* stack, int pos) {
/// Removes the values in indexes [start,end[ from the stack.
/// Adjusts all stack pointers.
void pop_stack(struct script_state* st, int start, int end) {
- struct script_stack* stack = st->stack;
+ struct script_stack* stack;
struct script_data* data;
int i;
+ nullpo_retv(st);
+ stack = st->stack;
+
if( start < 0 )
start = 0;
if( end > stack->sp )
@@ -3636,6 +3698,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos,
///
/// @param st Script state
void script_free_state(struct script_state* st) {
+ nullpo_retv(st);
if( idb_exists(script->st_db,st->id) ) {
struct map_session_data *sd = st->rid ? map->id2sd(st->rid) : NULL;
@@ -3697,6 +3760,7 @@ void script_free_state(struct script_state* st) {
* @param ref[in] Reference to be added.
*/
void script_add_pending_ref(struct script_state *st, struct reg_db *ref) {
+ nullpo_retv(st);
RECREATE(st->pending_refs, struct reg_db*, ++st->pending_ref_count);
st->pending_refs[st->pending_ref_count-1] = ref;
}
@@ -4133,6 +4197,7 @@ int run_func(struct script_state *st)
struct script_data* data;
int i,start_sp,end_sp,func;
+ nullpo_retr(1, st);
end_sp = st->stack->sp;// position after the last argument
for( i = end_sp-1; i > 0 ; --i )
if( st->stack->stack_data[i].type == C_ARG )
@@ -4280,6 +4345,7 @@ int run_script_timer(int tid, int64 tick, int id, intptr_t data) {
void script_detach_state(struct script_state* st, bool dequeue_event) {
struct map_session_data* sd;
+ nullpo_retv(st);
if(st->rid && (sd = map->id2sd(st->rid))!=NULL) {
sd->st = st->bk_st;
sd->npc_id = st->bk_npcid;
@@ -4313,6 +4379,7 @@ void script_detach_state(struct script_state* st, bool dequeue_event) {
void script_attach_state(struct script_state* st) {
struct map_session_data* sd;
+ nullpo_retv(st);
if(st->rid && (sd = map->id2sd(st->rid))!=NULL)
{
if(st!=sd->st)
@@ -4348,6 +4415,7 @@ void run_script_main(struct script_state *st) {
struct script_stack *stack = st->stack;
struct npc_data *nd;
+ nullpo_retv(st);
script->attach_state(st);
nd = map->id2nd(st->oid);
@@ -4656,6 +4724,7 @@ int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap)
{
struct script_reg_state *src;
+ nullpo_ret(data);
if( data->type != DB_DATA_PTR )/* got no need for those! */
return 0;
@@ -4677,6 +4746,8 @@ int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap)
* Clears a single persistent variable
**/
void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct script_reg_state *data) {
+ nullpo_retv(sd);
+ nullpo_retv(data);
i64db_remove(sd->regs.vars, reg);
if( data->type ) {
@@ -4691,6 +4762,7 @@ void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct sc
}
}
unsigned int *script_array_cpy_list(struct script_array *sa) {
+ nullpo_retr(NULL, sa);
if( sa->size > script->generic_ui_array_size )
script->generic_ui_array_expand(sa->size);
memcpy(script->generic_ui_array, sa->members, sizeof(unsigned int)*sa->size);
@@ -4838,6 +4910,7 @@ void do_final_script(void)
**/
uint8 script_add_language(const char *name) {
uint8 lang_id = script->max_lang_id;
+ nullpo_ret(name);
RECREATE(script->languages, char *, ++script->max_lang_id);
script->languages[lang_id] = aStrdup(name);
@@ -5052,6 +5125,8 @@ int script_load_translation(const char *file, uint8 lang_id)
int lineno = 0;
struct script_string_buf msgid, msgstr;
+ nullpo_ret(file);
+
if ((fp = fopen(file,"rb")) == NULL) {
ShowError("load_translation: failed to open '%s' for reading\n",file);
return 0;
@@ -5343,6 +5418,7 @@ int script_reload(void)
const char *script_getfuncname(struct script_state *st) {
struct script_data *data;
+ nullpo_retr(NULL, st);
data = &st->stack->stack_data[st->start];
if( data->type == C_NAME && script->str_data[data->u.num].type == C_FUNC )
@@ -5372,6 +5448,7 @@ bool script_sprintf(struct script_state *st, int start, struct StringBuf *out)
int lastarg = start;
int argc = script_lastdata(st) + 1;
+ nullpo_retr(-1, out);
Assert_retr(-1, start >= 2 && start <= argc);
Assert_retr(-1, script_hasdata(st, start));
@@ -5405,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)
@@ -5692,6 +5767,7 @@ int menu_countoptions(const char* str, int max_count, int* total)
int count = 0;
int bogus_total;
+ nullpo_ret(str);
if( total == NULL )
total = &bogus_total;
++(*total);
@@ -6315,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 )
@@ -6325,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 {
@@ -6622,7 +6701,8 @@ BUILDIN(itemheal)
}
sd = script->rid2sd(st);
- if (!sd) return true;
+ if (sd == NULL)
+ return true;
pc->itemheal(sd,sd->itemid,hp,sp);
return true;
}
@@ -6644,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;
}
@@ -8023,7 +8106,11 @@ BUILDIN(makeitem2)
void buildin_delitem_delete(struct map_session_data* sd, int idx, int* amount, bool delete_items)
{
int delamount;
- struct item* inv = &sd->status.inventory[idx];
+ struct item* inv;
+
+ nullpo_retv(sd);
+ nullpo_retv(amount);
+ inv = &sd->status.inventory[idx];
delamount = ( amount[0] < inv->amount ) ? amount[0] : inv->amount;
@@ -8050,6 +8137,8 @@ bool buildin_delitem_search(struct map_session_data* sd, struct item* it, bool e
int i, amount;
struct item* inv;
+ nullpo_retr(false, sd);
+ nullpo_retr(false, it);
// prefer always non-equipped items
it->equip = 0;
@@ -9268,7 +9357,7 @@ BUILDIN(bonus) {
val1 = skill->name2id(script_getstr(st, 3));
break;
}
- // else fall through
+ FALLTHROUGH
default:
val1 = script_getnum(st,3);
break;
@@ -9316,7 +9405,8 @@ BUILDIN(bonus) {
return true;
}
-BUILDIN(autobonus) {
+BUILDIN(autobonus)
+{
unsigned int dur;
short rate;
short atk_type = 0;
@@ -9325,7 +9415,7 @@ BUILDIN(autobonus) {
if (sd == NULL)
return true; // no player attached
- if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip )
+ if (status->current_equip_item_index < 0 || sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip)
return true;
rate = script_getnum(st,3);
@@ -9350,7 +9440,8 @@ BUILDIN(autobonus) {
return true;
}
-BUILDIN(autobonus2) {
+BUILDIN(autobonus2)
+{
unsigned int dur;
short rate;
short atk_type = 0;
@@ -9359,7 +9450,7 @@ BUILDIN(autobonus2) {
if (sd == NULL)
return true; // no player attached
- if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip )
+ if (status->current_equip_item_index < 0 || sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip)
return true;
rate = script_getnum(st,3);
@@ -9384,7 +9475,8 @@ BUILDIN(autobonus2) {
return true;
}
-BUILDIN(autobonus3) {
+BUILDIN(autobonus3)
+{
unsigned int dur;
short rate,atk_type;
const char *bonus_script, *other_script = NULL;
@@ -9392,7 +9484,7 @@ BUILDIN(autobonus3) {
if (sd == NULL)
return true; // no player attached
- if( sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip )
+ if (status->current_equip_item_index < 0 || sd->state.autobonus&sd->status.inventory[status->current_equip_item_index].equip)
return true;
rate = script_getnum(st,3);
@@ -9489,6 +9581,9 @@ BUILDIN(guildskill) {
skill_id = ( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
level = script_getnum(st,3);
+ if (skill_id < GD_SKILLBASE || skill_id >= GD_MAX)
+ return true; // not guild skill
+
id = skill_id - GD_SKILLBASE;
max_points = guild->skill_get_max(skill_id);
@@ -11173,6 +11268,7 @@ BUILDIN(getmapusers) {
int buildin_getareausers_sub(struct block_list *bl,va_list ap)
{
int *users=va_arg(ap,int *);
+ nullpo_ret(users);
(*users)++;
return 0;
}
@@ -12003,6 +12099,7 @@ BUILDIN(getwaitingroomstate)
case 0:
for (i = 0; i < cd->users; i++) {
struct map_session_data *sd = cd->usersd[i];
+ nullpo_retr(false, sd);
mapreg->setreg(reference_uid(script->add_str("$@chatmembers"), i), sd->bl.id);
}
script_pushint(st, cd->users);
@@ -12058,6 +12155,7 @@ BUILDIN(warpwaitingpc)
for (i = 0; i < n && cd->users > 0; i++) {
struct map_session_data *sd = cd->usersd[0];
+ nullpo_retr(false, sd);
if (strcmp(map_name,"SavePoint") == 0 && map->list[sd->bl.m].flag.noteleport) {
// can't teleport on this map
break;
@@ -13802,6 +13900,7 @@ int playbgm_foreachpc_sub(struct map_session_data* sd, va_list args)
{
const char* name = va_arg(args, const char*);
+ nullpo_ret(name);
clif->playBGM(sd, name);
return 0;
}
@@ -15119,7 +15218,10 @@ BUILDIN(getrefine)
if (sd == NULL)
return true;
- script_pushint(st,sd->status.inventory[status->current_equip_item_index].refine);
+ if (status->current_equip_item_index < 0)
+ script_pushint(st, 0);
+ else
+ script_pushint(st, sd->status.inventory[status->current_equip_item_index].refine);
return true;
}
@@ -16070,6 +16172,10 @@ BUILDIN(sqrt) //[zBuffer]
{
double i, a;
i = script_getnum(st,2);
+ if (i < 0) {
+ ShowError("sqrt from negative value\n");
+ return false;
+ }
a = sqrt(i);
script_pushint(st,(int)a);
return true;
@@ -18127,7 +18233,8 @@ BUILDIN(bg_getareausers)
return true;
}
-BUILDIN(bg_updatescore) {
+BUILDIN(bg_updatescore)
+{
const char *str;
int16 m;
@@ -18169,7 +18276,8 @@ BUILDIN(bg_get_data)
* Instancing Script Commands
*------------------------------------------*/
-BUILDIN(instance_create) {
+BUILDIN(instance_create)
+{
const char *name;
int owner_id, res;
int type = IOT_PARTY;
@@ -18205,7 +18313,8 @@ BUILDIN(instance_create) {
return true;
}
-BUILDIN(instance_destroy) {
+BUILDIN(instance_destroy)
+{
int instance_id = -1;
if( script_hasdata(st, 2) )
@@ -18304,7 +18413,8 @@ BUILDIN(instance_set_timeout)
return true;
}
-BUILDIN(instance_init) {
+BUILDIN(instance_init)
+{
int instance_id = script_getnum(st, 2);
if( !instance->valid(instance_id) ) {
@@ -18352,7 +18462,8 @@ BUILDIN(instance_announce)
return true;
}
-BUILDIN(instance_npcname) {
+BUILDIN(instance_npcname)
+{
const char *str;
int instance_id = -1;
struct npc_data *nd;
@@ -18376,7 +18487,8 @@ BUILDIN(instance_npcname) {
return true;
}
-BUILDIN(has_instance) {
+BUILDIN(has_instance)
+{
struct map_session_data *sd;
const char *str;
int16 m;
@@ -18465,7 +18577,9 @@ int buildin_instance_warpall_sub(struct block_list *bl, va_list ap)
return 0;
}
-BUILDIN(instance_warpall) {
+
+BUILDIN(instance_warpall)
+{
int16 m;
int instance_id = -1;
const char *mapn;
@@ -18673,10 +18787,12 @@ int buildin_mobuseskill_sub(struct block_list *bl, va_list ap)
return 0;
}
+
/*==========================================
* areamobuseskill "Map Name",<x>,<y>,<range>,<Mob ID>,"Skill Name"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>;
*------------------------------------------*/
-BUILDIN(areamobuseskill) {
+BUILDIN(areamobuseskill)
+{
struct block_list center;
int16 m;
int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
@@ -18741,8 +18857,7 @@ BUILDIN(pushpc)
dir = script_getnum(st,2);
cells = script_getnum(st,3);
- if(dir>7)
- {
+ if (dir > 7) {
ShowWarning("buildin_pushpc: Invalid direction %d specified.\n", dir);
script->reportsrc(st);
@@ -18897,7 +19012,8 @@ BUILDIN(setcashmount)
* Retrieves quantity of arguments provided to callfunc/callsub.
* getargcount() -> amount of arguments received in a function
**/
-BUILDIN(getargcount) {
+BUILDIN(getargcount)
+{
struct script_retinfo* ri;
if( st->stack->defsp < 1 || st->stack->stack_data[st->stack->defsp - 1].type != C_RETINFO ) {
@@ -18911,10 +19027,12 @@ BUILDIN(getargcount) {
return true;
}
+
/**
* getcharip(<account ID>/<character ID>/<character name>)
**/
-BUILDIN(getcharip) {
+BUILDIN(getcharip)
+{
struct map_session_data* sd = NULL;
/* check if a character name is specified */
@@ -18937,7 +19055,7 @@ BUILDIN(getcharip) {
return false;
}
- if (sd->fd == 0 || sockt->session[sd->fd] == NULL || sockt->session[sd->fd]->client_addr == 0) {
+ if (sd->fd <= 0 || sockt->session[sd->fd] == NULL || sockt->session[sd->fd]->client_addr == 0) {
script_pushconststr(st, "");
} else {
uint32 ip = sockt->session[sd->fd]->client_addr;
@@ -18947,10 +19065,12 @@ BUILDIN(getcharip) {
return true;
}
+
/**
* is_function(<function name>) -> 1 if function exists, 0 otherwise
**/
-BUILDIN(is_function) {
+BUILDIN(is_function)
+{
const char* str = script_getstr(st,2);
if( strdb_exists(script->userfunc_db, str) )
@@ -18960,11 +19080,12 @@ BUILDIN(is_function) {
return true;
}
+
/**
* freeloop(<toggle>) -> toggles this script instance's looping-check ability
**/
-BUILDIN(freeloop) {
-
+BUILDIN(freeloop)
+{
if( script_getnum(st,2) )
st->freeloop = 1;
else
@@ -18975,7 +19096,8 @@ BUILDIN(freeloop) {
return true;
}
-BUILDIN(sit) {
+BUILDIN(sit)
+{
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
@@ -18995,7 +19117,8 @@ BUILDIN(sit) {
return true;
}
-BUILDIN(stand) {
+BUILDIN(stand)
+{
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
@@ -19015,7 +19138,8 @@ BUILDIN(stand) {
return true;
}
-BUILDIN(issit) {
+BUILDIN(issit)
+{
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
@@ -19036,7 +19160,8 @@ BUILDIN(issit) {
/**
* @commands (script based)
**/
-BUILDIN(bindatcmd) {
+BUILDIN(bindatcmd)
+{
const char* atcmd;
const char* eventName;
int i, group_lv = 0, group_lv_char = 99;
@@ -19086,7 +19211,8 @@ BUILDIN(bindatcmd) {
return true;
}
-BUILDIN(unbindatcmd) {
+BUILDIN(unbindatcmd)
+{
const char* atcmd;
int i = 0;
@@ -19127,7 +19253,8 @@ BUILDIN(unbindatcmd) {
return true;
}
-BUILDIN(useatcmd) {
+BUILDIN(useatcmd)
+{
struct map_session_data *sd, *dummy_sd = NULL;
int fd;
const char* cmd;
@@ -19165,7 +19292,8 @@ BUILDIN(useatcmd) {
}
/* getrandgroupitem <container_item_id>,<quantity> */
-BUILDIN(getrandgroupitem) {
+BUILDIN(getrandgroupitem)
+{
struct item_data *data = NULL;
struct map_session_data *sd = NULL;
int nameid = script_getnum(st, 2);
@@ -19218,8 +19346,8 @@ BUILDIN(getrandgroupitem) {
/* cleanmap <map_name>;
* cleanarea <map_name>, <x0>, <y0>, <x1>, <y1>; */
-int script_cleanfloor_sub(struct block_list *bl, va_list ap) {
- nullpo_ret(bl);
+int script_cleanfloor_sub(struct block_list *bl, va_list ap)
+{
map->clearflooritem(bl);
return 0;
@@ -19250,6 +19378,7 @@ BUILDIN(cleanmap)
return true;
}
+
/* Cast a skill on the attached player.
* npcskill <skill id>, <skill lvl>, <stat point>, <NPC level>;
* npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */
@@ -19299,7 +19428,8 @@ BUILDIN(npcskill)
/* Turns a player into a monster and grants SC attribute effect. [malufett/Hercules]
* montransform <monster name/id>, <duration>, <sc type>, <val1>, <val2>, <val3>, <val4>; */
-BUILDIN(montransform) {
+BUILDIN(montransform)
+{
int tick;
enum sc_type type;
struct block_list* bl;
@@ -20022,7 +20152,8 @@ BUILDIN(bg_match_over)
return true;
}
-BUILDIN(instance_mapname) {
+BUILDIN(instance_mapname)
+{
const char *map_name;
int m;
short instance_id = -1;
@@ -20042,10 +20173,12 @@ BUILDIN(instance_mapname) {
return true;
}
+
/* modify an instances' reload-spawn point */
/* instance_set_respawn <map_name>,<x>,<y>{,<instance_id>} */
/* returns 1 when successful, 0 otherwise. */
-BUILDIN(instance_set_respawn) {
+BUILDIN(instance_set_respawn)
+{
const char *map_name;
short instance_id = -1;
short mid;
@@ -20086,6 +20219,7 @@ BUILDIN(instance_set_respawn) {
}
return true;
}
+
/**
* @call openshop({NPC Name});
*
@@ -20121,13 +20255,15 @@ BUILDIN(openshop)
return true;
}
+
/**
* @call sellitem <Item_ID>,{,price{,qty}};
*
* adds <Item_ID> (or modifies if present) to shop
* if price not provided (or -1) uses the item's value_sell
**/
-BUILDIN(sellitem) {
+BUILDIN(sellitem)
+{
struct npc_data *nd;
struct item_data *it;
int i = 0, id = script_getnum(st,2);
@@ -20194,6 +20330,7 @@ BUILDIN(sellitem) {
return true;
}
+
/**
* @call stopselling <Item_ID>;
*
@@ -20201,7 +20338,8 @@ BUILDIN(sellitem) {
*
* @return 1 on success, 0 otherwise
**/
-BUILDIN(stopselling) {
+BUILDIN(stopselling)
+{
struct npc_data *nd;
int i, id = script_getnum(st,2);
@@ -20244,6 +20382,7 @@ BUILDIN(stopselling) {
return true;
}
+
/**
* @call setcurrency <Val1>{,<Val2>};
*
@@ -20266,6 +20405,7 @@ BUILDIN(setcurrency)
return true;
}
+
/**
* @call tradertype(<type>);
*
@@ -20273,7 +20413,8 @@ BUILDIN(setcurrency)
* check enum npc_shop_types for list
* cleans shop list on use
**/
-BUILDIN(tradertype) {
+BUILDIN(tradertype)
+{
int type = script_getnum(st, 2);
struct npc_data *nd;
@@ -20309,12 +20450,14 @@ BUILDIN(tradertype) {
return true;
}
+
/**
* @call purchaseok();
*
* signs the transaction can proceed
**/
-BUILDIN(purchaseok) {
+BUILDIN(purchaseok)
+{
struct npc_data *nd;
if( !(nd = map->id2nd(st->oid)) || !nd->u.scr.shop ) {
@@ -20326,12 +20469,14 @@ BUILDIN(purchaseok) {
return true;
}
+
/**
* @call shopcount(<Item_ID>);
*
* @return number of available items in the script's attached shop
**/
-BUILDIN(shopcount) {
+BUILDIN(shopcount)
+{
struct npc_data *nd;
int id = script_getnum(st, 2);
unsigned short i;
@@ -20389,7 +20534,8 @@ BUILDIN(channelmes)
Display script message
showscript "<message>"{,<GID>};
*/
-BUILDIN(showscript) {
+BUILDIN(showscript)
+{
struct block_list *bl = NULL;
const char *msg = script_getstr(st, 2);
int id = 0;
@@ -20426,8 +20572,10 @@ BUILDIN(mergeitem)
return true;
}
+
/** place holder for the translation macro **/
-BUILDIN(_) {
+BUILDIN(_)
+{
return true;
}
@@ -20437,7 +20585,8 @@ BUILDIN(activatepset);
BUILDIN(deactivatepset);
BUILDIN(deletepset);
-BUILDIN(pcre_match) {
+BUILDIN(pcre_match)
+{
const char *input = script_getstr(st, 2);
const char *regex = script_getstr(st, 3);
@@ -20446,6 +20595,48 @@ BUILDIN(pcre_match) {
}
/**
+ * navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
+ */
+BUILDIN(navigateto)
+{
+#if PACKETVER >= 20111010
+ struct map_session_data* sd;
+ const char *mapname;
+ uint16 x = 0;
+ uint16 y = 0;
+ uint16 monster_id = 0;
+ uint8 flag = NAV_KAFRA_AND_AIRSHIP;
+ bool hideWindow = true;
+
+ mapname = script_getstr(st, 2);
+
+ if (script_hasdata(st, 3))
+ x = script_getnum(st, 3);
+ if (script_hasdata(st, 4))
+ y = script_getnum(st, 4);
+ if (script_hasdata(st, 5))
+ flag = (uint8)script_getnum(st, 5);
+ if (script_hasdata(st, 6))
+ hideWindow = script_getnum(st, 6) ? true : false;
+ if (script_hasdata(st, 7))
+ monster_id = script_getnum(st, 7);
+
+ if (script_hasdata(st, 8)) {
+ sd = map->charid2sd(script_getnum(st, 8));
+ } else {
+ sd = script->rid2sd(st);
+ }
+
+ clif->navigate_to(sd, mapname, x, y, flag, hideWindow, monster_id);
+
+ return true;
+#else
+ ShowError("Navigation system works only with packet version >= 20111010");
+ return false;
+#endif
+}
+
+/**
* Adds a built-in script function.
*
* @param buildin Script function data
@@ -20453,7 +20644,8 @@ BUILDIN(pcre_match) {
* (i.e. a plugin overriding a built-in function)
* @return Whether the function was successfully added.
*/
-bool script_add_builtin(const struct script_function *buildin, bool override) {
+bool script_add_builtin(const struct script_function *buildin, bool override)
+{
int n = 0, offset = 0;
size_t slen;
if( !buildin ) {
@@ -20534,7 +20726,8 @@ bool script_add_builtin(const struct script_function *buildin, bool override) {
return true;
}
-bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated) {
+bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated)
+{
struct script_function buildin;
buildin.name = name;
buildin.arg = args;
@@ -20554,6 +20747,7 @@ void script_run_use_script(struct map_session_data *sd, struct item_data *data,
*/
void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid)
{
+ nullpo_retv(data);
script->current_item_id = data->nameid;
script->run(data->script, 0, sd->bl.id, oid);
script->current_item_id = 0;
@@ -21112,6 +21306,9 @@ void script_parse_builtin(void) {
BUILDIN_DEF(purchaseok,""),
BUILDIN_DEF(shopcount, "i"),
+ /* Navigation */
+ BUILDIN_DEF(navigateto, "s??????"),
+
BUILDIN_DEF(channelmes, "ss"),
BUILDIN_DEF(showscript, "s?"),
BUILDIN_DEF(mergeitem,""),
@@ -21128,7 +21325,8 @@ void script_parse_builtin(void) {
#undef BUILDIN_DEF
#undef BUILDIN_DEF2
-void script_label_add(int key, int pos) {
+void script_label_add(int key, int pos)
+{
int idx = script->label_count;
if( script->labels_size == script->label_count ) {
@@ -21265,6 +21463,16 @@ void script_hardcoded_constants(void)
script->set_constant("EQP_SHADOW_ACC_R", EQP_SHADOW_ACC_R, false, false);
script->set_constant("EQP_SHADOW_ACC_L", EQP_SHADOW_ACC_L, false, false);
+ script->constdb_comment("Navigation constants, use with *navigateto*");
+ script->set_constant("NAV_NONE", NAV_NONE, false, false);
+ script->set_constant("NAV_AIRSHIP_ONLY", NAV_AIRSHIP_ONLY, false, false);
+ script->set_constant("NAV_SCROLL_ONLY", NAV_SCROLL_ONLY, false, false);
+ script->set_constant("NAV_AIRSHIP_AND_SCROLL", NAV_AIRSHIP_AND_SCROLL, false, false);
+ script->set_constant("NAV_KAFRA_ONLY", NAV_KAFRA_ONLY, false, false);
+ script->set_constant("NAV_KAFRA_AND_AIRSHIP", NAV_KAFRA_AND_AIRSHIP, false, false);
+ script->set_constant("NAV_KAFRA_AND_SCROLL", NAV_KAFRA_AND_SCROLL, false, false);
+ script->set_constant("NAV_ALL", NAV_ALL, false, false);
+
script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);
@@ -21307,7 +21515,8 @@ void script_hardcoded_constants(void)
/**
* a mapindex_name2id wrapper meant to help with invalid name handling
**/
-unsigned short script_mapindexname2id (struct script_state *st, const char* name) {
+unsigned short script_mapindexname2id (struct script_state *st, const char* name)
+{
unsigned short index;
if( !(index=mapindex->name2id(name)) ) {
@@ -21317,7 +21526,8 @@ unsigned short script_mapindexname2id (struct script_state *st, const char* name
return index;
}
-void script_defaults(void) {
+void script_defaults(void)
+{
// aegis->athena slot position conversion table
unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT,EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L};
diff --git a/src/map/script.h b/src/map/script.h
index c4c082263..a69000991 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -338,6 +338,17 @@ enum {
MF_NOVIEWID
};
+enum navigation_service {
+ NAV_NONE = 0,
+ NAV_AIRSHIP_ONLY = 1,
+ NAV_SCROLL_ONLY = 10,
+ NAV_AIRSHIP_AND_SCROLL = NAV_AIRSHIP_ONLY + NAV_SCROLL_ONLY, //11
+ NAV_KAFRA_ONLY = 100,
+ NAV_KAFRA_AND_AIRSHIP = NAV_KAFRA_ONLY + NAV_AIRSHIP_ONLY, // 101
+ NAV_KAFRA_AND_SCROLL = NAV_KAFRA_ONLY + NAV_SCROLL_ONLY, // 110
+ NAV_ALL = NAV_AIRSHIP_ONLY + NAV_SCROLL_ONLY + NAV_KAFRA_ONLY // 111-255
+};
+
/**
* Structures
**/
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index 560063e8b..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
@@ -27,6 +27,7 @@
#include "map/pc.h" // struct map_session_data
#include "common/cbasetypes.h"
#include "common/memmgr.h" // aMalloc, aRealloc, aFree
+#include "common/nullpo.h" // nullpo_*
#include "common/showmsg.h" // ShowError, ShowWarning
#include "common/strlib.h" // safestrncpy
@@ -34,7 +35,8 @@ struct searchstore_interface searchstore_s;
struct searchstore_interface *searchstore;
/// retrieves search function by type
-static inline searchstore_search_t searchstore_getsearchfunc(unsigned char type) {
+static inline searchstore_search_t searchstore_getsearchfunc(unsigned char type)
+{
switch( type ) {
case SEARCHTYPE_VENDING: return vending->search;
case SEARCHTYPE_BUYING_STORE: return buyingstore->search;
@@ -42,9 +44,9 @@ static inline searchstore_search_t searchstore_getsearchfunc(unsigned char type)
return NULL;
}
-
/// retrieves search-all function by type
-static inline searchstore_searchall_t searchstore_getsearchallfunc(unsigned char type) {
+static inline searchstore_searchall_t searchstore_getsearchallfunc(unsigned char type)
+{
switch( type ) {
case SEARCHTYPE_VENDING: return vending->searchall;
case SEARCHTYPE_BUYING_STORE: return buyingstore->searchall;
@@ -52,9 +54,10 @@ static inline searchstore_searchall_t searchstore_getsearchallfunc(unsigned char
return NULL;
}
-
/// checks if the player has a store by type
-static inline bool searchstore_hasstore(struct map_session_data* sd, unsigned char type) {
+static inline bool searchstore_hasstore(struct map_session_data* sd, unsigned char type)
+{
+ nullpo_retr(false, sd);
switch( type ) {
case SEARCHTYPE_VENDING: return sd->state.vending;
case SEARCHTYPE_BUYING_STORE: return sd->state.buyingstore;
@@ -62,9 +65,10 @@ static inline bool searchstore_hasstore(struct map_session_data* sd, unsigned ch
return false;
}
-
/// returns player's store id by type
-static inline unsigned int searchstore_getstoreid(struct map_session_data* sd, unsigned char type) {
+static inline unsigned int searchstore_getstoreid(struct map_session_data* sd, unsigned char type)
+{
+ nullpo_retr(false, sd);
switch( type ) {
case SEARCHTYPE_VENDING: return sd->vender_id;
case SEARCHTYPE_BUYING_STORE: return sd->buyer_id;
@@ -72,8 +76,9 @@ static inline unsigned int searchstore_getstoreid(struct map_session_data* sd, u
return 0;
}
-
-bool searchstore_open(struct map_session_data* sd, unsigned int uses, unsigned short effect) {
+bool searchstore_open(struct map_session_data* sd, unsigned int uses, unsigned short effect)
+{
+ nullpo_retr(false, sd);
if( !battle_config.feature_search_stores || sd->searchstore.open ) {
return false;
}
@@ -91,7 +96,6 @@ bool searchstore_open(struct map_session_data* sd, unsigned int uses, unsigned s
return true;
}
-
void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const unsigned short* itemlist, unsigned int item_count, const unsigned short* cardlist, unsigned int card_count)
{
unsigned int i;
@@ -105,6 +109,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
return;
}
+ nullpo_retv(sd);
if( !sd->searchstore.open ) {
return;
}
@@ -126,6 +131,9 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
return;
}
+ nullpo_retv(itemlist);
+ nullpo_retv(cardlist);
+
// validate lists
for( i = 0; i < item_count; i++ ) {
if( !itemdb->exists(itemlist[i]) ) {
@@ -200,9 +208,10 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
}
}
-
/// checks whether or not more results are available for the client
-bool searchstore_querynext(struct map_session_data* sd) {
+bool searchstore_querynext(struct map_session_data* sd)
+{
+ nullpo_retr(false, sd);
if( sd->searchstore.count && ( sd->searchstore.count-1 )/SEARCHSTORE_RESULTS_PER_PAGE < sd->searchstore.pages ) {
return true;
}
@@ -210,8 +219,9 @@ bool searchstore_querynext(struct map_session_data* sd) {
return false;
}
-
-void searchstore_next(struct map_session_data* sd) {
+void searchstore_next(struct map_session_data* sd)
+{
+ nullpo_retv(sd);
if( !battle_config.feature_search_stores || !sd->searchstore.open || sd->searchstore.count <= sd->searchstore.pages*SEARCHSTORE_RESULTS_PER_PAGE )
{// nothing (more) to display
return;
@@ -224,8 +234,9 @@ void searchstore_next(struct map_session_data* sd) {
sd->searchstore.pages++;
}
-
-void searchstore_clear(struct map_session_data* sd) {
+void searchstore_clear(struct map_session_data* sd)
+{
+ nullpo_retv(sd);
searchstore->clearremote(sd);
if( sd->searchstore.items ) {// release results
@@ -237,8 +248,9 @@ void searchstore_clear(struct map_session_data* sd) {
sd->searchstore.pages = 0;
}
-
-void searchstore_close(struct map_session_data* sd) {
+void searchstore_close(struct map_session_data* sd)
+{
+ nullpo_retv(sd);
if( sd->searchstore.open ) {
searchstore->clear(sd);
@@ -247,12 +259,13 @@ void searchstore_close(struct map_session_data* sd) {
}
}
-
-void searchstore_click(struct map_session_data* sd, int account_id, int store_id, unsigned short nameid) {
+void searchstore_click(struct map_session_data* sd, int account_id, int store_id, unsigned short nameid)
+{
unsigned int i;
struct map_session_data* pl_sd;
searchstore_search_t store_search;
+ nullpo_retv(sd);
if( !battle_config.feature_search_stores || !sd->searchstore.open || !sd->searchstore.count ) {
return;
}
@@ -313,27 +326,30 @@ void searchstore_click(struct map_session_data* sd, int account_id, int store_id
}
}
-
/// checks whether or not sd has opened account_id's shop remotely
-bool searchstore_queryremote(struct map_session_data* sd, int account_id) {
+bool searchstore_queryremote(struct map_session_data* sd, int account_id)
+{
+ nullpo_retr(false, sd);
return (bool)( sd->searchstore.open && sd->searchstore.count && sd->searchstore.remote_id == account_id );
}
-
/// removes range-check bypassing for remotely opened stores
void searchstore_clearremote(struct map_session_data* sd) {
+ nullpo_retv(sd);
sd->searchstore.remote_id = 0;
}
-
/// receives results from a store-specific callback
bool searchstore_result(struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine)
{
struct s_search_store_info_item* ssitem;
+ nullpo_retr(false, sd);
if( sd->searchstore.count >= (unsigned int)battle_config.searchstore_maxresults ) {// no more
return false;
}
+ nullpo_retr(false, store_name);
+ nullpo_retr(false, card);
ssitem = &sd->searchstore.items[sd->searchstore.count++];
ssitem->store_id = store_id;
@@ -348,7 +364,8 @@ bool searchstore_result(struct map_session_data* sd, unsigned int store_id, int
return true;
}
-void searchstore_defaults (void) {
+void searchstore_defaults (void)
+{
searchstore = &searchstore_s;
searchstore->open = searchstore_open;
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 40001659c..b2d788b57 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -86,6 +86,7 @@ struct skill_interface *skill;
//Since only mob-casted splash skills can hit ice-walls
int skill_splash_target(struct block_list* bl)
{
+ nullpo_retr(BL_CHAR, bl);
#ifndef RENEWAL
return ( bl->type == BL_MOB ) ? BL_SKILL|BL_CHAR : BL_CHAR;
#else // Some skills can now hit ground skills(traps, ice wall & etc.)
@@ -94,7 +95,8 @@ int skill_splash_target(struct block_list* bl)
}
/// Returns the id of the skill, or 0 if not found.
-int skill_name2id(const char* name) {
+int skill_name2id(const char* name)
+{
if( name == NULL )
return 0;
@@ -103,7 +105,8 @@ int skill_name2id(const char* name) {
/// Maps skill ids to skill db offsets.
/// Returns the skill's array index, or 0 (Unknown Skill).
-int skill_get_index( uint16 skill_id ) {
+int skill_get_index (uint16 skill_id)
+{
// avoid ranges reserved for mapping guild/homun/mercenary skills
if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX)
|| (skill_id >= HM_SKILLRANGEMIN && skill_id <= HM_SKILLRANGEMAX)
@@ -128,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);
@@ -215,6 +218,7 @@ int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) {
return 0;
#endif
}
+
int skill_tree_get_max(uint16 skill_id, int b_class)
{
int i;
@@ -227,7 +231,8 @@ int skill_tree_get_max(uint16 skill_id, int b_class)
return skill->get_max(skill_id);
}
-int skill_get_casttype (uint16 skill_id) {
+int skill_get_casttype(uint16 skill_id)
+{
int inf = skill->get_inf(skill_id);
if (inf&(INF_GROUND_SKILL))
return CAST_GROUND;
@@ -243,8 +248,11 @@ int skill_get_casttype (uint16 skill_id) {
return CAST_DAMAGE;
}
-int skill_get_casttype2 (uint16 index) {
- int inf = skill->dbs->db[index].inf;
+int skill_get_casttype2(uint16 index)
+{
+ int inf;
+ Assert_retr(CAST_NODAMAGE, index < MAX_SKILL_DB);
+ inf = skill->dbs->db[index].inf;
if (inf&(INF_GROUND_SKILL))
return CAST_GROUND;
if (inf&INF_SUPPORT_SKILL)
@@ -260,7 +268,8 @@ int skill_get_casttype2 (uint16 index) {
}
//Returns actual skill range taking into account attack range and AC_OWL [Skotlex]
-int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
+int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv)
+{
int range;
struct map_session_data *sd = BL_CAST(BL_PC, bl);
if( bl->type == BL_MOB && battle_config.mob_ai&0x400 )
@@ -356,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
@@ -388,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;
}
@@ -437,6 +454,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
// Making plagiarize check its own function [Aru]
int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* bl)
{
+ nullpo_ret(sd);
// Never copy NPC/Wedding Skills
if (skill->get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL))
return 0;
@@ -456,8 +474,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)] )
@@ -547,6 +568,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
clif->skill_fail(sd,skill_id,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0);
return 1;
}
+ FALLTHROUGH
case MC_IDENTIFY:
return 0; // always allowed
case WZ_ICEWALL:
@@ -631,6 +653,7 @@ int skillnotok_hom(uint16 skill_id, struct homun_data *hd)
int skillnotok_hom_unknown(uint16 skill_id, struct homun_data *hd)
{
+ nullpo_retr(1, hd);
//Use master's criteria.
return skill->not_ok(skill_id, hd->master);
}
@@ -648,10 +671,12 @@ int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md)
return skill->not_ok(skill_id, md->master);
}
-struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y) {
+struct s_skill_unit_layout* skill_get_unit_layout(uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y)
+{
int pos = skill->get_unit_layout_type(skill_id,skill_lv);
uint8 dir;
+ nullpo_retr(&skill->dbs->unit_layout[0], src);
if (pos < -1 || pos >= MAX_SKILL_UNIT_LAYOUT) {
ShowError("skill_get_unit_layout: unsupported layout type %d for skill %d (level %d)\n", pos, skill_id, skill_lv);
pos = cap_value(pos, 0, MAX_SQUARE_LAYOUT); // cap to nearest square layout
@@ -888,6 +913,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
@@ -1401,6 +1430,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;
@@ -2036,7 +2084,8 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in
return where; //Return list of pieces broken.
}
-int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time) {
+int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time)
+{
struct status_change *sc;
const int pos[5] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM, EQP_ACC};
const enum sc_type sc_atk[5] = {SC_NOEQUIPWEAPON, SC_NOEQUIPSHIELD, SC_NOEQUIPARMOR, SC_NOEQUIPHELM, SC__STRIPACCESSARY};
@@ -2062,6 +2111,7 @@ int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int
}
return where?1:0;
}
+
/*=========================================================================
* Used to knock back players, monsters, traps, etc
* 'count' is the number of squares to knock back
@@ -2072,11 +2122,14 @@ 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);
if (src != target && map->list[src->m].flag.noknockback)
return 0; // No knocking
+
+ nullpo_ret(target);
if (count == 0)
return 0; // Actual knockback distance is 0.
@@ -2117,6 +2170,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
}
@@ -2127,10 +2183,12 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in
1 - Regular reflection (Maya)
2 - SL_KAITE reflection
*/
-int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) {
+int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type)
+{
struct status_change *sc = status->get_sc(bl);
struct map_session_data* sd = BL_CAST(BL_PC, bl);
+ nullpo_ret(src);
if( sc && sc->data[SC_KYOMU] ) // Nullify reflecting ability
return 0;
@@ -2174,7 +2232,8 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type)
* client (causes player characters to not scream skill name)
* flag&0x4000 - Return 0 if damage was reflected
*-------------------------------------------------------------------------*/
-int skill_attack(int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
+int skill_attack(int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
+{
struct Damage dmg;
struct status_data *sstatus, *tstatus;
struct status_change *sc;
@@ -2488,6 +2547,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case KO_MUCHANAGE:
if( dmg.dmg_lv == ATK_FLEE )
break;
+ FALLTHROUGH
case WL_SOULEXPANSION:
case WL_COMET:
case NJ_HUUMA:
@@ -2500,6 +2560,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case LG_OVERBRAND:
/* Fall through */
dmg.amotion = status_get_amotion(src) * 2;
+ FALLTHROUGH
case LG_OVERBRAND_PLUSATK:
dmg.dmotion = clif->skill_damage(dsrc,bl,tick,status_get_amotion(src),dmg.dmotion,damage,dmg.div_,skill_id,-1,BDT_SPLASH);
break;
@@ -2558,6 +2619,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
dmg.dmotion = clif->skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, (flag&SD_LEVEL) ? -1 : skill_lv, BDT_SPLASH);
if( dsrc != src ) // avoid damage display redundancy
break;
+ FALLTHROUGH
case HT_LANDMINE:
dmg.dmotion = clif->skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, type);
break;
@@ -2570,6 +2632,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case AB_DUPLELIGHT_MELEE:
case AB_DUPLELIGHT_MAGIC:
dmg.amotion = 300;/* makes the damage value not overlap with previous damage (when displayed by the client) */
+ FALLTHROUGH
default:
skill->attack_display_unknown(&attack_type, src, dsrc, bl, &skill_id, &skill_lv, &tick, &flag, &type, &dmg, &damage);
break;
@@ -2865,15 +2928,27 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
return (int)cap_value(damage,INT_MIN,INT_MAX);
}
-void skill_attack_combo1_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_change_entry *sce, int *combo) {
+void skill_attack_combo1_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_change_entry *sce, int *combo)
+{
if (src == dsrc) // Ground skills are exceptions. [Inkfish]
status_change_end(src, SC_COMBOATTACK, INVALID_TIMER);
}
-void skill_attack_combo2_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *combo) {
+void skill_attack_combo2_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *combo)
+{
}
-void skill_attack_display_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage) {
+void skill_attack_display_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage)
+{
+ nullpo_retv(bl);
+ nullpo_retv(dmg);
+ nullpo_retv(tick);
+ nullpo_retv(flag);
+ nullpo_retv(damage);
+ nullpo_retv(skill_id);
+ nullpo_retv(skill_lv);
+ nullpo_retv(type);
+
if (*flag & SD_ANIMATION && dmg->div_ < 2) //Disabling skill animation doesn't works on multi-hit.
*type = BDT_SPLASH;
if (bl->type == BL_SKILL) {
@@ -2884,15 +2959,24 @@ void skill_attack_display_unknown(int *attack_type, struct block_list* src, stru
dmg->dmotion = clif->skill_damage(dsrc, bl, *tick, dmg->amotion, dmg->dmotion, *damage, dmg->div_, *skill_id, (*flag & SD_LEVEL) ? -1 : *skill_lv, *type);
}
-int skill_attack_copy_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) {
+int skill_attack_copy_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag)
+{
+ nullpo_ret(skill_id);
return *skill_id;
}
-int skill_attack_dir_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) {
+int skill_attack_dir_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag)
+{
return -1;
}
-void skill_attack_blow_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage, int8 *dir) {
+void skill_attack_blow_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage, int8 *dir)
+{
+ nullpo_retv(bl);
+ nullpo_retv(dmg);
+ nullpo_retv(dir);
+ nullpo_retv(damage);
+
skill->blown(dsrc, bl, dmg->blewcount, *dir, 0x0);
if (!dmg->blewcount && bl->type == BL_SKILL && *damage > 0){
struct skill_unit *su = BL_UCAST(BL_SKILL, bl);
@@ -2901,7 +2985,8 @@ void skill_attack_blow_unknown(int *attack_type, struct block_list* src, struct
}
}
-void skill_attack_post_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) {
+void skill_attack_post_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag)
+{
}
/*==========================================
@@ -2909,7 +2994,8 @@ void skill_attack_post_unknown(int *attack_type, struct block_list* src, struct
* Checking bl battle flag and display damage
* then call func with source,target,skill_id,skill_lv,tick,flag
*------------------------------------------*/
-int skill_area_sub(struct block_list *bl, va_list ap) {
+int skill_area_sub(struct block_list *bl, va_list ap)
+{
struct block_list *src;
uint16 skill_id,skill_lv;
int flag;
@@ -2960,6 +3046,7 @@ int skill_check_unit_range_sub(struct block_list *bl, va_list ap)
case AL_PNEUMA:
if(g_skill_id == SA_LANDPROTECTOR)
break;
+ FALLTHROUGH
case MG_SAFETYWALL:
case MH_STEINWAND:
case SC_MAELSTROM:
@@ -3382,6 +3469,7 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) {
skill->blown(src,target,skill->get_blewcount(skl->skill_id, skl->skill_lv), -1, 0x0 );
break;
}
+ FALLTHROUGH
}
default:
skill->timerskill_target_unknown(tid, tick, src, target, ud, skl);
@@ -3392,7 +3480,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);
@@ -3408,6 +3497,7 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) {
map->foreachinarea(skill->cell_overlap,src->m,skl->x-i,skl->y-i,skl->x+i,skl->y+i,BL_SKILL,skl->skill_id,&dummy,src);
}
+ FALLTHROUGH
// fall through ...
case WL_EARTHSTRAIN:
skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag);
@@ -3435,6 +3525,7 @@ bool skill_timerskill_dead_unknown(struct block_list *src, struct unit_data *ud,
void skill_timerskill_target_unknown(int tid, int64 tick, struct block_list *src, struct block_list *target, struct unit_data *ud, struct skill_timerskill *skl)
{
+ nullpo_retv(skl);
skill->attack(skl->type, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag);
}
@@ -3445,7 +3536,8 @@ void skill_timerskill_notarget_unknown(int tid, int64 tick, struct block_list *s
/*==========================================
*
*------------------------------------------*/
-int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag) {
+int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag)
+{
int i;
struct unit_data *ud;
nullpo_retr(1, src);
@@ -3553,6 +3645,7 @@ void skill_castend_type(int type, struct block_list *src, struct block_list *bl,
{
switch (type) {
case CAST_GROUND:
+ nullpo_retv(bl);
skill->castend_pos2(src, bl->x, bl->y, skill_id, skill_lv, tick, flag);
break;
case CAST_NODAMAGE:
@@ -3568,7 +3661,8 @@ void skill_castend_type(int type, struct block_list *src, struct block_list *bl,
*
*
*------------------------------------------*/
-int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
+int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
+{
struct map_session_data *sd = NULL;
struct status_data *tstatus;
struct status_change *sc;
@@ -3906,11 +4000,22 @@ 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:
flag |= SD_PREAMBLE; // a fake packet will be sent for the first target to be hit
+ FALLTHROUGH
case AS_SPLASHER:
case HT_BLITZBEAT:
case AC_SHOWER:
@@ -3958,7 +4063,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
@@ -3973,15 +4080,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:
@@ -4000,13 +4111,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
@@ -4016,6 +4133,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;
@@ -4291,6 +4417,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
if( (tsc = status->get_sc(bl)) && tsc->data[SC_HIDING] )
break;
}
+ FALLTHROUGH
case HVAN_EXPLOSION:
if (src != bl)
skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag);
@@ -4548,6 +4675,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
}
break;
}
+ FALLTHROUGH
case RA_WUGBITE:
if( path->search(NULL,src,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) {
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
@@ -4571,7 +4699,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);
@@ -4823,6 +4951,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){
@@ -4868,6 +5005,10 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
bool skill_castend_damage_id_unknown(struct block_list* src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_data *tstatus, struct status_change *sc)
{
+ nullpo_retr(true, skill_id);
+ nullpo_retr(true, skill_lv);
+ nullpo_retr(true, tick);
+ nullpo_retr(true, tstatus);
ShowWarning("skill_castend_damage_id: Unknown skill used:%d\n", *skill_id);
clif->skill_damage(src, bl, *tick, status_get_amotion(src), tstatus->dmotion,
0, abs(skill->get_num(*skill_id, *skill_lv)),
@@ -4879,7 +5020,8 @@ bool skill_castend_damage_id_unknown(struct block_list* src, struct block_list *
/*==========================================
*
*------------------------------------------*/
-int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
+int skill_castend_id(int tid, int64 tick, int id, intptr_t data)
+{
struct block_list *target, *src;
struct map_session_data *sd;
struct mob_data *md;
@@ -4955,6 +5097,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;
@@ -5223,7 +5367,8 @@ bool skill_castend_id_unknown(struct unit_data *ud, struct block_list *src, stru
/*==========================================
*
*------------------------------------------*/
-int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
+int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
+{
struct map_session_data *sd, *dstsd;
struct mob_data *md, *dstmd;
struct homun_data *hd;
@@ -5300,6 +5445,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0) ;
break ;
}
+ FALLTHROUGH
case AL_HEAL:
/**
@@ -5415,6 +5561,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;
@@ -5444,6 +5594,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;
@@ -5823,6 +5976,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;
@@ -5939,9 +6093,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);
@@ -6166,7 +6329,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sd->devotion[i] = bl->id;
}
- else
+ else if (mer != NULL)
mer->devotion_flag = 1; // Mercenary Devoting Owner
clif->skill_nodamage(src, bl, skill_id, skill_lv,
@@ -6539,7 +6702,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
case RG_STEALCOIN:
if(sd) {
int amount = pc->steal_coin(sd, bl, skill_lv);
- if( amount > 0 ) {
+ if (amount > 0 && dstmd != NULL) {
dstmd->state.provoke_flag = src->id;
mob->target(dstmd, src, skill->get_range2(src, skill_id, skill_lv));
clif->skill_nodamage(src, bl, skill_id, amount, 1);
@@ -6596,7 +6759,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:
@@ -7513,7 +7677,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);
@@ -7539,6 +7703,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
// remove trap should be used instead
break;
// otherwise fall through to below
+ FALLTHROUGH
case UNT_BLASTMINE:
case UNT_SKIDTRAP:
case UNT_LANDMINE:
@@ -7576,7 +7741,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
clif->skill_nodamage(src,bl,skill_id,skill_lv,
sc_start4(src,bl,type,100,skill_lv,skill_id,src->id,skill->get_time(skill_id,skill_lv),1000));
#ifndef RENEWAL
- if (sd) skill->blockpc_start (sd, skill_id, skill->get_time(skill_id, skill_lv)+3000);
+ if (sd)
+ skill->blockpc_start(sd, skill_id, skill->get_time(skill_id, skill_lv) + 3000);
#endif
break;
@@ -8388,7 +8554,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;
@@ -8856,6 +9022,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:
@@ -9385,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 )
@@ -9791,6 +9977,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
SC_MANDRAGORA, SC_HARMONIZE, SC_DEEP_SLEEP, SC_SIREN, SC_SLEEP, SC_CONFUSION, SC_ILLUSION
};
int heal;
+ if (hd == NULL)
+ break;
if(tsc){
int i;
for (i = 0; i < ARRAYLENGTH(scs); i++) {
@@ -9912,6 +10100,8 @@ bool skill_castend_nodamage_id_mado_unknown(struct block_list *src, struct block
bool skill_castend_nodamage_id_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag)
{
+ nullpo_retr(true, skill_id);
+ nullpo_retr(true, skill_lv);
ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n", *skill_id);
clif->skill_nodamage(src, bl, *skill_id, *skill_lv, 1);
map->freeblock_unlock();
@@ -9928,6 +10118,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
struct unit_data *ud = unit->bl2ud(src);
struct mob_data *md;
+ nullpo_ret(src);
nullpo_ret(ud);
sd = BL_CAST(BL_PC , src);
@@ -10094,10 +10285,13 @@ int skill_check_npc_chaospanic(struct block_list *bl, va_list args)
return 1;
}
+
/* skill count without self */
int skill_count_wos(struct block_list *bl, va_list ap)
{
struct block_list* src = va_arg(ap, struct block_list*);
+ nullpo_retr(1, bl);
+ nullpo_retr(1, src);
if( src->id != bl->id ) {
return 1;
}
@@ -10107,8 +10301,10 @@ int skill_count_wos(struct block_list *bl, va_list ap)
/*==========================================
*
*------------------------------------------*/
-int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *mapname) {
+int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *mapname)
+{
nullpo_ret(sd);
+ nullpo_ret(mapname);
//Simplify skill_failed code.
#define skill_failed(sd) ( (sd)->menuskill_id = (sd)->menuskill_val = 0 )
@@ -10245,7 +10441,8 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
/*==========================================
*
*------------------------------------------*/
-int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
+int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
+{
struct map_session_data* sd;
struct status_change* sc;
struct status_change_entry *sce;
@@ -10274,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);
@@ -10342,6 +10540,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
break;
}
+ FALLTHROUGH
case MG_SAFETYWALL:
{
@@ -10351,6 +10550,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
return 0; // Don't consume gems if cast on LP
}
}
+ FALLTHROUGH
case MG_FIREWALL:
case MG_THUNDERSTORM:
@@ -10460,7 +10660,10 @@ 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 )
sc_start(src,src,SC_NO_SWITCH_EQUIP,100,0,skill->get_time(skill_id,skill_lv));
@@ -10512,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);
@@ -10568,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:
{
@@ -11037,7 +11266,8 @@ int skill_dance_overlap_sub(struct block_list *bl, va_list ap)
//Does the song/dance overlapping -> dissonance check. [Skotlex]
//When flag is 0, this unit is about to be removed, cancel the dissonance effect
//When 1, this unit has been positioned, so start the cancel effect.
-int skill_dance_overlap(struct skill_unit* su, int flag) {
+int skill_dance_overlap(struct skill_unit* su, int flag)
+{
if (!su || !su->group || !(su->group->state.song_dance&0x1))
return 0;
@@ -11059,7 +11289,8 @@ int skill_dance_overlap(struct skill_unit* su, int flag) {
* @param flag 1 Revert
* @retval true success
**/
-bool skill_dance_switch(struct skill_unit* su, int flag) {
+bool skill_dance_switch(struct skill_unit* su, int flag)
+{
static int prevflag = 1; // by default the backup is empty
static struct skill_unit_group backup;
struct skill_unit_group* group;
@@ -11115,7 +11346,8 @@ bool skill_dance_switch(struct skill_unit* su, int flag) {
* Initializes and sets a ground skill.
* flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active)
*------------------------------------------*/
-struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) {
+struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag)
+{
struct skill_unit_group *group;
int i,limit,val1=0,val2=0,val3=0;
int target,interval,range,unit_flag,req_item=0;
@@ -11145,9 +11377,10 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
sd = BL_CAST(BL_PC, src);
st = status->get_status_data(src);
+ 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;
@@ -11216,8 +11449,10 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
case HT_ANKLESNARE:
if( flag&2 )
val3 = SC_ESCAPE;
+ FALLTHROUGH
case HT_SHOCKWAVE:
val1=skill_lv*15+10;
+ FALLTHROUGH
case HT_SANDMAN:
case MA_SANDMAN:
case HT_CLAYMORETRAP:
@@ -11242,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 )
@@ -11402,12 +11637,16 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
{
case ELE_FIRE:
subunt++;
+ FALLTHROUGH
case ELE_WATER:
subunt++;
+ FALLTHROUGH
case ELE_POISON:
subunt++;
+ FALLTHROUGH
case ELE_DARK:
subunt++;
+ FALLTHROUGH
case ELE_WIND:
break;
default:
@@ -11444,6 +11683,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
target = BCT_ALL;
val1 = skill_lv + 1;
val2 = 1;
+ FALLTHROUGH
case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector.
case SO_WATER_INSIGNIA:
case SO_FIRE_INSIGNIA:
@@ -11486,6 +11726,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
break;
}
+ nullpo_retr(NULL, layout);
nullpo_retr(NULL, group=skill->init_unitgroup(src,layout->count,skill_id,skill_lv,skill->get_unit_id(skill_id,flag&1)+subunt, limit, interval));
group->val1=val1;
group->val2=val2;
@@ -11626,10 +11867,15 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
return group;
}
-void skill_unitsetting1_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *val1, int *val2, int *val3) {
+void skill_unitsetting1_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *val1, int *val2, int *val3)
+{
}
-void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *unit_flag, int *val1, int *val2, int *val3, struct skill_unit_group *group) {
+void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *unit_flag, int *val1, int *val2, int *val3, struct skill_unit_group *group)
+{
+ nullpo_retv(group);
+ nullpo_retv(val2);
+ nullpo_retv(unit_flag);
if (group->state.song_dance & 0x1)
*val2 = *unit_flag & (UF_DANCE | UF_SONG); //Store whether this is a song/dance
}
@@ -11637,7 +11883,8 @@ void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16
/*==========================================
*
*------------------------------------------*/
-int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick) {
+int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick)
+{
struct skill_unit_group *sg;
struct block_list *ss;
struct status_change *sc;
@@ -11761,6 +12008,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick
case UNT_HERMODE:
if (sg->src_id!=bl->id && battle->check_target(&src->bl,bl,BCT_PARTY|BCT_GUILD) > 0)
status->change_clear_buffs(bl,1); //Should dispell only allies.
+ FALLTHROUGH
case UNT_RICHMANKIM:
case UNT_ETERNALCHAOS:
case UNT_DRUMBATTLEFIELD:
@@ -11779,6 +12027,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick
if (!battle_config.song_timer_reset && sc && sce)
return 0;
// Let it fall through
+ FALLTHROUGH
case UNT_WHISTLE:
case UNT_ASSASSINCROSS:
case UNT_POEMBRAGI:
@@ -11868,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:
@@ -11889,7 +12145,8 @@ void skill_unit_onplace_unknown(struct skill_unit *src, struct block_list *bl, i
/*==========================================
*
*------------------------------------------*/
-int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int64 tick) {
+int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int64 tick)
+{
struct skill_unit_group *sg;
struct block_list *ss;
struct map_session_data *tsd;
@@ -11917,7 +12174,9 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
return 0;
tstatus = status->get_status_data(bl);
+ nullpo_ret(tstatus);
bst = status->get_base_status(bl);
+ nullpo_ret(bst);
type = status->skill2sc(sg->skill_id);
skill_id = sg->skill_id;
@@ -12074,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);
}
@@ -12160,11 +12419,13 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
case UNT_VERDURETRAP:
if( bl->type == BL_PC )// it won't work on players
break;
+ FALLTHROUGH
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
case UNT_CLUSTERBOMB:
if( bl->id == ss->id )// it won't trigger on caster
break;
+ FALLTHROUGH
case UNT_LANDMINE:
case UNT_BLASTMINE:
case UNT_SHOCKWAVE:
@@ -12456,6 +12717,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
case UNT_STEALTHFIELD:
if( bl->id == sg->src_id )
break; // Don't work on Self (video shows that)
+ FALLTHROUGH
case UNT_NEUTRALBARRIER:
sc_start(ss,bl,type,100,sg->skill_lv,sg->interval + 100);
break;
@@ -12646,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;
@@ -12664,7 +12950,8 @@ void skill_unit_onplace_timer_unknown(struct skill_unit *src, struct block_list
/*==========================================
* Triggered when a char steps out of a skill cell
*------------------------------------------*/
-int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) {
+int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick)
+{
struct skill_unit_group *sg;
struct status_change *sc;
struct status_change_entry *sce;
@@ -12729,7 +13016,8 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick)
/*==========================================
* Triggered when a char steps out of a skill group (entirely) [Skotlex]
*------------------------------------------*/
-int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) {
+int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick)
+{
struct status_change *sc;
struct status_change_entry *sce;
enum sc_type type;
@@ -12814,7 +13102,8 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) {
case PF_FOGWALL:
if (sce) {
status_change_end(bl, type, INVALID_TIMER);
- if ((sce=sc->data[SC_BLIND])) {
+ nullpo_retb(sc);
+ if ((sce = sc->data[SC_BLIND])) {
if (bl->type == BL_PC) //Players get blind ended immediately, others have it still for 30 secs. [Skotlex]
status_change_end(bl, SC_BLIND, INVALID_TIMER);
else {
@@ -12842,14 +13131,19 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) {
* flag&1: Invoke onplace function (otherwise invoke onout)
* flag&4: Invoke a onleft call (the unit might be scheduled for deletion)
*------------------------------------------*/
-int skill_unit_effect(struct block_list* bl, va_list ap) {
+int skill_unit_effect(struct block_list* bl, va_list ap)
+{
struct skill_unit* su = va_arg(ap,struct skill_unit*);
- struct skill_unit_group* group = su->group;
+ struct skill_unit_group* group;
int64 tick = va_arg(ap,int64);
unsigned int flag = va_arg(ap,unsigned int);
uint16 skill_id;
bool dissonance;
+ nullpo_ret(bl);
+ nullpo_ret(su);
+ group = su->group;
+
if( (!su->alive && !(flag&4)) || bl->prev == NULL )
return 0;
@@ -12881,7 +13175,8 @@ int skill_unit_effect(struct block_list* bl, va_list ap) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick) {
+int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick)
+{
struct skill_unit_group *sg;
nullpo_ret(src);
@@ -13002,12 +13297,16 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
/*==========================================
* Checks and stores partners for ensemble skills [Skotlex]
*------------------------------------------*/
-int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16* skill_lv, int range, int cast_flag) {
+int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16* skill_lv, int range, int cast_flag)
+{
static int c=0;
static int p_sd[2] = { 0, 0 };
int i;
bool is_chorus = ( skill->get_inf2(skill_id)&INF2_CHORUS_SKILL );
+ nullpo_ret(sd);
+ nullpo_ret(skill_lv);
+
if (!battle_config.player_skill_partner_check || pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
return is_chorus ? MAX_PARTY : 99; //As if there were infinite partners.
@@ -13084,6 +13383,7 @@ int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap)
*------------------------------------------*/
int skill_isammotype (struct map_session_data *sd, int skill_id)
{
+ nullpo_ret(sd);
return (
battle_config.arrow_decrement==2 &&
(sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)) &&
@@ -13123,7 +13423,8 @@ bool skill_is_combo( int skill_id )
return false;
}
-int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
+int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
+{
struct status_data *st;
struct status_change *sc;
struct skill_condition require;
@@ -13220,8 +13521,10 @@ 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:
{
int ret = skill->check_condition_castbegin_off_unknown(sc, &skill_id);
@@ -13328,6 +13631,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case SA_CASTCANCEL:
if(sd->ud.skilltimer == INVALID_TIMER) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -13577,6 +13881,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case GD_EMERGENCYCALL:
// other checks were already done in skillnotok()
if (!sd->status.guild_id || !sd->state.gmaster_flag)
@@ -13599,6 +13904,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case NJ_BUNSINJYUTSU:
if (!(sc && sc->data[SC_NJ_NEN])) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -13637,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);
@@ -13925,6 +14231,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case ST_CART:
if(!pc_iscarton(sd)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_CART,0);
@@ -14018,11 +14325,13 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case ST_MH_GRAPPLING:
if (!(sc && sc->data[SC_STYLE_CHANGE] && sc->data[SC_STYLE_CHANGE]->val2 == MH_MD_GRAPPLING)){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
+ FALLTHROUGH
case ST_PECO:
if (!pc_isridingpeco(sd)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -14089,7 +14398,8 @@ int skill_check_condition_castbegin_unknown(struct status_change *sc, uint16 *sk
return -1;
}
-int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
+int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
+{
struct skill_condition require;
struct status_data *st;
int i;
@@ -14266,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:
@@ -14293,12 +14603,14 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
return 1;
}
-void skill_check_condition_castend_unknown(struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv) {
+void skill_check_condition_castend_unknown(struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv)
+{
}
// type&2: consume items (after skill was used)
// type&1: consume the others (before skill was used)
-int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) {
+int skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type)
+{
struct skill_condition req;
nullpo_ret(sd);
@@ -14379,7 +14691,8 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
return 1;
}
-struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) {
+struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
+{
struct skill_condition req;
struct status_data *st;
struct status_change *sc;
@@ -14421,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:
@@ -14577,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;
@@ -14604,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;
@@ -14724,7 +15038,8 @@ void skill_get_requirement_unknown(struct status_change *sc, struct map_session_
/*==========================================
* Does cast-time reductions based on dex, item bonuses and config setting
*------------------------------------------*/
-int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
+int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv)
+{
int time = skill->get_cast(skill_id, skill_lv);
nullpo_ret(bl);
@@ -14774,11 +15089,13 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
/*==========================================
* Does cast-time reductions based on sc data.
*------------------------------------------*/
-int skill_castfix_sc (struct block_list *bl, int time) {
+int skill_castfix_sc (struct block_list *bl, int time)
+{
struct status_change *sc = status->get_sc(bl);
if( time < 0 )
return 0;
+ nullpo_ret(bl);
if( bl->type == BL_MOB ) // mobs casttime is fixed nothing to alter.
return time;
@@ -14807,7 +15124,9 @@ int skill_castfix_sc (struct block_list *bl, int time) {
//ShowInfo("Castime castfix_sc = %d\n",time);
return time;
}
-int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) {
+
+int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv)
+{
#ifdef RENEWAL_CAST
struct status_change *sc = status->get_sc(bl);
struct map_session_data *sd = BL_CAST(BL_PC,bl);
@@ -14815,6 +15134,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
if( time < 0 )
return 0;
+ nullpo_ret(bl);
if( bl->type == BL_MOB ) // mobs casttime is fixed nothing to alter.
return (int)time;
@@ -14886,6 +15206,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
case WZ_FIREPILLAR:
if(skill_lv < 5)
break;
+ FALLTHROUGH
case HW_GRAVITATION:
case MG_SAFETYWALL:
case MG_STONECURSE:
@@ -14947,7 +15268,8 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
/*==========================================
* Does delay reductions based on dex/agi, sc data, item bonuses, ...
*------------------------------------------*/
-int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
+int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv)
+{
int delaynodex = skill->get_delaynodex(skill_id, skill_lv);
int time = skill->get_delay(skill_id, skill_lv);
struct map_session_data *sd;
@@ -15046,7 +15368,8 @@ struct square {
int val2[5];
};
-void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y) {
+void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y)
+{
nullpo_retv(tc);
if(dir == 0){
@@ -15141,7 +15464,8 @@ void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y)
}
-void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) {
+void skill_brandishspear_dir (struct square* tc, uint8 dir, int are)
+{
int c;
nullpo_retv(tc);
@@ -15159,11 +15483,17 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) {
}
}
-void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
+void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
+{
int c,n=4;
- uint8 dir = map->calc_dir(src,bl->x,bl->y);
+ uint8 dir;
struct square tc;
- int x=bl->x,y=bl->y;
+ int x, y;
+
+ nullpo_retv(bl);
+ x = bl->x;
+ y = bl->y;
+ dir = map->calc_dir(src, x, y);
skill->brandishspear_first(&tc,dir,x,y);
skill->brandishspear_dir(&tc,dir,4);
skill->area_temp[1] = bl->id;
@@ -15208,7 +15538,8 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
/*==========================================
* Weapon Repair [Celest/DracoRPG]
*------------------------------------------*/
-void skill_repairweapon (struct map_session_data *sd, int idx) {
+void skill_repairweapon (struct map_session_data *sd, int idx)
+{
int material;
int materials[4] = {
ITEMID_IRON_ORE,
@@ -15552,10 +15883,12 @@ int skill_frostjoke_scream(struct block_list *bl, va_list ap)
/*==========================================
*
*------------------------------------------*/
-void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag) {
+void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag)
+{
int range = skill->get_unit_range(skill_id,skill_lv);
int x,y;
+ nullpo_retv(src);
for( y = src->bl.y - range; y <= src->bl.y + range; ++y )
for( x = src->bl.x - range; x <= src->bl.x + range; ++x )
map->list[src->bl.m].setcell(src->bl.m, x, y, cell, flag);
@@ -15564,11 +15897,14 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill
/*==========================================
*
*------------------------------------------*/
-int skill_attack_area(struct block_list *bl, va_list ap) {
+int skill_attack_area(struct block_list *bl, va_list ap)
+{
struct block_list *src,*dsrc;
int atk_type,skill_id,skill_lv,flag,type;
int64 tick;
+ nullpo_ret(bl);
+
if(status->isdead(bl))
return 0;
@@ -15648,7 +15984,8 @@ int skill_clear_group (struct block_list *bl, int flag)
/*==========================================
* Returns the first element field found [Skotlex]
*------------------------------------------*/
-struct skill_unit_group *skill_locate_element_field(struct block_list *bl) {
+struct skill_unit_group *skill_locate_element_field(struct block_list *bl)
+{
struct unit_data *ud = unit->bl2ud(bl);
int i;
nullpo_ret(bl);
@@ -15986,7 +16323,8 @@ int skill_trap_splash(struct block_list *bl, va_list ap)
/*==========================================
*
*------------------------------------------*/
-int skill_enchant_elemental_end (struct block_list *bl, int type) {
+int skill_enchant_elemental_end(struct block_list *bl, int type)
+{
struct status_change *sc;
const enum sc_type scs[] = { SC_ENCHANTPOISON, SC_ASPERSIO, SC_PROPERTYFIRE, SC_PROPERTYWATER, SC_PROPERTYWIND, SC_PROPERTYGROUND, SC_PROPERTYDARK, SC_PROPERTYTELEKINESIS, SC_ENCHANTARMS };
int i;
@@ -16006,6 +16344,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
{
bool wall = true;
+ nullpo_retr(false, bl);
if( (bl->type == BL_PC && battle_config.pc_cloak_check_type&1)
|| (bl->type != BL_PC && battle_config.monster_cloak_check_type&1)
) {
@@ -16040,7 +16379,8 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
/**
* Verifies if an user can use SC_CLOAKING
**/
-bool skill_can_cloak(struct map_session_data *sd) {
+bool skill_can_cloak(struct map_session_data *sd)
+{
nullpo_retr(false, sd);
//Avoid cloaking with no wall and low skill level. [Skotlex]
@@ -16071,6 +16411,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
{
bool wall = true;
+ nullpo_retr(false, bl);
if( bl->type == BL_PC ) { //Check for walls.
static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1};
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
@@ -16133,7 +16474,8 @@ bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit)
/*==========================================
*
*------------------------------------------*/
-struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2) {
+struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2)
+{
struct skill_unit *su;
nullpo_retr(NULL, group);
@@ -16185,7 +16527,8 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
/*==========================================
*
*------------------------------------------*/
-int skill_delunit (struct skill_unit* su) {
+int skill_delunit (struct skill_unit* su)
+{
struct skill_unit_group *group;
nullpo_ret(su);
@@ -16506,6 +16849,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list
struct skill_unit_group_tickset *set;
nullpo_ret(bl);
+ nullpo_ret(group);
if (group->interval==-1)
return NULL;
@@ -16540,10 +16884,16 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list
/*==========================================
*
*------------------------------------------*/
-int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) {
- struct skill_unit* su = va_arg(ap,struct skill_unit *);
- struct skill_unit_group* group = su->group;
- int64 tick = va_arg(ap,int64);
+int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap)
+{
+ struct skill_unit* su;
+ struct skill_unit_group* group;
+ int64 tick;
+
+ su = va_arg(ap,struct skill_unit *);
+ nullpo_ret(su);
+ group = su->group;
+ tick = va_arg(ap,int64);
if( !su->alive || bl->prev == NULL )
return 0;
@@ -16566,11 +16916,16 @@ int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) {
*/
int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap)
{
- struct skill_unit* su = DB->data2ptr(data);
- struct skill_unit_group* group = su->group;
+ struct skill_unit* su;
+ struct skill_unit_group* group;
int64 tick = va_arg(ap,int64);
bool dissonance;
- struct block_list* bl = &su->bl;
+ struct block_list* bl;
+
+ su = DB->data2ptr(data);
+ nullpo_ret(su);
+ group = su->group;
+ bl = &su->bl;
if( !su->alive )
return 0;
@@ -16603,6 +16958,7 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap)
skill->delunit(su);
break;
}
+ FALLTHROUGH
case UNT_SKIDTRAP:
case UNT_LANDMINE:
case UNT_SHOCKWAVE:
@@ -16627,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);
}
@@ -16778,7 +17134,8 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap)
/*==========================================
* Executes on all skill units every SKILLUNITTIMER_INTERVAL milliseconds.
*------------------------------------------*/
-int skill_unit_timer(int tid, int64 tick, int id, intptr_t data) {
+int skill_unit_timer(int tid, int64 tick, int id, intptr_t data)
+{
map->freeblock_lock();
skill->unit_db->foreach(skill->unit_db, skill->unit_timer_sub, tick);
@@ -16804,6 +17161,7 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap)
uint16 skill_id;
int i;
+ nullpo_ret(target);
nullpo_ret(bl);
Assert_ret(bl->type == BL_SKILL);
su = BL_UCAST(BL_SKILL, bl);
@@ -16890,7 +17248,8 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap)
* units to figure out when they have left a group.
* flag&4: Force a onleft event (triggered when the bl is killed, for example)
*------------------------------------------*/
-int skill_unit_move(struct block_list *bl, int64 tick, int flag) {
+int skill_unit_move(struct block_list *bl, int64 tick, int flag)
+{
nullpo_ret(bl);
if( bl->prev == NULL )
@@ -16915,7 +17274,8 @@ int skill_unit_move(struct block_list *bl, int64 tick, int flag) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy) {
+int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy)
+{
int i,j;
int64 tick = timer->gettick();
int *m_flag;
@@ -17067,7 +17427,8 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
/*==========================================
*
*------------------------------------------*/
-int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) {
+int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty)
+{
int slot[3];
int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0;
int num = -1; // exclude the recipe
@@ -17262,12 +17623,15 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
case ITEMID_HAGALAZ:
case ITEMID_OTHILA:
D -= 500; //Rank C
+ FALLTHROUGH
case ITEMID_ISA:
case ITEMID_WYRD:
D -= 500; //Rank B
+ FALLTHROUGH
case ITEMID_NAUTHIZ:
case ITEMID_URUZ:
D -= 500; //Rank A
+ FALLTHROUGH
case ITEMID_BERKANA:
case ITEMID_LUX_ANIMA:
D -= 500; //Rank S
@@ -17712,7 +18076,9 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
return 0;
}
-int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
+
+int skill_poisoningweapon(struct map_session_data *sd, int nameid)
+{
sc_type type;
int chance, i;
nullpo_ret(sd);
@@ -17743,7 +18109,8 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
return 0;
}
-void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) {
+void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id)
+{
struct status_change *sc = status->get_sc(bl);
// non-offensive and non-magic skills do not affect the status
@@ -17767,7 +18134,8 @@ void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) {
}
}
-int skill_magicdecoy(struct map_session_data *sd, int nameid) {
+int skill_magicdecoy(struct map_session_data *sd, int nameid)
+{
int x, y, i, class_ = 0, skill_id;
struct mob_data *md;
nullpo_ret(sd);
@@ -17789,16 +18157,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;
}
@@ -17818,7 +18186,8 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
}
// Warlock Spellbooks. [LimitLine/3CeAM]
-int skill_spellbook (struct map_session_data *sd, int nameid) {
+int skill_spellbook(struct map_session_data *sd, int nameid)
+{
int i, max_preserve, skill_id, point;
struct status_change *sc;
@@ -17866,7 +18235,9 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
return 1;
}
-int skill_select_menu(struct map_session_data *sd,uint16 skill_id) {
+
+int skill_select_menu(struct map_session_data *sd,uint16 skill_id)
+{
int id, lv, prob, aslvl = 0, idx = 0;
nullpo_ret(sd);
@@ -18012,6 +18383,7 @@ int skill_changematerial(struct map_session_data *sd, const struct itemlist *ite
return 0;
}
+
/**
* for Royal Guard's LG_TRAMPLE
**/
@@ -18047,10 +18419,12 @@ int skill_destroy_trap(struct block_list *bl, va_list ap)
}
return 0;
}
+
/*==========================================
*
*------------------------------------------*/
-int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) {
+int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data)
+{
struct map_session_data *sd = map->id2sd(id);
struct skill_cd * cd = NULL;
@@ -18102,7 +18476,8 @@ int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) {
* @param tick the length of time the delay should last
* @return 0 if successful, -1 otherwise
*/
-int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) {
+int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
+{
struct skill_cd* cd = NULL;
uint16 idx = skill->get_index(skill_id);
int64 now = timer->gettick();
@@ -18197,7 +18572,9 @@ int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data)
return 1;
}
-int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { // [orn]
+// [orn]
+int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick)
+{
uint16 idx = skill->get_index(skill_id);
nullpo_retr (-1, hd);
@@ -18239,12 +18616,15 @@ int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick)
md->blockskill[idx] = 1;
return timer->add(timer->gettick() + tick, skill->blockmerc_end, md->bl.id, idx);
}
+
/**
* Adds a new skill unit entry for this player to recast after map load
**/
-void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv) {
+void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv)
+{
struct skill_unit_save * sus = NULL;
+ nullpo_retv(sd);
if( idb_exists(skill->usave_db,sd->status.char_id) ) {
idb_remove(skill->usave_db,sd->status.char_id);
}
@@ -18257,9 +18637,12 @@ void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill
return;
}
-void skill_usave_trigger(struct map_session_data *sd) {
+
+void skill_usave_trigger(struct map_session_data *sd)
+{
struct skill_unit_save * sus = NULL;
+ nullpo_retv(sd);
if( ! (sus = idb_get(skill->usave_db,sd->status.char_id)) ) {
return;
}
@@ -18277,6 +18660,8 @@ int skill_split_atoi(char *str, int *val)
{
int i, j, step = 1;
+ nullpo_ret(val);
+
for (i=0; i<MAX_SKILL_LEVEL; i++) {
if (!str) break;
val[i] = atoi(str);
@@ -18595,7 +18980,8 @@ void skill_init_unit_layout_unknown(int skill_idx)
ShowError("unknown unit layout at skill %d\n", skill_idx);
}
-int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) {
+int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id)
+{
int inf = 0;
struct status_change *sc = status->get_sc(bl);
@@ -18742,7 +19128,8 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) {
return 0;
}
-int skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) {
+int skill_get_elemental_type(uint16 skill_id , uint16 skill_lv)
+{
int type = 0;
switch (skill_id) {
@@ -18761,7 +19148,8 @@ int skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) {
* update stored skill cooldowns for player logout
* @param sd the affected player structure
*/
-void skill_cooldown_save(struct map_session_data * sd) {
+void skill_cooldown_save(struct map_session_data * sd)
+{
int i;
struct skill_cd* cd = NULL;
int64 now = 0;
@@ -18789,7 +19177,8 @@ void skill_cooldown_save(struct map_session_data * sd) {
* reload stored skill cooldowns when a player logs in.
* @param sd the affected player structure
*/
-void skill_cooldown_load(struct map_session_data * sd) {
+void skill_cooldown_load(struct map_session_data * sd)
+{
int i;
struct skill_cd* cd = NULL;
int64 now = 0;
@@ -18813,11 +19202,14 @@ void skill_cooldown_load(struct map_session_data * sd) {
}
}
-bool skill_parse_row_producedb(char* split[], int columns, int current) {
+bool skill_parse_row_producedb(char* split[], int columns, int current)
+{
// ProduceItemID,ItemLV,RequireSkill,Requireskill_lv,MaterialID1,MaterialAmount1,......
int x,y;
+ int i;
- int i = atoi(split[0]);
+ nullpo_retr(false, split);
+ i = atoi(split[0]);
if( !i )
return false;
@@ -18834,11 +19226,14 @@ bool skill_parse_row_producedb(char* split[], int columns, int current) {
return true;
}
-bool skill_parse_row_createarrowdb(char* split[], int columns, int current) {
+bool skill_parse_row_createarrowdb(char* split[], int columns, int current)
+{
// SourceID,MakeID1,MakeAmount1,...,MakeID5,MakeAmount5
int x,y;
- int i = atoi(split[0]);
+ int i;
+ nullpo_retr(false, split);
+ i = atoi(split[0]);
if( !i )
return false;
@@ -18851,12 +19246,19 @@ bool skill_parse_row_createarrowdb(char* split[], int columns, int current) {
return true;
}
-bool skill_parse_row_spellbookdb(char* split[], int columns, int current) {
+
+bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
+{
// skill_id,PreservePoints
- uint16 skill_id = atoi(split[0]);
- int points = atoi(split[1]);
- int nameid = atoi(split[2]);
+ uint16 skill_id;
+ int points;
+ int nameid;
+
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
+ points = atoi(split[1]);
+ nameid = atoi(split[2]);
if( !skill->get_index(skill_id) || !skill->get_max(skill_id) )
ShowError("spellbook_db: Invalid skill ID %d\n", skill_id);
@@ -18874,10 +19276,16 @@ bool skill_parse_row_spellbookdb(char* split[], int columns, int current) {
return false;
}
-bool skill_parse_row_improvisedb(char* split[], int columns, int current) {
+
+bool skill_parse_row_improvisedb(char* split[], int columns, int current)
+{
// SkillID,Rate
- uint16 skill_id = atoi(split[0]);
- short j = atoi(split[1]);
+ uint16 skill_id;
+ short j;
+
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
+ j = atoi(split[1]);
if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) {
ShowError("skill_improvise_db: Invalid skill ID %d\n", skill_id);
@@ -18900,10 +19308,14 @@ bool skill_parse_row_improvisedb(char* split[], int columns, int current) {
return true;
}
-bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) {
+
+bool skill_parse_row_magicmushroomdb(char* split[], int column, int current)
+{
// SkillID
- uint16 skill_id = atoi(split[0]);
+ uint16 skill_id;
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) {
ShowError("magicmushroom_db: Invalid skill ID %d\n", skill_id);
return false;
@@ -18918,9 +19330,13 @@ bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) {
return true;
}
-bool skill_parse_row_reproducedb(char* split[], int column, int current) {
- uint16 skill_id = atoi(split[0]);
- uint16 idx = skill->get_index(skill_id);
+bool skill_parse_row_reproducedb(char* split[], int column, int current)
+{
+ uint16 skill_id;
+ uint16 idx;
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
+ idx = skill->get_index(skill_id);
if( !idx )
return false;
@@ -18929,9 +19345,12 @@ bool skill_parse_row_reproducedb(char* split[], int column, int current) {
return true;
}
-bool skill_parse_row_abradb(char* split[], int columns, int current) {
+bool skill_parse_row_abradb(char* split[], int columns, int current)
+{
// skill_id,DummyName,RequiredHocusPocusLevel,Rate
- uint16 skill_id = atoi(split[0]);
+ uint16 skill_id;
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
if( !skill->get_index(skill_id) || !skill->get_max(skill_id) ) {
ShowError("abra_db: Invalid skill ID %d\n", skill_id);
return false;
@@ -18948,12 +19367,16 @@ bool skill_parse_row_abradb(char* split[], int columns, int current) {
return true;
}
-bool skill_parse_row_changematerialdb(char* split[], int columns, int current) {
+bool skill_parse_row_changematerialdb(char* split[], int columns, int current)
+{
// ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5
- uint16 skill_id = atoi(split[0]);
- short j = atoi(split[1]);
+ uint16 skill_id;
+ short j;
int x,y;
+ nullpo_retr(false, split);
+ skill_id = atoi(split[0]);
+ j = atoi(split[1]);
for(x=0; x<MAX_SKILL_PRODUCE_DB; x++){
if( skill->dbs->produce_db[x].nameid == skill_id )
if( skill->dbs->produce_db[x].req_skill == GN_CHANGEMATERIAL )
@@ -18993,9 +19416,10 @@ void skill_config_set_level(struct config_setting_t *conf, int *arr)
{
int i=0;
+ nullpo_retv(arr);
if (config_setting_is_group(conf)) {
for (i=0; i<MAX_SKILL_LEVEL; i++) {
- char level[5];
+ char level[6]; // enough to contain "Lv100" in case of custom MAX_SKILL_LEVEL
sprintf(level, "Lv%d", i+1);
libconfig->setting_lookup_int(conf, level, &arr[i]);
}
@@ -19020,7 +19444,8 @@ void skill_config_set_level(struct config_setting_t *conf, int *arr)
void skill_level_set_value(int *arr, int value)
{
int i=0;
-
+
+ nullpo_retv(arr);
for(i=0; i<MAX_SKILL_LEVEL; i++) {
arr[i] = value;
}
@@ -19030,6 +19455,7 @@ void skill_validate_hittype(struct config_setting_t *conf, struct s_skill_db *sk
{
const char *type = NULL;
+ nullpo_retv(sk);
if (libconfig->setting_lookup_string(conf, "Hit", &type)) {
if (strcmpi(type, "BDT_SKILL") == 0) {
sk->hit = BDT_SKILL;
@@ -19054,6 +19480,7 @@ void skill_validate_skilltype(struct config_setting_t *conf, struct s_skill_db *
{
struct config_setting_t *t = NULL, *tt = NULL;
+ nullpo_retv(sk);
if((t=libconfig->setting_get_member(conf, "SkillType")) && config_setting_is_group(t)) {
int j=0;
while ((tt = libconfig->setting_get_elem(t, j++))) {
@@ -19107,6 +19534,7 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db *
{
struct config_setting_t *t = NULL, *tt = NULL;
+ nullpo_retv(sk);
if ((t=libconfig->setting_get_member(conf, "SkillInfo")) && config_setting_is_group(t)) {
int j=0;
while ((tt = libconfig->setting_get_elem(t, j++))) {
@@ -19232,6 +19660,7 @@ void skill_validate_attacktype(struct config_setting_t *conf, struct s_skill_db
{
const char *type = NULL;
+ nullpo_retv(sk);
if (libconfig->setting_lookup_string(conf, "AttackType", &type)) {
if (!strcmpi(type, "Weapon")) {
sk->skill_type = BF_WEAPON;
@@ -19257,9 +19686,10 @@ void skill_validate_element(struct config_setting_t *conf, struct s_skill_db *sk
const char *type = NULL;
struct config_setting_t *t = NULL;
+ nullpo_retv(sk);
if ((t=libconfig->setting_get_member(conf, "Element")) && config_setting_is_group(t)) {
int j = 0;
- char lv[5];
+ char lv[6]; // enough to contain "Lv100" in case of custom MAX_SKILL_LEVEL
for (j=0; j < MAX_SKILL_LEVEL; j++) {
sprintf(lv, "Lv%d",j+1);
@@ -19303,6 +19733,7 @@ void skill_validate_damagetype(struct config_setting_t *conf, struct s_skill_db
{
struct config_setting_t *t = NULL, *tt = NULL;
+ nullpo_retv(sk);
if ((t=libconfig->setting_get_member(conf, "DamageType")) && config_setting_is_group(t)) {
int j=0;
while ((tt = libconfig->setting_get_elem(t, j++))) {
@@ -19375,6 +19806,7 @@ void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db *
{
struct config_setting_t *t = NULL, *tt = NULL;
+ nullpo_retv(sk);
if ((t=libconfig->setting_get_member(conf, delay?"SkillDelayOptions":"CastTimeOptions")) && config_setting_is_group(t)) {
int j = 0, tmpopt = 0;
while ((tt = libconfig->setting_get_elem(t, j++)) && j < 4) {
@@ -19417,8 +19849,9 @@ void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db *
* @param *sk struct, pointer to s_skill_db
* @return void
*/
-int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk )
+int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk)
{
+ nullpo_ret(sk);
if (strcmpi(type, "NoWeapon") == 0) {
if (on) {
sk->weapon |= 1<<W_FIST;
@@ -19624,15 +20057,16 @@ void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db
struct config_setting_t *tt = NULL;
const char *type = NULL;
+ nullpo_retv(sk);
if ((tt = libconfig->setting_get_member(conf, "WeaponTypes")) && config_setting_is_group(tt)) {
int j = 0;
struct config_setting_t *wpt = NULL;
while ((wpt = libconfig->setting_get_elem(tt, j++)) != NULL) {
- if (skill_validate_weapontype_sub(config_setting_name(wpt), libconfig->setting_get_bool_real(wpt), sk))
+ if (skill->validate_weapontype_sub(config_setting_name(wpt), libconfig->setting_get_bool_real(wpt), sk))
skilldb_invalid_error(config_setting_name(wpt), config_setting_name(tt), sk->nameid);
}
} else if (libconfig->setting_lookup_string(conf, "WeaponTypes", &type)) {
- if (skill_validate_weapontype_sub(type, true, sk))
+ if (skill->validate_weapontype_sub(type, true, sk))
skilldb_invalid_error(type, "WeaponTypes", sk->nameid);
}
}
@@ -19647,6 +20081,7 @@ void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db
*/
int skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk)
{
+ nullpo_ret(sk);
if (strcmpi(type, "A_ARROW") == 0) {
if (on) {
sk->ammo |= 1<<A_ARROW;
@@ -19726,15 +20161,16 @@ void skill_validate_ammotype(struct config_setting_t *conf, struct s_skill_db *s
struct config_setting_t *tt = NULL;
const char *tstr = NULL;
+ nullpo_retv(sk);
if ((tt = libconfig->setting_get_member(conf, "AmmoTypes")) && config_setting_is_group(tt)) {
int j = 0;
struct config_setting_t *amt = { 0 };
while ((amt = libconfig->setting_get_elem(tt, j++))) {
- if (skill_validate_ammotype_sub(config_setting_name(amt), libconfig->setting_get_bool_real(amt), sk))
+ if (skill->validate_ammotype_sub(config_setting_name(amt), libconfig->setting_get_bool_real(amt), sk))
skilldb_invalid_error(config_setting_name(amt), config_setting_name(tt), sk->nameid);
}
} else if( libconfig->setting_lookup_string(conf, "AmmoTypes", &tstr)) {
- if (skill_validate_ammotype_sub(tstr, true, sk))
+ if (skill->validate_ammotype_sub(tstr, true, sk))
skilldb_invalid_error(tstr, "AmmoTypes", sk->nameid);
}
}
@@ -19750,6 +20186,7 @@ void skill_validate_state(struct config_setting_t *conf, struct s_skill_db *sk)
{
const char *type = NULL;
+ nullpo_retv(sk);
if (libconfig->setting_lookup_string(conf, "State", &type) && strcmpi(type,"None") != ST_NONE) {
if ( strcmpi(type,"Hiding") == 0 ) sk->state = ST_HIDING;
else if (strcmpi(type,"Cloaking") == 0 ) sk->state = ST_CLOAKING;
@@ -19790,6 +20227,7 @@ void skill_validate_item_requirements(struct config_setting_t *conf, struct s_sk
{
struct config_setting_t *tt = NULL;
+ nullpo_retv(sk);
if ((tt=libconfig->setting_get_member(conf, "Items")) && config_setting_is_group(conf)) {
int itx=-1;
struct config_setting_t *it;
@@ -19826,6 +20264,7 @@ void skill_validate_unit_target(struct config_setting_t *conf, struct s_skill_db
{
const char *type = NULL;
+ nullpo_retv(sk);
if(libconfig->setting_lookup_string(conf, "Target", &type)) {
if(!strcmpi(type,"NotEnemy")) sk->unit_target = BCT_NOENEMY;
@@ -19865,6 +20304,8 @@ void skill_validate_unit_target(struct config_setting_t *conf, struct s_skill_db
*/
int skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *sk)
{
+ nullpo_ret(type);
+ nullpo_ret(sk);
if (strcmpi(type, "UF_DEFNOTENEMY") == 0) {
if (on) {
sk->unit_flag |= UF_DEFNOTENEMY;
@@ -19961,13 +20402,14 @@ void skill_validate_unit_flag(struct config_setting_t *conf, struct s_skill_db *
{
struct config_setting_t *t = NULL;
+ nullpo_retv(sk);
if ((t=libconfig->setting_get_member(conf, "Flag")) && config_setting_is_group(t)) {
int j=0;
struct config_setting_t *tt = NULL;
while ((tt = libconfig->setting_get_elem(t, j++))) {
const char *name = config_setting_name(tt);
- if (skill_validate_unit_flag_sub(name, libconfig->setting_get_bool_real(tt), sk))
+ if (skill->validate_unit_flag_sub(name, libconfig->setting_get_bool_real(tt), sk))
skilldb_invalid_error(name, config_setting_name(t), sk->nameid);
}
}
@@ -19992,8 +20434,10 @@ void skill_validate_additional_fields(struct config_setting_t *conf, struct s_sk
*/
bool skill_validate_skilldb(struct s_skill_db *sk, const char *source)
{
- int idx = skill->get_index(sk->nameid);
+ int idx;
+ nullpo_retr(false, sk);
+ idx = skill->get_index(sk->nameid);
if (idx == 0) {
ShowWarning("skill_validate_skilldb: Invalid skill Id %d provided in '%s'! ... skipping\n", sk->nameid, source);
ShowInfo("It is possible that the skill Id is 0 or unavailable (interferes with guild/homun/mercenary skill mapping).\n");
@@ -20276,7 +20720,8 @@ bool skill_read_skilldb(const char *filename)
* create_arrow_db.txt
* abra_db.txt
*------------------------------*/
-void skill_readdb(bool minimal) {
+void skill_readdb(bool minimal)
+{
// init skill db structures
db_clear(skill->name2id_db);
@@ -20348,7 +20793,8 @@ void skill_reload(void)
/*==========================================
*
*------------------------------------------*/
-int do_init_skill(bool minimal) {
+int do_init_skill(bool minimal)
+{
skill->name2id_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAX_SKILL_NAME_LENGTH);
skill->read_db(minimal);
@@ -20381,7 +20827,8 @@ int do_init_skill(bool minimal) {
return 0;
}
-int do_final_skill(void) {
+int do_final_skill(void)
+{
db_destroy(skill->name2id_db);
db_destroy(skill->group_db);
db_destroy(skill->unit_db);
@@ -20394,8 +20841,10 @@ int do_final_skill(void) {
ers_destroy(skill->cd_entry_ers);
return 0;
}
+
/* initialize the interface */
-void skill_defaults(void) {
+void skill_defaults(void)
+{
const int skill_enchant_eff[5] = { 10, 14, 17, 19, 20 };
const int skill_deluge_eff[5] = { 5, 9, 12, 14, 15 };
@@ -20605,6 +21054,9 @@ void skill_defaults(void) {
skill->validate_unit_flag = skill_validate_unit_flag;
skill->validate_additional_fields = skill_validate_additional_fields;
skill->validate_skilldb = skill_validate_skilldb;
+ skill->validate_weapontype_sub = skill_validate_weapontype_sub;
+ skill->validate_ammotype_sub = skill_validate_ammotype_sub;
+ skill->validate_unit_flag_sub = skill_validate_unit_flag_sub;
skill->read_skilldb = skill_read_skilldb;
skill->config_set_level = skill_config_set_level;
skill->level_set_value = skill_level_set_value;
diff --git a/src/map/skill.h b/src/map/skill.h
index c37f9ec41..5203c137b 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
**/
@@ -2056,6 +2104,9 @@ struct skill_interface {
void (*validate_unit_flag) (struct config_setting_t *conf, struct s_skill_db *sk);
void (*validate_additional_fields) (struct config_setting_t *conf, struct s_skill_db *sk);
bool (*validate_skilldb) (struct s_skill_db *skt, const char *source);
+ int (*validate_weapontype_sub) (const char *type, bool on, struct s_skill_db *sk);
+ int (*validate_ammotype_sub) (const char *type, bool on, struct s_skill_db *sk);
+ int (*validate_unit_flag_sub) (const char *type, bool on, struct s_skill_db *sk);
bool (*read_skilldb) (const char *filename);
void (*config_set_level) (struct config_setting_t *conf, int *arr);
void (*level_set_value) (int *arr, int value);
diff --git a/src/map/status.c b/src/map/status.c
index 9a76060c5..729b10f52 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
@@ -70,7 +70,8 @@ struct status_interface *status;
* @param skill The skill to look up
* @return The status registered for this skill
**/
-sc_type status_skill2sc(int skill_id) {
+sc_type status_skill2sc(int skill_id)
+{
int idx;
if( (idx = skill->get_index(skill_id)) == 0 ) {
ShowError("status_skill2sc: Unsupported skill id %d\n", skill_id);
@@ -147,7 +148,8 @@ void status_set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag)
status->dbs->Skill2SCTable[idx] = sc;
}
-void initChangeTables(void) {
+void initChangeTables(void)
+{
#define add_sc(skill,sc) status->set_sc((skill),(sc),SI_BLANK,SCB_NONE)
// indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units
#define set_sc_with_vfx(skill, sc, icon, flag) do { status->set_sc((skill), (sc), (icon), (flag)); if((icon) < SI_MAX) status->dbs->RelevantBLTypes[(icon)] |= BL_SCEFFECT; } while(0)
@@ -717,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 );
@@ -995,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;
@@ -1200,13 +1223,16 @@ void initDummyData(void)
//For copying a status_data structure from b to a, without overwriting current Hp and Sp
void status_copy(struct status_data *a, const struct status_data *b)
{
+ nullpo_retv(a);
+ nullpo_retv(b);
memcpy((void*)&a->max_hp, (const void*)&b->max_hp, sizeof(struct status_data)-(sizeof(a->hp)+sizeof(a->sp)));
}
//Sets HP to given value. Flag is the flag passed to status->heal in case
//final value is higher than current (use 2 to make a healing effect display
//on players) It will always succeed (overrides Berserk block), but it can't kill.
-int status_set_hp(struct block_list *bl, unsigned int hp, int flag) {
+int status_set_hp(struct block_list *bl, unsigned int hp, int flag)
+{
struct status_data *st;
if (hp < 1) return 0;
st = status->get_status_data(bl);
@@ -1223,7 +1249,8 @@ int status_set_hp(struct block_list *bl, unsigned int hp, int flag) {
//Sets SP to given value. Flag is the flag passed to status->heal in case
//final value is higher than current (use 2 to make a healing effect display
//on players)
-int status_set_sp(struct block_list *bl, unsigned int sp, int flag) {
+int status_set_sp(struct block_list *bl, unsigned int sp, int flag)
+{
struct status_data *st;
st = status->get_status_data(bl);
@@ -1237,7 +1264,9 @@ int status_set_sp(struct block_list *bl, unsigned int sp, int flag) {
return status_zap(bl, 0, st->sp - sp);
}
-int status_charge(struct block_list* bl, int64 hp, int64 sp) {
+int status_charge(struct block_list* bl, int64 hp, int64 sp)
+{
+ nullpo_retr((int)(hp + sp), bl);
if(!(bl->type&BL_CONSUME))
return (int)(hp+sp); //Assume all was charged so there are no 'not enough' fails.
return status->damage(NULL, bl, hp, sp, 0, 3);
@@ -1248,11 +1277,13 @@ int status_charge(struct block_list* bl, int64 hp, int64 sp) {
//If flag&2, fail if target does not has enough to subtract.
//If flag&4, if killed, mob must not give exp/loot.
//flag will be set to &8 when damaging sp of a dead character
-int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, int64 in_sp, int walkdelay, int flag) {
+int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, int64 in_sp, int walkdelay, int flag)
+{
struct status_data *st;
struct status_change *sc;
int hp,sp;
+ nullpo_ret(target);
/* From here onwards, we consider it a 32-type as the client does not support higher and the value doesn't get through percentage modifiers */
hp = (int)cap_value(in_hp,INT_MIN,INT_MAX);
sp = (int)cap_value(in_sp,INT_MIN,INT_MAX);
@@ -1337,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]
@@ -1485,11 +1517,13 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
//Heals a character. If flag&1, this is forced healing (otherwise stuff like Berserk can block it)
//If flag&2, when the player is healed, show the HP/SP heal effect.
-int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) {
+int status_heal(struct block_list *bl, int64 in_hp, int64 in_sp, int flag)
+{
struct status_data *st;
struct status_change *sc;
int hp,sp;
+ nullpo_ret(bl);
st = status->get_status_data(bl);
if (st == &status->dummy || !st->hp)
@@ -1563,7 +1597,8 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) {
//If rates are < 0, percent is of max HP/SP
//If !flag, this is heal, otherwise it is damage.
//Furthermore, if flag==2, then the target must not die from the subtraction.
-int status_percent_change(struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag) {
+int status_percent_change(struct block_list *src, struct block_list *target, signed char hp_rate, signed char sp_rate, int flag)
+{
struct status_data *st;
unsigned int hp = 0, sp = 0;
@@ -1615,9 +1650,12 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe
return status->heal(target, hp, sp, 0);
}
-int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp) {
+int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp)
+{
struct status_data *st;
unsigned int hp, sp;
+
+ nullpo_ret(bl);
if (!status->isdead(bl)) return 0;
st = status->get_status_data(bl);
@@ -1651,11 +1689,13 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
return 1;
}
-int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int per_sp) {
+int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int per_sp)
+{
struct status_data *st;
unsigned int hp, sp;
if (!status->isdead(bl)) return 0;
+ nullpo_ret(bl);
st = status->get_status_data(bl);
if (st == &status->dummy)
return 0; //Invalid target.
@@ -1697,7 +1737,8 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int
* target MAY Be null, in which case the checks are only to see
* whether the source can cast or not the skill on the ground.
*------------------------------------------*/
-int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) {
+int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag)
+{
struct status_data *st;
struct status_change *sc=NULL, *tsc;
int hide_flag;
@@ -1783,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;
@@ -1802,9 +1844,13 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
switch (sc->data[SC_BLADESTOP]->val1)
{
case 5: if (skill_id == MO_EXTREMITYFIST) break;
+ FALLTHROUGH
case 4: if (skill_id == MO_CHAINCOMBO) break;
+ FALLTHROUGH
case 3: if (skill_id == MO_INVESTIGATE) break;
+ FALLTHROUGH
case 2: if (skill_id == MO_FINGEROFFENSIVE) break;
+ FALLTHROUGH
default: return 0;
}
}
@@ -1946,7 +1992,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
|| (tsc->data[SC_CLOAKINGEXCEED] != NULL && is_detect)
))
return 0;
- if (tsc->data[SC_CAMOUFLAGE] && !(is_boss || is_detect) && (!skill_id || (flag == 0 && src && src->type != BL_PC)))
+ if (tsc->data[SC_CAMOUFLAGE] && !(is_boss || is_detect) && flag == 0)
return 0;
if (tsc->data[SC_STEALTHFIELD] && !is_boss)
return 0;
@@ -1968,6 +2014,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
return 0; // Can't use Weapon endow skills on Mercenary (only Master)
if( skill_id == AM_POTIONPITCHER && ( target->type == BL_MER || target->type == BL_ELEM) )
return 0; // Can't use Potion Pitcher on Mercenaries
+ FALLTHROUGH
default:
//Check for chase-walk/hiding/cloaking opponents.
if( tsc ) {
@@ -1983,12 +2030,14 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
//Skotlex: Calculates the initial status for the given mob
//first will only be false when the mob leveled up or got a GuardUp level.
-int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) {
+int status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt)
+{
struct status_data *mstatus;
struct block_list *mbl = NULL;
int flag=0;
int guardup_lv = 0;
+ nullpo_retr(1, md);
if(opt&SCO_FIRST) { //Set basic level on respawn.
if (md->level > 0 && md->level <= MAX_LEVEL && md->level != md->db->lv)
;
@@ -2216,8 +2265,11 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt)
unsigned int status_get_base_maxsp(const struct map_session_data *sd, const struct status_data *st)
{
- uint64 val = pc->class2idx(sd->status.class_);
+ uint64 val;
+ nullpo_ret(sd);
+ nullpo_ret(st);
+ val = pc->class2idx(sd->status.class_);
val = status->dbs->SP_table[val][sd->status.base_level];
if ( sd->class_&JOBL_UPPER )
@@ -2234,8 +2286,11 @@ unsigned int status_get_base_maxsp(const struct map_session_data *sd, const stru
unsigned int status_get_base_maxhp(const struct map_session_data *sd, const struct status_data *st)
{
- uint64 val = pc->class2idx(sd->status.class_);
+ uint64 val;
+ nullpo_ret(sd);
+ nullpo_ret(st);
+ 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 )
@@ -2256,22 +2311,26 @@ unsigned int status_get_base_maxhp(const struct map_session_data *sd, const stru
return (unsigned int)cap_value(val,0,UINT_MAX);
}
-void status_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_opt opt) {
+void status_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_opt opt)
+{
/* Just used for Plugin to give bonuses. */
return;
}
//Calculates player data from scratch without counting SC adjustments.
//Should be invoked whenever players raise stats, learn passive skills or change equipment.
-int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
+int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
+{
static int calculating = 0; //Check for recursive call preemption. [Skotlex]
struct status_data *bstatus; // pointer to the player's base status
- const struct status_change *sc = &sd->sc;
+ const struct status_change *sc;
struct s_skill b_skill[MAX_SKILL]; // previous skill tree
int b_weight, b_max_weight, b_cart_weight_max, // previous weight
i, k, index, skill_lv,refinedef=0;
int64 i64;
+ nullpo_retr(-1, sd);
+ sc = &sd->sc;
if (++calculating > 10) //Too many recursive calls!
return -1;
@@ -2345,7 +2404,7 @@ 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->class_&JOBL_BABY || (sd->class_&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 (battle_config.character_size&SZ_BIG)
@@ -2357,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->class_&MAPID_BASEMASK) == MAPID_SUMMONER)?RC_BRUTE:RC_PLAYER;
// Autobonus
pc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
@@ -2660,6 +2719,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];
@@ -2697,9 +2758,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;
@@ -2732,6 +2796,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)
@@ -2804,6 +2870,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;
@@ -2836,6 +2904,8 @@ 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 -----
@@ -2844,6 +2914,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
bstatus->flee += skill_lv*(sd->class_&JOBL_2 && (sd->class_&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
@@ -3139,15 +3211,25 @@ 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;
}
-int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt) {
- struct status_data *mstatus = &md->base_status;
- struct s_mercenary *merc = &md->mercenary;
+int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt)
+{
+ struct status_data *mstatus;
+ struct s_mercenary *merc;
+ nullpo_ret(md);
+ mstatus = &md->base_status;
+ merc = &md->mercenary;
if( opt&SCO_FIRST ) {
memcpy(mstatus, &md->db->status, sizeof(struct status_data));
mstatus->mode = MD_CANMOVE|MD_CANATTACK;
@@ -3163,12 +3245,17 @@ int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt
return 0;
}
-int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt) {
- struct status_data *estatus = &ed->base_status;
- struct s_elemental *ele = &ed->elemental;
- struct map_session_data *sd = ed->master;
+int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt)
+{
+ struct status_data *estatus;
+ struct s_elemental *ele;
+ struct map_session_data *sd;
- if ( !sd )
+ nullpo_ret(ed);
+ estatus = &ed->base_status;
+ ele = &ed->elemental;
+ sd = ed->master;
+ if (sd == NULL)
return 0;
if ( opt&SCO_FIRST ) {
@@ -3202,7 +3289,8 @@ int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt
return 0;
}
-int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) {
+int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt)
+{
struct status_data *nstatus;
if (!nd)
@@ -3238,12 +3326,16 @@ int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) {
return 0;
}
-int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) {
- struct status_data *hstatus = &hd->base_status;
- struct s_homunculus *hom = &hd->homunculus;
+int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt)
+{
+ struct status_data *hstatus;
+ struct s_homunculus *hom;
int skill_lv;
int amotion;
+ nullpo_retr(1, hd);
+ hstatus = &hd->base_status;
+ hom = &hd->homunculus;
hstatus->str = hom->str / 10;
hstatus->agi = hom->agi / 10;
hstatus->vit = hom->vit / 10;
@@ -3324,7 +3416,8 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) {
}
//Calculates base regen values.
-void status_calc_regen(struct block_list *bl, struct status_data *st, struct regen_data *regen) {
+void status_calc_regen(struct block_list *bl, struct status_data *st, struct regen_data *regen)
+{
struct map_session_data *sd;
int val, skill_lv, reg_flag;
nullpo_retv(bl);
@@ -3426,6 +3519,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *st, struct reg
//Calculates SC related regen rates.
void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc)
{
+ nullpo_retv(bl);
if (!(bl->type&BL_REGEN) || !regen)
return;
@@ -3532,6 +3626,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)
@@ -3543,13 +3641,16 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str
/// Recalculates parts of an object's battle status according to the specified flags.
/// @param flag bitfield of values from enum scb_flag
-void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
+void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
+{
const struct status_data *bst = status->get_base_status(bl);
struct status_data *st = status->get_status_data(bl);
struct status_change *sc = status->get_sc(bl);
struct map_session_data *sd = BL_CAST(BL_PC,bl);
int temp;
+ nullpo_retv(bl);
+
if (!bst || !st)
return;
@@ -3751,13 +3852,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)
@@ -3816,10 +3919,10 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_MAXSP) {
if( bl->type&BL_PC ) {
st->max_sp = status->get_base_maxsp(sd,st);
- if (sd)
+ if (sd != NULL) {
st->max_sp += bst->max_sp - sd->status.max_sp;
-
- st->max_sp = status->calc_maxsp(&sd->bl, &sd->sc, st->max_sp);
+ st->max_sp = status->calc_maxsp(&sd->bl, &sd->sc, st->max_sp);
+ }
if( st->max_sp > (unsigned int)battle_config.max_sp )
st->max_sp = (unsigned int)battle_config.max_sp;
@@ -3898,10 +4001,17 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
}
#ifdef RENEWAL_ASPD
amotion += (max(0xc3 - amotion, 2) * (st->aspd_rate2 + status->calc_aspd(bl, sc, 2))) / 100;
- amotion = 10 * (200 - amotion) + sd->bonus.aspd_add;
+ amotion = 10 * (200 - amotion);
+ if (sd != NULL) {
+ amotion += sd->bonus.aspd_add;
+ }
#endif
amotion = status->calc_fix_aspd(bl, sc, amotion);
- st->amotion = cap_value(amotion, ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd), 2000);
+ if (sd != NULL) {
+ st->amotion = cap_value(amotion, ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd), 2000);
+ } else {
+ st->amotion = cap_value(amotion, battle_config.max_aspd, 2000);
+ }
st->adelay = 2 * st->amotion;
} else { // mercenary and mobs
@@ -3925,6 +4035,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_REGEN && bl->type&BL_REGEN)
status->calc_regen_rate(bl, status->get_regen_data(bl), sc);
}
+
/// Recalculates parts of an object's base status and battle status according to the specified flags.
/// Also sends updates to the client wherever applicable.
/// @param flag bitfield of values from enum scb_flag
@@ -3934,6 +4045,7 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca
struct status_data bst; // previous battle status
struct status_data *st; // pointer to current battle status
+ nullpo_retv(bl);
if (bl->type == BL_PC) {
struct map_session_data *sd = BL_UCAST(BL_PC, bl);
if (sd->delayed_damage != 0) {
@@ -4111,11 +4223,16 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca
clif->mercenary_updatestatus(ed->master, SP_SP);
}
}
+
//Checks whether the source can see and chase target.
-int status_check_visibility(struct block_list *src, struct block_list *target) {
+int status_check_visibility(struct block_list *src, struct block_list *target)
+{
int view_range;
struct status_change *tsc = NULL;
+ nullpo_ret(src);
+ nullpo_ret(target);
+
switch ( src->type ) {
case BL_MOB:
view_range = BL_UCCAST(BL_MOB, src)->min_chase;
@@ -4160,11 +4277,16 @@ int status_check_visibility(struct block_list *src, struct block_list *target) {
}
// Basic ASPD value
-int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) {
+int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
+{
int amotion;
#ifdef RENEWAL_ASPD /* [malufett/Hercules] */
float temp;
int skill_lv, val = 0;
+
+ nullpo_ret(sd);
+ nullpo_ret(st);
+
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;
@@ -4210,9 +4332,12 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
return amotion;
}
-unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st) {
+unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st)
+{
int flag = 0, str, dex, dstr;
+ nullpo_ret(bl);
+ nullpo_ret(st);
if ( !(bl->type&battle_config.enable_baseatk) )
return 0;
@@ -4269,16 +4394,21 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
unsigned short status_base_matk_min(const struct status_data *st)
{
- return st->int_ + (st->int_ / 7) * (st->int_ / 7);
+ nullpo_ret(st);
+ return st->int_ + (st->int_ / 7) * (st->int_ / 7);
}
unsigned short status_base_matk_max(const struct status_data *st)
{
- return st->int_ + (st->int_ / 5)*(st->int_ / 5);
+ nullpo_ret(st);
+ return st->int_ + (st->int_ / 5)*(st->int_ / 5);
}
-unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level) {
+unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level)
+{
#ifdef RENEWAL
+ nullpo_ret(bl);
+ nullpo_ret(st);
switch ( bl->type ) {
case BL_MOB:
return st->int_ + level;
@@ -4296,7 +4426,10 @@ unsigned short status_base_matk(struct block_list *bl, const struct status_data
}
//Fills in the misc data that can be calculated from the other status info (except for level)
-void status_calc_misc(struct block_list *bl, struct status_data *st, int level) {
+void status_calc_misc(struct block_list *bl, struct status_data *st, int level)
+{
+ nullpo_retv(bl);
+ nullpo_retv(st);
//Non players get the value set, players need to stack with previous bonuses.
if ( bl->type != BL_PC )
st->batk =
@@ -4494,9 +4627,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);
}
@@ -4553,6 +4689,7 @@ unsigned short status_calc_vit(struct block_list *bl, struct status_change *sc,
unsigned short status_calc_int(struct block_list *bl, struct status_change *sc, int int_)
{
+ nullpo_ret(bl);
if(!sc || !sc->count)
return cap_value(int_,0,USHRT_MAX);
@@ -4619,6 +4756,7 @@ unsigned short status_calc_int(struct block_list *bl, struct status_change *sc,
unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, int dex)
{
+ nullpo_ret(bl);
if(!sc || !sc->count)
return cap_value(dex,0,USHRT_MAX);
@@ -4679,7 +4817,9 @@ unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc,
return (unsigned short)cap_value(dex,0,USHRT_MAX);
}
-unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, int luk) {
+unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, int luk)
+{
+ nullpo_ret(bl);
if (!sc || !sc->count)
return cap_value(luk, 0, USHRT_MAX);
@@ -4731,8 +4871,10 @@ unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc,
return (unsigned short)cap_value(luk, 0, USHRT_MAX);
}
+
unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable)
{
+ nullpo_ret(bl);
if(!sc || !sc->count)
return cap_value(batk,0,USHRT_MAX);
@@ -4823,11 +4965,15 @@ 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);
}
unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable)
{
+ nullpo_ret(bl);
if(!sc || !sc->count)
return cap_value(watk,0,USHRT_MAX);
@@ -4914,12 +5060,15 @@ 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);
}
-unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) {
-#ifdef RENEWAL
+unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk)
+{
+#ifdef RENEWAL
if (!sc || !sc->count)
return cap_value(matk,0,USHRT_MAX);
if (sc->data[SC_PLUSMAGICPOWER])
@@ -4940,13 +5089,16 @@ 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;
#endif
}
-unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) {
+unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable)
+{
if (!sc || !sc->count)
return cap_value(matk,0,USHRT_MAX);
@@ -5015,8 +5167,8 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc,
return (unsigned short)cap_value(matk, 0, USHRT_MAX);
}
-signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) {
-
+signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable)
+{
if (!sc || !sc->count)
return cap_value(critical, 10, SHRT_MAX);
@@ -5111,7 +5263,9 @@ signed short status_calc_hit(struct block_list *bl, struct status_change *sc, in
return (short)cap_value(hit, 1, SHRT_MAX);
}
-signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) {
+signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable)
+{
+ nullpo_retr(1, bl);
if (bl->type == BL_PC) {
if (map_flag_gvg2(bl->m))
@@ -5227,8 +5381,10 @@ signed short status_calc_flee2(struct block_list *bl, struct status_change *sc,
return (short)cap_value(flee2,10,SHRT_MAX);
}
+
defType status_calc_def(struct block_list *bl, struct status_change *sc, int def, bool viewable)
{
+ nullpo_retr(DEFTYPE_MIN, bl);
if (!sc || !sc->count)
return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX);
@@ -5333,6 +5489,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def
signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2, bool viewable)
{
+ nullpo_retr(1, bl);
if(!sc || !sc->count)
#ifdef RENEWAL
return (short)cap_value(def2,SHRT_MIN,SHRT_MAX);
@@ -5407,7 +5564,8 @@ signed short status_calc_def2(struct block_list *bl, struct status_change *sc, i
#endif
}
-defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef, bool viewable) {
+defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef, bool viewable)
+{
if(!sc || !sc->count)
return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX);
@@ -5619,6 +5777,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 );
@@ -5669,6 +5829,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;
}
@@ -5701,10 +5863,12 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
// flag&1 - fixed value [malufett]
// flag&2 - percentage value
-short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag) {
+short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag)
+{
#ifdef RENEWAL_ASPD
int pots = 0, bonus = 0;
+ nullpo_ret(bl);
if (!sc || !sc->count)
return 0;
@@ -5831,7 +5995,9 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl
#endif
}
-short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int aspd) {
+short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int aspd)
+{
+ nullpo_ret(bl);
if (!sc || !sc->count)
return cap_value(aspd, 0, 2000);
@@ -5853,6 +6019,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int
{
int i;
+ nullpo_ret(bl);
if(!sc || !sc->count)
return cap_value(aspd_rate,0,SHRT_MAX);
@@ -5993,6 +6160,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int
unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *sc, int dmotion)
{
+ nullpo_ret(bl);
// It has been confirmed on official servers that MvP mobs have no dmotion even without endure
if (bl->type == BL_MOB && (BL_UCCAST(BL_MOB, bl)->status.mode&MD_BOSS))
return 0;
@@ -6008,7 +6176,8 @@ unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *
return (unsigned short)cap_value(dmotion,0,USHRT_MAX);
}
-unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, uint64 maxhp) {
+unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, uint64 maxhp)
+{
if (!sc || !sc->count)
return (unsigned int)cap_value(maxhp, 1, UINT_MAX);
@@ -6087,8 +6256,8 @@ unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc,
return (unsigned int)cap_value(maxhp, 1, UINT_MAX);
}
-unsigned int status_calc_maxsp(struct block_list *bl, struct status_change *sc, unsigned int maxsp) {
-
+unsigned int status_calc_maxsp(struct block_list *bl, struct status_change *sc, unsigned int maxsp)
+{
if (!sc || !sc->count)
return cap_value(maxsp, 1, UINT_MAX);
@@ -6349,7 +6518,9 @@ struct status_data *status_get_base_status(struct block_list *bl)
return NULL;
}
}
-defType status_get_def(struct block_list *bl) {
+
+defType status_get_def(struct block_list *bl)
+{
struct unit_data *ud;
struct status_data *st = status->get_status_data(bl);
int def = st ? st->def : 0;
@@ -6362,6 +6533,7 @@ defType status_get_def(struct block_list *bl) {
unsigned short status_get_speed(struct block_list *bl)
{
+ nullpo_ret(bl);
if (bl->type == BL_NPC) //Only BL with speed data but no status_data [Skotlex]
return BL_UCCAST(BL_NPC, bl)->speed;
return status->get_status_data(bl)->speed;
@@ -6571,7 +6743,8 @@ int status_get_race2(const struct block_list *bl)
return 0;
}
-int status_isdead(struct block_list *bl) {
+int status_isdead(struct block_list *bl)
+{
nullpo_ret(bl);
return status->get_status_data(bl)->hp == 0;
}
@@ -6773,7 +6946,8 @@ struct status_change *status_get_sc(struct block_list *bl)
return NULL;
}
-void status_change_init(struct block_list *bl) {
+void status_change_init(struct block_list *bl)
+{
struct status_change *sc = status->get_sc(bl);
nullpo_retv(sc);
memset(sc, 0, sizeof (struct status_change));
@@ -6785,7 +6959,8 @@ void status_change_init(struct block_list *bl) {
* @see status_change_start for the expected parameters.
* @return the adjusted duration based on flag values.
*/
-int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) {
+int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag)
+{
//Percentual resistance: 10000 = 100% Resist
//Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms
int sc_def = 0, tick_def = -1; //-1 = use sc_def
@@ -6839,6 +7014,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
sd = BL_CAST(BL_PC,bl);
st = status->get_status_data(bl);
bst = status->get_base_status(bl);
+ nullpo_ret(bst);
sc = status->get_sc(bl);
if( sc && !sc->count )
sc = NULL;
@@ -7142,11 +7318,14 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
#undef SCDEF_LVL_CAP
#undef SCDEF_LVL_DIFF
}
+
/* [Ind/Hercules] fast-checkin sc-display array */
-void status_display_add(struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3) {
+void status_display_add(struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3)
+{
struct sc_display_entry *entry;
int i;
+ nullpo_retv(sd);
for( i = 0; i < sd->sc_display_count; i++ ) {
if( sd->sc_display[i]->type == type )
break;
@@ -7169,9 +7348,12 @@ void status_display_add(struct map_session_data *sd, enum sc_type type, int dval
RECREATE(sd->sc_display, struct sc_display_entry *, ++sd->sc_display_count);
sd->sc_display[ sd->sc_display_count - 1 ] = entry;
}
-void status_display_remove(struct map_session_data *sd, enum sc_type type) {
+
+void status_display_remove(struct map_session_data *sd, enum sc_type type)
+{
int i;
+ nullpo_retv(sd);
for( i = 0; i < sd->sc_display_count; i++ ) {
if( sd->sc_display[i]->type == type )
break;
@@ -7218,7 +7400,8 @@ void status_display_remove(struct map_session_data *sd, enum sc_type type) {
* @retval 0 if no status change happened.
* @retval 1 if the status change was successfully applied.
*/
-int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag) {
+int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag)
+{
struct map_session_data *sd = NULL;
struct status_change* sc;
struct status_change_entry* sce;
@@ -7341,8 +7524,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_GOLDENE_FERSE:
if ((type==SC_GOLDENE_FERSE && sc->data[SC_ANGRIFFS_MODUS])
|| (type==SC_ANGRIFFS_MODUS && sc->data[SC_GOLDENE_FERSE])
- )
+ ) {
return 0;
+ }
+ FALLTHROUGH
case SC_VACUUM_EXTREME:
if(sc->data[SC_HALLUCINATIONWALK])
return 0;
@@ -7350,10 +7535,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_STONE:
if(sc->data[SC_POWER_OF_GAIA])
return 0;
+ FALLTHROUGH
case SC_FREEZE:
//Undead are immune to Freeze/Stone
if (undead_flag && !(flag&SCFLAG_NOAVOID))
return 0;
+ FALLTHROUGH
case SC_SLEEP:
case SC_STUN:
case SC_FROSTMISTY:
@@ -7380,12 +7567,14 @@ 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;
case SC_OVERTHRUST:
if (sc->data[SC_OVERTHRUSTMAX])
return 0; // Overthrust can't take effect if under Max Overthrust. [Skotlex]
+ FALLTHROUGH
case SC_OVERTHRUSTMAX:
if (sc->option&OPTION_MADOGEAR)
return 0; // Overthrust and Overthrust Max cannot be used on Mado Gear [Ind]
@@ -7411,6 +7600,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_TWOHANDQUICKEN:
if (sc->data[SC_DEC_AGI])
return 0;
+ FALLTHROUGH
case SC_CONCENTRATION:
case SC_SPEARQUICKEN:
case SC_TRUESIGHT:
@@ -7419,6 +7609,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_ASSNCROS:
if (sc->option&OPTION_MADOGEAR)
return 0; // Mado is immune to wind walk, cart boost, etc (others above) [Ind]
+ FALLTHROUGH
case SC_INC_AGI:
if (sc->data[SC_QUAGMIRE])
return 0;
@@ -7640,12 +7831,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:
@@ -7656,7 +7847,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;
}
}
@@ -7683,11 +7876,13 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
status_change_end(bl, SC_CONCENTRATION, INVALID_TIMER);
status_change_end(bl, SC_TRUESIGHT, INVALID_TIMER);
status_change_end(bl, SC_WINDWALK, INVALID_TIMER);
+ FALLTHROUGH
//Also blocks the ones below...
case SC_DEC_AGI:
case SC_ADORAMUS:
status_change_end(bl, SC_CARTBOOST, INVALID_TIMER);
//Also blocks the ones below...
+ FALLTHROUGH
case SC_DONTFORGETME:
status_change_end(bl, SC_INC_AGI, INVALID_TIMER);
status_change_end(bl, SC_ADRENALINE, INVALID_TIMER);
@@ -8008,6 +8203,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_LERADS_DEW:
if (sc && sc->data[SC_BERSERK])
return 0;
+ FALLTHROUGH
case SC_SHAPESHIFT:
case SC_PROPERTYWALK:
break;
@@ -8020,6 +8216,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_JOINTBEAT:
val2 |= sce->val2; // stackable ailments
+ FALLTHROUGH
default:
if(sce->val1 > val1)
return 1; //Return true to not mess up skill animations. [Skotlex]
@@ -8033,6 +8230,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_ADORAMUS:
sc_start(src,bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1));
// Fall through to SC_INC_AGI
+ FALLTHROUGH
case SC_DEC_AGI:
case SC_INC_AGI:
val2 = 2 + val1; //Agi change
@@ -8045,12 +8243,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);
}
}
}
@@ -8116,6 +8314,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_ENCHANTPOISON:
val2= 250+50*val1; //Poisoning Chance (2.5+0.5%) in 1/10000 rate
+ FALLTHROUGH
case SC_ASPERSIO:
case SC_PROPERTYFIRE:
case SC_PROPERTYWATER:
@@ -8148,12 +8347,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);
}
}
}
@@ -8412,12 +8611,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);
}
}
}
@@ -8622,6 +8821,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
switch (val1) {
case 3: //33*3 + 1 -> 100%
val2++;
+ FALLTHROUGH
case 1:
case 2: //33, 66%
val2 += 33*val1;
@@ -8702,6 +8902,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_ADRENALINE2:
case SC_ADRENALINE:
val3 = (val2) ? 300 : 200; // aspd increase
+ FALLTHROUGH
case SC_WEAPONPERFECT:
if(sd && pc->checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
@@ -9397,17 +9598,20 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_WILD_STORM:
case SC_UPHEAVAL:
val2 += 10;
+ FALLTHROUGH
case SC_HEATER:
case SC_COOLER:
case SC_BLAST:
case SC_CURSED_SOIL:
val2 += 10;
+ FALLTHROUGH
case SC_PYROTECHNIC:
case SC_AQUAPLAY:
case SC_GUST:
case SC_PETROLOGY:
val2 += 5;
val3 += 9000;
+ FALLTHROUGH
case SC_CIRCLE_OF_FIRE:
case SC_WATER_SCREEN:
case SC_WIND_STEP:
@@ -9489,6 +9693,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
break;
case SC_KAGEMUSYA:
val3 = val1 * 2;
+ FALLTHROUGH
case SC_IZAYOI:
val2 = tick/1000;
tick_time = 1000;
@@ -9602,6 +9807,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;
@@ -9612,6 +9818,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 && (sd->class_&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...?
@@ -9795,14 +10031,17 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
case SC_DEEP_SLEEP:
if (sd && pc_issit(sd)) //Avoid sprite sync problems.
pc->setstand(sd);
+ FALLTHROUGH
case SC_TRICKDEAD:
status_change_end(bl, SC_DANCING, INVALID_TIMER);
// Cancel cast when get status [LuzZza]
if (battle_config.sc_castcancel&bl->type)
unit->skillcastcancel(bl, 0);
+ FALLTHROUGH
case SC_FALLENEMPIRE:
case SC_WHITEIMPRISON:
unit->stop_attack(bl);
+ FALLTHROUGH
case SC_STOP:
case SC_CONFUSION:
case SC_RG_CCONFINE_M:
@@ -9821,6 +10060,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:
@@ -9835,6 +10075,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:
@@ -9894,6 +10135,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
opt_flag = 0;
break;
}
+ FALLTHROUGH
case SC_EXPLOSIONSPIRITS:
sc->opt3 |= OPT3_EXPLOSIONSPIRITS;
opt_flag = 0;
@@ -10177,6 +10419,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
return 1;
}
+
/*==========================================
* Ending all status except those listed.
* @TODO maybe usefull for dispel instead reseting a liste there.
@@ -10186,7 +10429,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
* 2 - Do clif
* 3 - Do not remove some permanent/time-independent effects
*------------------------------------------*/
-int status_change_clear(struct block_list* bl, int type) {
+int status_change_clear(struct block_list* bl, int type)
+{
struct status_change* sc;
int i;
@@ -10205,6 +10449,7 @@ int status_change_clear(struct block_list* bl, int type) {
case SC_ARMOR_PROPERTY://Only when its Holy or Dark that it doesn't dispell on death
if( sc->data[i]->val2 != ELE_HOLY && sc->data[i]->val2 != ELE_DARK )
break;
+ FALLTHROUGH
default:
continue;
}
@@ -10243,7 +10488,8 @@ int status_change_clear(struct block_list* bl, int type) {
/*==========================================
* Special condition we want to effectuate, check before ending a status.
*------------------------------------------*/
-int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const char* file, int line) {
+int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const char* file, int line)
+{
struct map_session_data *sd;
struct status_change *sc;
struct status_change_entry *sce;
@@ -10284,6 +10530,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
//trigger when it also removed one
case SC_STONE:
sce->val3 = 0; //Petrify time counter.
+ FALLTHROUGH
case SC_FREEZE:
case SC_STUN:
case SC_SLEEP:
@@ -10361,10 +10608,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
struct map_session_data *tsd;
if( bl->type == BL_PC ) {
// Clear Status from others
- int i;
- for( i = 0; i < MAX_PC_DEVOTION; i++ ) {
- if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL && tsd->sc.data[type])
- status_change_end(&tsd->bl, type, INVALID_TIMER);
+ if (sd != NULL ) {
+ int i;
+ for( i = 0; i < MAX_PC_DEVOTION; i++ ) {
+ if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL && tsd->sc.data[type])
+ status_change_end(&tsd->bl, type, INVALID_TIMER);
+ }
}
} else if (bl->type == BL_MER) {
struct mercenary_data *mc = BL_UCAST(BL_MER, bl);
@@ -10670,10 +10919,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;
@@ -10850,6 +11100,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
opt_flag = 0;
break;
}
+ FALLTHROUGH
case SC_EXPLOSIONSPIRITS:
sc->opt3 &= ~OPT3_EXPLOSIONSPIRITS;
opt_flag = 0;
@@ -11011,7 +11262,8 @@ int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) {
* For recusive status, like for each 5s we drop sp etc.
* Reseting the end timer.
*------------------------------------------*/
-int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
+int status_change_timer(int tid, int64 tick, int id, intptr_t data)
+{
enum sc_type type = (sc_type)data;
struct block_list *bl;
struct map_session_data *sd;
@@ -11134,6 +11386,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
case SC_POISON:
if(st->hp <= max(st->max_hp>>2, sce->val4)) //Stop damaging after 25% HP left.
break;
+ FALLTHROUGH
case SC_DPOISON:
if (--(sce->val3) > 0) {
if (!sc->data[SC_SLOWPOISON]) {
@@ -11264,6 +11517,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
//Moonlit's cost is 4sp*skill_lv [Skotlex]
sp= 4*(sce->val1>>16);
//Upkeep is also every 10 secs.
+ FALLTHROUGH
case DC_DONTFORGETME:
s=10;
break;
@@ -11861,6 +12115,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
@@ -11871,7 +12138,8 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
/*==========================================
* Foreach iteration of repetitive status
*------------------------------------------*/
-int status_change_timer_sub(struct block_list* bl, va_list ap) {
+int status_change_timer_sub(struct block_list* bl, va_list ap)
+{
struct status_change* tsc;
struct block_list* src = va_arg(ap,struct block_list*);
@@ -11879,6 +12147,8 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) {
enum sc_type type = (sc_type)va_arg(ap,int); //gcc: enum args get promoted to int
int64 tick = va_arg(ap, int64);
+ nullpo_ret(bl);
+
if (status->isdead(bl))
return 0;
@@ -11929,13 +12199,13 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) {
break;
case SC_RG_CCONFINE_M:
//Lock char has released the hold on everyone...
- if (tsc && tsc->data[SC_RG_CCONFINE_S] && tsc->data[SC_RG_CCONFINE_S]->val2 == src->id) {
+ if (tsc != NULL && src != NULL && tsc->data[SC_RG_CCONFINE_S] && tsc->data[SC_RG_CCONFINE_S]->val2 == src->id) {
tsc->data[SC_RG_CCONFINE_S]->val2 = 0;
status_change_end(bl, SC_RG_CCONFINE_S, INVALID_TIMER);
}
break;
case SC_CURSEDCIRCLE_TARGET:
- if( tsc && tsc->data[SC_CURSEDCIRCLE_TARGET] && tsc->data[SC_CURSEDCIRCLE_TARGET]->val2 == src->id ) {
+ if (tsc != NULL && src != NULL && tsc->data[SC_CURSEDCIRCLE_TARGET] && tsc->data[SC_CURSEDCIRCLE_TARGET]->val2 == src->id) {
clif->bladestop(bl, tsc->data[SC_CURSEDCIRCLE_TARGET]->val2, 0);
status_change_end(bl, type, INVALID_TIMER);
}
@@ -11946,12 +12216,15 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) {
int status_get_total_def(struct block_list *src) { return status->get_status_data(src)->def2 + (short)status->get_def(src); }
int status_get_total_mdef(struct block_list *src) { return status->get_status_data(src)->mdef2 + (short)status_get_mdef(src); }
+
int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag)
{
#ifdef RENEWAL
int min = 0, max = 0;
struct status_change *sc = status->get_sc(bl);
+ nullpo_ret(bl);
+ nullpo_ret(watk);
if (bl->type == BL_PC && watk->atk) {
float strdex_bonus, variance;
int dstr;
@@ -12013,7 +12286,8 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl
* 1 - Get MATK w/o SC bonuses
* 3 - Get MATK w/o EATK & SC bonuses
**/
-void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_max, unsigned short *matk_min) {
+void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_max, unsigned short *matk_min)
+{
struct status_data *st;
struct status_change *sc;
struct map_session_data *sd;
@@ -12040,6 +12314,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);
@@ -12051,6 +12329,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;
}
@@ -12120,7 +12400,8 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m
/**
* Gets a random matk value depending on min matk and max matk
**/
-unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk_min) {
+unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk_min)
+{
if ( matk_max > matk_min )
return matk_min + rnd() % (matk_max - matk_min);
else
@@ -12138,7 +12419,8 @@ unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk
*
* Shouldn't change _any_ value! [Panikon]
**/
-int status_get_matk(struct block_list *bl, int flag) {
+int status_get_matk(struct block_list *bl, int flag)
+{
struct status_data *st;
unsigned short matk_max, matk_min;
@@ -12166,7 +12448,8 @@ int status_get_matk(struct block_list *bl, int flag) {
/**
* Updates bl's MATK values
**/
-void status_update_matk(struct block_list *bl) {
+void status_update_matk(struct block_list *bl)
+{
struct status_data *st;
struct status_change *sc;
unsigned short matk_max, matk_min;
@@ -12194,7 +12477,8 @@ void status_update_matk(struct block_list *bl) {
* type&1 -> buffs, type&2 -> debuffs
* type&4 -> especific debuffs(implemented with refresh)
*------------------------------------------*/
-int status_change_clear_buffs (struct block_list* bl, int type) {
+int status_change_clear_buffs (struct block_list* bl, int type)
+{
int i;
struct status_change *sc= status->get_sc(bl);
@@ -12255,7 +12539,8 @@ int status_change_clear_buffs (struct block_list* bl, int type) {
return 0;
}
-int status_change_spread( struct block_list *src, struct block_list *bl ) {
+int status_change_spread(struct block_list *src, struct block_list *bl)
+{
int i, flag = 0;
struct status_change *sc = status->get_sc(src);
int64 tick;
@@ -12345,7 +12630,8 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
}
//Natural regen related stuff.
-int status_natural_heal(struct block_list* bl, va_list args) {
+int status_natural_heal(struct block_list* bl, va_list args)
+{
struct regen_data *regen;
struct status_data *st;
struct status_change *sc;
@@ -12355,6 +12641,7 @@ int status_natural_heal(struct block_list* bl, va_list args) {
struct map_session_data *sd;
int val,rate,bonus = 0,flag;
+ nullpo_ret(bl);
regen = status->get_regen_data(bl);
if (!regen) return 0;
st = status->get_status_data(bl);
@@ -12531,7 +12818,8 @@ int status_natural_heal(struct block_list* bl, va_list args) {
}
//Natural heal main timer.
-int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) {
+int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data)
+{
// This difference is always positive and lower than UINT_MAX (~24 days)
status->natural_heal_diff_tick = (unsigned int)cap_value(DIFF_TICK(tick,status->natural_heal_prev_tick), 0, UINT_MAX);
map->foreachregen(status->natural_heal);
@@ -12545,15 +12833,17 @@ int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) {
* @param refine The target refine level
* @return The chance to refine the item, in percent (0~100)
**/
-int status_get_refine_chance(enum refine_type wlv, int refine) {
-
+int status_get_refine_chance(enum refine_type wlv, int refine)
+{
+ Assert_ret((int)wlv >= REFINE_TYPE_ARMOR && wlv < REFINE_TYPE_MAX);
if ( refine < 0 || refine >= MAX_REFINE)
return 0;
return status->dbs->refine_info[wlv].chance[refine];
}
-int status_get_sc_type(sc_type type) {
+int status_get_sc_type(sc_type type)
+{
if( type <= SC_NONE || type >= SC_MAX )
return 0;
@@ -12765,7 +13055,8 @@ void status_read_job_db_sub(int idx, const char *name, struct config_setting_t *
* size_fix.txt - size adjustment table for weapons
* refine_db.txt - refining data table
*------------------------------------------*/
-void status_read_job_db(void) { /* [malufett/Hercules] */
+void status_read_job_db(void) /* [malufett/Hercules] */
+{
int i = 0;
struct config_t job_db_conf;
struct config_setting_t *jdb = NULL;
@@ -12798,6 +13089,7 @@ bool status_readdb_job2(char* fields[], int columns, int current)
{
int idx, class_, i;
+ nullpo_retr(false, fields);
class_ = atoi(fields[0]);
if(!pc->db_checkid(class_))
@@ -12818,6 +13110,7 @@ bool status_readdb_sizefix(char* fields[], int columns, int current)
{
unsigned int i;
+ nullpo_retr(false, fields);
for(i = 0; i < MAX_SINGLE_WEAPON_TYPE; i++)
{
status->dbs->atkmods[current][i] = atoi(fields[i]);
@@ -12928,7 +13221,8 @@ int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *n
* @param *filename File name, relative to the database path.
* @return The number of found entries.
*/
-int status_readdb_refine_libconfig(const char *filename) {
+int status_readdb_refine_libconfig(const char *filename)
+{
bool duplicate[REFINE_TYPE_MAX];
struct config_t refine_db_conf;
struct config_setting_t *r;
@@ -12959,10 +13253,12 @@ int status_readdb_refine_libconfig(const char *filename) {
return count;
}
-bool status_readdb_scconfig(char* fields[], int columns, int current) {
+bool status_readdb_scconfig(char* fields[], int columns, int current)
+{
int val = 0;
char* type = fields[0];
+ nullpo_retr(false, fields);
if( !script->get_constant(type, &val) ){
ShowWarning("status_readdb_sc_conf: Invalid status type %s specified.\n", type);
return false;
@@ -13033,7 +13329,8 @@ int status_readdb(void)
/*==========================================
* Status db init and destroy.
*------------------------------------------*/
-int do_init_status(bool minimal) {
+int do_init_status(bool minimal)
+{
if (minimal)
return 0;
@@ -13048,7 +13345,9 @@ int do_init_status(bool minimal) {
timer->add_interval(status->natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status->natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL);
return 0;
}
-void do_final_status(void) {
+
+void do_final_status(void)
+{
ers_destroy(status->data_ers);
}
@@ -13057,7 +13356,8 @@ void do_final_status(void) {
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
-void status_defaults(void) {
+void status_defaults(void)
+{
status = &status_s;
status->dbs = &statusdbs;
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 4272f9611..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
@@ -82,6 +82,7 @@ void storage_sortitem(struct item* items, unsigned int size)
int storage_reconnect_sub(union DBKey key, struct DBData *data, va_list ap)
{
struct guild_storage *stor = DB->data2ptr(data);
+ nullpo_ret(stor);
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
gstorage->save(0, stor->guild_id,0);
@@ -89,7 +90,8 @@ int storage_reconnect_sub(union DBKey key, struct DBData *data, va_list ap)
}
//Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex]
-void do_reconnect_storage(void) {
+void do_reconnect_storage(void)
+{
gstorage->db->foreach(gstorage->db, storage->reconnect_sub);
}
@@ -141,11 +143,15 @@ int compare_item(struct item *a, struct item *b)
/*==========================================
* Internal add-item function.
*------------------------------------------*/
-int storage_additem(struct map_session_data* sd, struct item* item_data, int amount) {
- struct storage_data* stor = &sd->status.storage;
+int storage_additem(struct map_session_data* sd, struct item* item_data, int amount)
+{
+ struct storage_data* stor;
struct item_data *data;
int i;
+ nullpo_retr(1, sd);
+ nullpo_retr(1, item_data);
+ stor = &sd->status.storage;
if( item_data->nameid <= 0 || amount <= 0 )
return 1;
@@ -203,6 +209,8 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo
*------------------------------------------*/
int storage_delitem(struct map_session_data* sd, int n, int amount)
{
+ nullpo_retr(1, sd);
+ Assert_retr(1, n >= 0 && n < MAX_STORAGE);
if( sd->status.storage.items[n].nameid == 0 || sd->status.storage.items[n].amount < amount )
return 1;
@@ -226,7 +234,8 @@ int storage_delitem(struct map_session_data* sd, int n, int amount)
* 0 : fail
* 1 : success
*------------------------------------------*/
-int storage_storageadd(struct map_session_data* sd, int index, int amount) {
+int storage_storageadd(struct map_session_data* sd, int index, int amount)
+{
nullpo_ret(sd);
if( sd->status.storage.storage_amount > MAX_STORAGE )
@@ -260,6 +269,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
{
int flag;
+ nullpo_ret(sd);
if( index < 0 || index >= MAX_STORAGE )
return 0;
@@ -313,7 +323,8 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
* 0 : fail
* 1 : success
*------------------------------------------*/
-int storage_storagegettocart(struct map_session_data* sd, int index, int amount) {
+int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
+{
int flag = 0;
nullpo_ret(sd);
@@ -340,7 +351,8 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
/*==========================================
* Modified By Valaris to save upon closing [massdriller]
*------------------------------------------*/
-void storage_storageclose(struct map_session_data* sd) {
+void storage_storageclose(struct map_session_data* sd)
+{
nullpo_retv(sd);
clif->storageclose(sd);
@@ -354,7 +366,8 @@ void storage_storageclose(struct map_session_data* sd) {
/*==========================================
* When quitting the game.
*------------------------------------------*/
-void storage_storage_quit(struct map_session_data* sd, int flag) {
+void storage_storage_quit(struct map_session_data* sd, int flag)
+{
nullpo_retv(sd);
if (map->save_settings&4)
@@ -382,7 +395,8 @@ struct guild_storage *guild2storage_ensure(int guild_id)
return gs;
}
-int guild_storage_delete(int guild_id) {
+int guild_storage_delete(int guild_id)
+{
idb_remove(gstorage->db,guild_id);
return 0;
}
@@ -503,6 +517,7 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto
nullpo_retr(1, sd);
nullpo_retr(1, stor);
+ Assert_retr(1, n >= 0 && n < MAX_GUILD_STORAGE);
if(stor->items[n].nameid==0 || stor->items[n].amount<amount)
return 1;
@@ -703,7 +718,8 @@ int storage_guild_storagesaved(int guild_id)
}
//Close storage for sd and save it
-int storage_guild_storageclose(struct map_session_data* sd) {
+int storage_guild_storageclose(struct map_session_data* sd)
+{
struct guild_storage *stor;
nullpo_ret(sd);
@@ -722,7 +738,8 @@ int storage_guild_storageclose(struct map_session_data* sd) {
return 0;
}
-int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
+int storage_guild_storage_quit(struct map_session_data* sd, int flag)
+{
struct guild_storage *stor;
nullpo_ret(sd);
@@ -749,15 +766,21 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
return 0;
}
-void do_init_gstorage(bool minimal) {
+
+void do_init_gstorage(bool minimal)
+{
if (minimal)
return;
gstorage->db = idb_alloc(DB_OPT_RELEASE_DATA);
}
-void do_final_gstorage(void) {
+
+void do_final_gstorage(void)
+{
db_destroy(gstorage->db);
}
-void storage_defaults(void) {
+
+void storage_defaults(void)
+{
storage = &storage_s;
/* */
@@ -776,7 +799,9 @@ void storage_defaults(void) {
storage->sortitem = storage_sortitem;
storage->reconnect_sub = storage_reconnect_sub;
}
-void gstorage_defaults(void) {
+
+void gstorage_defaults(void)
+{
gstorage = &gstorage_s;
/* */
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 d6bdd14e5..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
@@ -118,7 +118,8 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
* Weird enough, the client should only send 3/4
* and the server is the one that can reply 0~2
*------------------------------------------*/
-void trade_tradeack(struct map_session_data *sd, int type) {
+void trade_tradeack(struct map_session_data *sd, int type)
+{
struct map_session_data *tsd;
nullpo_retv(sd);
@@ -217,6 +218,8 @@ int impossible_trade_check(struct map_session_data *sd)
if (!sd->deal.item[i].amount)
continue;
index = sd->deal.item[i].index;
+ if (index < 0 || index >= MAX_INVENTORY)
+ return 1;
if (inventory[index].amount < sd->deal.item[i].amount) {
// if more than the player have -> hack
snprintf(message_to_gm, sizeof(message_to_gm), msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
@@ -257,6 +260,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
struct item_data *data;
int trade_i, i, n;
+ nullpo_ret(sd);
+ nullpo_ret(tsd);
// check zenys value against hackers (Zeny was already checked on time of adding, but you never know when you lost some zeny since then.
if(sd->deal.zeny > sd->status.zeny || (tsd->status.zeny > MAX_ZENY - sd->deal.zeny))
return 0;
@@ -303,6 +308,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
if (!amount)
continue;
n = tsd->deal.item[trade_i].index;
+ if (n < 0 || n >= MAX_INVENTORY)
+ return 0;
if (amount > inventory2[n].amount)
return 0;
// search if it's possible to add item (for full inventory)
@@ -336,7 +343,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
/*==========================================
* Adds an item/qty to the trade window
*------------------------------------------*/
-void trade_tradeadditem(struct map_session_data *sd, short index, short amount) {
+void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
+{
struct map_session_data *target_sd;
struct item *item;
int trade_i, trade_weight;
@@ -456,9 +464,11 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount)
/*==========================================
* 'Ok' button on the trade window is pressed.
*------------------------------------------*/
-void trade_tradeok(struct map_session_data *sd) {
+void trade_tradeok(struct map_session_data *sd)
+{
struct map_session_data *target_sd;
+ nullpo_retv(sd);
if(sd->state.deal_locked || !sd->state.trading)
return;
@@ -475,10 +485,12 @@ void trade_tradeok(struct map_session_data *sd) {
/*==========================================
* 'Cancel' is pressed. (or trade was force-canceled by the code)
*------------------------------------------*/
-void trade_tradecancel(struct map_session_data *sd) {
+void trade_tradecancel(struct map_session_data *sd)
+{
struct map_session_data *target_sd;
int trade_i;
+ nullpo_retv(sd);
target_sd = map->id2sd(sd->trade_partner);
if(!sd->state.trading)
@@ -533,11 +545,13 @@ void trade_tradecancel(struct map_session_data *sd) {
/*==========================================
* lock sd and tsd trade data, execute the trade, clear, then save players
*------------------------------------------*/
-void trade_tradecommit(struct map_session_data *sd) {
+void trade_tradecommit(struct map_session_data *sd)
+{
struct map_session_data *tsd;
int trade_i;
int flag;
+ nullpo_retv(sd);
if (!sd->state.trading || !sd->state.deal_locked) //Locked should be 1 (pressed ok) before you can press trade.
return;
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 c52683444..739a369a6 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
@@ -235,8 +235,8 @@ int unit_step_timer(int tid, int64 tick, int id, intptr_t data)
return 1;
}
-
-int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
+int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data)
+{
int i;
int x,y,dx,dy;
unsigned char icewall_walk_block;
@@ -487,7 +487,8 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
return 0;
}
-int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
+int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data)
+{
struct block_list *bl = map->id2bl(id);
if (!bl || bl->prev == NULL)
@@ -570,7 +571,8 @@ static inline void set_mobstate(struct block_list* bl, int flag)
md->state.skillstate = md->state.aggressive ? MSS_FOLLOW : MSS_RUSH;
}
-int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) {
+int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data)
+{
struct block_list *bl = map->id2bl(id);
struct unit_data *ud = bl?unit->bl2ud(bl):NULL;
@@ -649,15 +651,21 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
* Called by unit_run when an object was hit
* @param sd Required only when using SC_WUGDASH
**/
-void unit_run_hit( struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type ) {
- int lv = sc->data[type]->val1;
+void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type)
+{
+ int lv;
+ struct unit_data *ud;
+ Assert_retv(type >= 0 && type < SC_MAX);
+ lv = sc->data[type]->val1;
//If you can't run forward, you must be next to a wall, so bounce back. [Skotlex]
if( type == SC_RUN )
clif->sc_load(bl,bl->id,AREA,SI_TING,0,0,0);
+ ud = unit->bl2ud(bl);
+ nullpo_retv(ud);
//Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin]
- unit->bl2ud(bl)->state.running = 0;
+ ud->state.running = 0;
status_change_end(bl, type, INVALID_TIMER);
if( type == SC_RUN ) {
@@ -677,7 +685,8 @@ void unit_run_hit( struct block_list *bl, struct status_change *sc, struct map_s
* @retval true Finished running
* @retval false Hit an object/Couldn't run
**/
-bool unit_run( struct block_list *bl, struct map_session_data *sd, enum sc_type type ) {
+bool unit_run(struct block_list *bl, struct map_session_data *sd, enum sc_type type)
+{
struct status_change *sc;
short to_x,to_y,dir_x,dir_y;
int i;
@@ -737,15 +746,19 @@ bool unit_run( struct block_list *bl, struct map_session_data *sd, enum sc_type
}
//Makes bl attempt to run dist cells away from target. Uses hard-paths.
-int unit_escape(struct block_list *bl, struct block_list *target, short dist) {
- uint8 dir = map->calc_dir(target, bl->x, bl->y);
+int unit_escape(struct block_list *bl, struct block_list *target, short dist)
+{
+ uint8 dir;
+ nullpo_ret(bl);
+ dir = map->calc_dir(target, bl->x, bl->y);
while (dist > 0 && map->getcell(bl->m, bl, bl->x + dist * dirx[dir], bl->y + dist * diry[dir], CELL_CHKNOREACH))
dist--;
return ( dist > 0 && unit->walktoxy(bl, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], 0) );
}
//Instant warp function.
-int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) {
+int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath)
+{
short dx,dy;
uint8 dir;
struct unit_data *ud = NULL;
@@ -821,7 +834,8 @@ int unit_setdir(struct block_list *bl,unsigned char dir)
return 0;
}
-uint8 unit_getdir(struct block_list *bl) {
+uint8 unit_getdir(struct block_list *bl)
+{
struct unit_data *ud;
nullpo_ret(bl);
@@ -978,7 +992,8 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
* Flag values: @see unit_stopwalking_flag.
* Upper bytes may be used for other purposes depending on the unit type.
*------------------------------------------*/
-int unit_stop_walking(struct block_list *bl, int flag) {
+int unit_stop_walking(struct block_list *bl, int flag)
+{
struct unit_data *ud;
const struct TimerData* td;
int64 tick;
@@ -1040,7 +1055,8 @@ int unit_is_walking(struct block_list *bl)
/*==========================================
* Determines if the bl can move based on status changes. [Skotlex]
*------------------------------------------*/
-int unit_can_move(struct block_list *bl) {
+int unit_can_move(struct block_list *bl)
+{
struct map_session_data *sd;
struct unit_data *ud;
struct status_change *sc;
@@ -1053,9 +1069,17 @@ int unit_can_move(struct block_list *bl) {
if (!ud)
return 0;
- if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK &&
- (!sd || (!pc->checkskill(sd, SA_FREECAST) && (skill->get_inf2(ud->skill_id) & (INF2_GUILD_SKILL | INF2_FREE_CAST_REDUCED | INF2_FREE_CAST_NORMAL)) == 0))) {
- return 0; // prevent moving while casting
+ if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK) {
+ // Prevent moving while casting
+ if (sd == NULL)
+ return 0; // Only players are affected by SA_FREECAST and similar
+ if ((skill->get_inf2(ud->skill_id) & (INF2_FREE_CAST_REDUCED | INF2_FREE_CAST_NORMAL)) == 0) {
+ // Skills with an explicit free cast setting always allow walking regardless of SA_FREECAST
+ if ((skill->get_inf2(ud->skill_id) & INF2_GUILD_SKILL) != 0)
+ return 0; // SA_FREECAST doesn't affect guild skills
+ if (pc->checkskill(sd, SA_FREECAST) == 0)
+ return 0; // SA_FREECAST not available
+ }
}
if (DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0)
@@ -1103,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
|| (
@@ -1142,11 +1167,12 @@ int unit_can_move(struct block_list *bl) {
* Resume running after a walk delay
*------------------------------------------*/
-int unit_resume_running(int tid, int64 tick, int id, intptr_t data) {
-
+int unit_resume_running(int tid, int64 tick, int id, intptr_t data)
+{
struct unit_data *ud = (struct unit_data *)data;
struct map_session_data *sd = map->id2sd(id);
+ nullpo_ret(ud);
if(sd && pc_isridingwug(sd))
clif->skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skill_lv,
sc_start4(ud->bl,ud->bl,status->skill2sc(RA_WUGDASH),100,ud->skill_lv,unit->getdir(ud->bl),0,0,1));
@@ -1166,10 +1192,12 @@ int unit_resume_running(int tid, int64 tick, int id, intptr_t data) {
* if type is 0, this is a damage induced delay: if previous delay is active, do not change it.
* if type is 1, this is a skill induced delay: walk-delay may only be increased, not decreased.
*------------------------------------------*/
-int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) {
+int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type)
+{
struct unit_data *ud = unit->bl2ud(bl);
if (delay <= 0 || !ud) return 0;
+ nullpo_ret(bl);
if (type) {
//Bosses can ignore skill induced walkdelay (but not damage induced)
if (bl->type == BL_MOB && (BL_UCCAST(BL_MOB, bl)->status.mode&MD_BOSS))
@@ -1205,7 +1233,9 @@ int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) {
return 1;
}
-int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) {
+//-------------- stop here
+int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel)
+{
struct unit_data *ud;
struct status_data *tstatus;
struct status_change *sc;
@@ -1349,7 +1379,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
switch (skill_id){
case SA_CASTCANCEL:
- if (ud->skill_id != skill_id){
+ if (ud->skill_id != skill_id) {
sd->skill_id_old = ud->skill_id;
sd->skill_lv_old = ud->skill_lv;
}
@@ -1479,7 +1509,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
break;
case AB_CLEARANCE:
- if( target->type != BL_MOB && battle->check_target(src,target,BCT_PARTY) <= 0 && sd ) {
+ if (target->type != BL_MOB && battle->check_target(src, target, BCT_PARTY) <= 0 && sd) {
clif->skill_fail(sd, skill_id, USESKILL_FAIL_TOTARGET, 0);
return 0;
}
@@ -1514,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:
@@ -1539,7 +1569,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
break;
case NC_DISJOINT:
- if( target->type == BL_PC ){
+ if (target->type == BL_PC) {
struct mob_data *md;
if( (md = map->id2md(target->id)) && md->master_id != src->id )
casttime <<= 1;
@@ -1856,6 +1886,7 @@ void unit_stop_stepaction(struct block_list *bl)
int unit_unattackable(struct block_list *bl)
{
struct unit_data *ud = unit->bl2ud(bl);
+ nullpo_ret(bl);
if (ud) {
ud->state.attack_continue = 0;
ud->state.step_attack = 0;
@@ -1873,11 +1904,13 @@ int unit_unattackable(struct block_list *bl)
* Attack request
* If type is an ongoing attack
*------------------------------------------*/
-int unit_attack(struct block_list *src,int target_id,int continuous) {
+int unit_attack(struct block_list *src, int target_id, int continuous)
+{
struct block_list *target;
struct unit_data *ud;
int range;
+ nullpo_ret(src);
nullpo_ret(ud = unit->bl2ud(src));
target = map->id2bl(target_id);
@@ -1945,6 +1978,7 @@ int unit_cancel_combo(struct block_list *bl)
{
struct unit_data *ud;
+ nullpo_ret(bl);
if (!status_change_end(bl, SC_COMBOATTACK, INVALID_TIMER))
return 0; //Combo wasn't active.
@@ -2081,7 +2115,8 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir)
/*==========================================
* Continuous Attack (function timer)
*------------------------------------------*/
-int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
+int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick)
+{
struct block_list *target;
struct unit_data *ud;
struct status_data *sstatus;
@@ -2220,7 +2255,8 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
return 1;
}
-int unit_attack_timer(int tid, int64 tick, int id, intptr_t data) {
+int unit_attack_timer(int tid, int64 tick, int id, intptr_t data)
+{
struct block_list *bl;
bl = map->id2bl(id);
if(bl && unit->attack_timer_sub(bl, tid, tick) == 0)
@@ -2291,7 +2327,8 @@ int unit_skillcastcancel(struct block_list *bl,int type)
}
// unit_data initialization process
-void unit_dataset(struct block_list *bl) {
+void unit_dataset(struct block_list *bl)
+{
struct unit_data *ud = unit->bl2ud(bl);
nullpo_retv(ud);
@@ -2327,7 +2364,8 @@ int unit_counttargeted(struct block_list* bl)
/*==========================================
*
*------------------------------------------*/
-int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2) {
+int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2)
+{
nullpo_ret(target);
if(damage+damage2 <= 0)
@@ -2363,9 +2401,11 @@ int unit_changeviewsize(struct block_list *bl,short size)
* Otherwise it is assumed bl is being warped.
* On-Kill specific stuff is not performed here, look at status->damage for that.
*------------------------------------------*/
-int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func) {
+int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func)
+{
struct unit_data *ud = unit->bl2ud(bl);
struct status_change *sc = status->get_sc(bl);
+ nullpo_ret(bl);
nullpo_ret(ud);
if(bl->prev == NULL)
@@ -2425,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)) {
@@ -2607,6 +2649,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype)
{
+ nullpo_retv(sd);
unit->remove_map(&sd->bl,clrtype,ALC_MARK);
//CLR_RESPAWN is the warp from logging out, CLR_TELEPORT is the warp from teleporting, but pets/homunc need to just 'vanish' instead of showing the warping animation.
@@ -2624,6 +2667,7 @@ void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype)
void unit_free_pc(struct map_session_data *sd)
{
+ nullpo_retv(sd);
if (sd->pd) unit->free(&sd->pd->bl,CLR_OUTSIGHT);
if (sd->hd) unit->free(&sd->hd->bl,CLR_OUTSIGHT);
if (sd->md) unit->free(&sd->md->bl,CLR_OUTSIGHT);
@@ -2635,8 +2679,10 @@ void unit_free_pc(struct map_session_data *sd)
* Function to free all related resources to the bl
* if unit is on map, it is removed using the clrtype specified
*------------------------------------------*/
-int unit_free(struct block_list *bl, clr_type clrtype) {
+int unit_free(struct block_list *bl, clr_type clrtype)
+{
struct unit_data *ud = unit->bl2ud( bl );
+ nullpo_ret(bl);
nullpo_ret(ud);
map->freeblock_lock();
@@ -2880,7 +2926,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
return 0;
}
-int do_init_unit(bool minimal) {
+int do_init_unit(bool minimal)
+{
if (minimal)
return 0;
@@ -2892,12 +2939,14 @@ int do_init_unit(bool minimal) {
return 0;
}
-int do_final_unit(void) {
+int do_final_unit(void)
+{
// nothing to do
return 0;
}
-void unit_defaults(void) {
+void unit_defaults(void)
+{
unit = &unit_s;
unit->init = do_init_unit;
diff --git a/src/map/unit.h b/src/map/unit.h
index 8c4c34696..a3241a4b9 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
diff --git a/src/map/vending.c b/src/map/vending.c
index 6f4515120..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
@@ -44,14 +44,16 @@ struct vending_interface vending_s;
struct vending_interface *vending;
/// Returns an unique vending shop id.
-static inline unsigned int getid(void) {
+static inline unsigned int getid(void)
+{
return vending->next_id++;
}
/*==========================================
* Close shop
*------------------------------------------*/
-void vending_closevending(struct map_session_data* sd) {
+void vending_closevending(struct map_session_data* sd)
+{
nullpo_retv(sd);
if( sd->state.vending ) {
@@ -64,7 +66,8 @@ void vending_closevending(struct map_session_data* sd) {
/*==========================================
* Request a shop's item list
*------------------------------------------*/
-void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) {
+void vending_vendinglistreq(struct map_session_data* sd, unsigned int id)
+{
struct map_session_data* vsd;
nullpo_retv(sd);
@@ -86,13 +89,15 @@ void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) {
/*==========================================
* Purchase item(s) from a shop
*------------------------------------------*/
-void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count) {
+void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count)
+{
int i, j, cursor, w, new_ = 0, blank, vend_list[MAX_VENDING];
int64 z;
struct s_vending vend[MAX_VENDING]; // against duplicate packets
struct map_session_data* vsd = map->id2sd(aid);
nullpo_retv(sd);
+ nullpo_retv(data);
if( vsd == NULL || !vsd->state.vending || vsd->bl.id == sd->bl.id )
return; // invalid shop
@@ -191,7 +196,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
// vending item
pc->additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
- clif->vendingreport(vsd, idx, amount);
+ clif->vendingreport(vsd, idx, amount, sd->status.char_id, (int)z);
pc->cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
//print buyer's name
@@ -240,7 +245,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
* Open shop
* data := {<index>.w <amount>.w <value>.l}[count]
*------------------------------------------*/
-void vending_openvending(struct map_session_data* sd, const char* message, const uint8* data, int count) {
+void vending_openvending(struct map_session_data* sd, const char* message, const uint8* data, int count)
+{
int i, j;
int vending_skill_lvl;
nullpo_retv(sd);
@@ -309,9 +315,11 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
/// Checks if an item is being sold in given player's vending.
-bool vending_search(struct map_session_data* sd, unsigned short nameid) {
+bool vending_search(struct map_session_data* sd, unsigned short nameid)
+{
int i;
+ nullpo_retr(false, sd);
if( !sd->state.vending ) { // not vending
return false;
}
@@ -327,11 +335,14 @@ bool vending_search(struct map_session_data* sd, unsigned short nameid) {
/// Searches for all items in a vending, that match given ids, price and possible cards.
/// @return Whether or not the search should be continued.
-bool vending_searchall(struct map_session_data* sd, const struct s_search_store_search* s) {
+bool vending_searchall(struct map_session_data* sd, const struct s_search_store_search* s)
+{
int i, c, slot;
unsigned int idx, cidx;
struct item* it;
+ nullpo_retr(false, sd);
+ nullpo_retr(false, s);
if( !sd->state.vending ) // not vending
return true;
@@ -377,16 +388,20 @@ bool vending_searchall(struct map_session_data* sd, const struct s_search_store_
return true;
}
-void final(void) {
+
+void final(void)
+{
db_destroy(vending->db);
}
-void init(bool minimal) {
+void init(bool minimal)
+{
vending->db = idb_alloc(DB_OPT_BASE);
vending->next_id = 0;
}
-void vending_defaults(void) {
+void vending_defaults(void)
+{
vending = &vending_s;
vending->init = init;
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 9968d1d18..eb494a6c2 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -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);
@@ -1396,8 +1396,8 @@ typedef void (*HPMHOOK_pre_clif_buyvending) (struct map_session_data **sd, int *
typedef void (*HPMHOOK_post_clif_buyvending) (struct map_session_data *sd, int index, int amount, int fail);
typedef void (*HPMHOOK_pre_clif_openvending) (struct map_session_data **sd, int *id, struct s_vending **vending_list);
typedef void (*HPMHOOK_post_clif_openvending) (struct map_session_data *sd, int id, struct s_vending *vending_list);
-typedef void (*HPMHOOK_pre_clif_vendingreport) (struct map_session_data **sd, int *index, int *amount);
-typedef void (*HPMHOOK_post_clif_vendingreport) (struct map_session_data *sd, int index, int amount);
+typedef void (*HPMHOOK_pre_clif_vendingreport) (struct map_session_data **sd, int *index, int *amount, uint32 *char_id, int *zeny);
+typedef void (*HPMHOOK_post_clif_vendingreport) (struct map_session_data *sd, int index, int amount, uint32 char_id, int zeny);
typedef void (*HPMHOOK_pre_clif_storagelist) (struct map_session_data **sd, struct item **items, int *items_length);
typedef void (*HPMHOOK_post_clif_storagelist) (struct map_session_data *sd, struct item *items, int items_length);
typedef void (*HPMHOOK_pre_clif_updatestorageamount) (struct map_session_data **sd, int *amount, int *max_amount);
@@ -1684,8 +1684,8 @@ typedef void (*HPMHOOK_pre_clif_buyingstore_itemlist) (struct map_session_data *
typedef void (*HPMHOOK_post_clif_buyingstore_itemlist) (struct map_session_data *sd, struct map_session_data *pl_sd);
typedef void (*HPMHOOK_pre_clif_buyingstore_trade_failed_buyer) (struct map_session_data **sd, short *result);
typedef void (*HPMHOOK_post_clif_buyingstore_trade_failed_buyer) (struct map_session_data *sd, short result);
-typedef void (*HPMHOOK_pre_clif_buyingstore_update_item) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount);
-typedef void (*HPMHOOK_post_clif_buyingstore_update_item) (struct map_session_data *sd, unsigned short nameid, unsigned short amount);
+typedef void (*HPMHOOK_pre_clif_buyingstore_update_item) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount, uint32 *char_id, int *zeny);
+typedef void (*HPMHOOK_post_clif_buyingstore_update_item) (struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny);
typedef void (*HPMHOOK_pre_clif_buyingstore_delete_item) (struct map_session_data **sd, short *index, unsigned short *amount, int *price);
typedef void (*HPMHOOK_post_clif_buyingstore_delete_item) (struct map_session_data *sd, short index, unsigned short amount, int price);
typedef void (*HPMHOOK_pre_clif_buyingstore_trade_failed_seller) (struct map_session_data **sd, short *result, unsigned short *nameid);
@@ -1764,6 +1764,8 @@ typedef void (*HPMHOOK_pre_clif_ackmergeitems) (int *fd, struct map_session_data
typedef void (*HPMHOOK_post_clif_ackmergeitems) (int fd, struct map_session_data *sd);
typedef bool (*HPMHOOK_pre_clif_isdisguised) (struct block_list **bl);
typedef bool (*HPMHOOK_post_clif_isdisguised) (bool retVal___, struct block_list *bl);
+typedef void (*HPMHOOK_pre_clif_navigate_to) (struct map_session_data **sd, const char **mapname, uint16 *x, uint16 *y, uint8 *flag, bool *hideWindow, uint16 *mob_id);
+typedef void (*HPMHOOK_post_clif_navigate_to) (struct map_session_data *sd, const char *mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id);
typedef unsigned char (*HPMHOOK_pre_clif_bl_type) (struct block_list **bl);
typedef unsigned char (*HPMHOOK_post_clif_bl_type) (unsigned char retVal___, struct block_list *bl);
typedef void (*HPMHOOK_pre_clif_pWantToConnection) (int *fd, struct map_session_data **sd);
@@ -3478,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);
@@ -3490,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);
@@ -3500,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);
@@ -3514,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);
@@ -3524,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);
@@ -3552,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);
@@ -3785,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);
@@ -5602,6 +5574,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);
@@ -6508,6 +6482,12 @@ typedef void (*HPMHOOK_pre_skill_validate_additional_fields) (struct config_sett
typedef void (*HPMHOOK_post_skill_validate_additional_fields) (struct config_setting_t *conf, struct s_skill_db *sk);
typedef bool (*HPMHOOK_pre_skill_validate_skilldb) (struct s_skill_db **skt, const char **source);
typedef bool (*HPMHOOK_post_skill_validate_skilldb) (bool retVal___, struct s_skill_db *skt, const char *source);
+typedef int (*HPMHOOK_pre_skill_validate_weapontype_sub) (const char **type, bool *on, struct s_skill_db **sk);
+typedef int (*HPMHOOK_post_skill_validate_weapontype_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
+typedef int (*HPMHOOK_pre_skill_validate_ammotype_sub) (const char **type, bool *on, struct s_skill_db **sk);
+typedef int (*HPMHOOK_post_skill_validate_ammotype_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
+typedef int (*HPMHOOK_pre_skill_validate_unit_flag_sub) (const char **type, bool *on, struct s_skill_db **sk);
+typedef int (*HPMHOOK_post_skill_validate_unit_flag_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
typedef bool (*HPMHOOK_pre_skill_read_skilldb) (const char **filename);
typedef bool (*HPMHOOK_post_skill_read_skilldb) (bool retVal___, const char *filename);
typedef void (*HPMHOOK_pre_skill_config_set_level) (struct config_setting_t **conf, int **arr);
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index 836e51f3f..3af236f48 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -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..55fc347e5 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -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..bab2c2721 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -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___;
@@ -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;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
index 54ae8f030..d940e379a 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc
@@ -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..1d7ac8267 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
@@ -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..96a711af6 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
@@ -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..b5fc0e70b 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
@@ -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;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
index 6677a0c55..4bb7f5396 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc
@@ -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 0845d8cdd..22f0b3a8a 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -1402,6 +1402,8 @@ struct {
struct HPMHookPoint *HP_clif_ackmergeitems_post;
struct HPMHookPoint *HP_clif_isdisguised_pre;
struct HPMHookPoint *HP_clif_isdisguised_post;
+ struct HPMHookPoint *HP_clif_navigate_to_pre;
+ struct HPMHookPoint *HP_clif_navigate_to_post;
struct HPMHookPoint *HP_clif_bl_type_pre;
struct HPMHookPoint *HP_clif_bl_type_post;
struct HPMHookPoint *HP_clif_pWantToConnection_pre;
@@ -2982,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;
@@ -4428,6 +4402,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;
@@ -5296,6 +5272,12 @@ struct {
struct HPMHookPoint *HP_skill_validate_additional_fields_post;
struct HPMHookPoint *HP_skill_validate_skilldb_pre;
struct HPMHookPoint *HP_skill_validate_skilldb_post;
+ struct HPMHookPoint *HP_skill_validate_weapontype_sub_pre;
+ struct HPMHookPoint *HP_skill_validate_weapontype_sub_post;
+ struct HPMHookPoint *HP_skill_validate_ammotype_sub_pre;
+ struct HPMHookPoint *HP_skill_validate_ammotype_sub_post;
+ struct HPMHookPoint *HP_skill_validate_unit_flag_sub_pre;
+ struct HPMHookPoint *HP_skill_validate_unit_flag_sub_post;
struct HPMHookPoint *HP_skill_read_skilldb_pre;
struct HPMHookPoint *HP_skill_read_skilldb_post;
struct HPMHookPoint *HP_skill_config_set_level_pre;
@@ -7457,6 +7439,8 @@ struct {
int HP_clif_ackmergeitems_post;
int HP_clif_isdisguised_pre;
int HP_clif_isdisguised_post;
+ int HP_clif_navigate_to_pre;
+ int HP_clif_navigate_to_post;
int HP_clif_bl_type_pre;
int HP_clif_bl_type_post;
int HP_clif_pWantToConnection_pre;
@@ -9037,34 +9021,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;
@@ -10483,6 +10439,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;
@@ -11351,6 +11309,12 @@ struct {
int HP_skill_validate_additional_fields_post;
int HP_skill_validate_skilldb_pre;
int HP_skill_validate_skilldb_post;
+ int HP_skill_validate_weapontype_sub_pre;
+ int HP_skill_validate_weapontype_sub_post;
+ int HP_skill_validate_ammotype_sub_pre;
+ int HP_skill_validate_ammotype_sub_post;
+ int HP_skill_validate_unit_flag_sub_pre;
+ int HP_skill_validate_unit_flag_sub_post;
int HP_skill_read_skilldb_pre;
int HP_skill_read_skilldb_post;
int HP_skill_config_set_level_pre;
@@ -12163,7 +12127,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 30ede196a..0a3dc10fe 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -723,6 +723,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(clif->comparemergeitem, HP_clif_comparemergeitem) },
{ HP_POP(clif->ackmergeitems, HP_clif_ackmergeitems) },
{ HP_POP(clif->isdisguised, HP_clif_isdisguised) },
+ { HP_POP(clif->navigate_to, HP_clif_navigate_to) },
{ HP_POP(clif->bl_type, HP_clif_bl_type) },
{ HP_POP(clif->pWantToConnection, HP_clif_pWantToConnection) },
{ HP_POP(clif->pLoadEndAck, HP_clif_pLoadEndAck) },
@@ -1531,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) },
@@ -2270,6 +2256,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) },
@@ -2712,6 +2699,9 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(skill->validate_unit_flag, HP_skill_validate_unit_flag) },
{ HP_POP(skill->validate_additional_fields, HP_skill_validate_additional_fields) },
{ HP_POP(skill->validate_skilldb, HP_skill_validate_skilldb) },
+ { HP_POP(skill->validate_weapontype_sub, HP_skill_validate_weapontype_sub) },
+ { HP_POP(skill->validate_ammotype_sub, HP_skill_validate_ammotype_sub) },
+ { HP_POP(skill->validate_unit_flag_sub, HP_skill_validate_unit_flag_sub) },
{ HP_POP(skill->read_skilldb, HP_skill_read_skilldb) },
{ HP_POP(skill->config_set_level, HP_skill_config_set_level) },
{ HP_POP(skill->level_set_value, HP_skill_level_set_value) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 819c3b28c..7b8fac984 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -13447,14 +13447,14 @@ void HP_clif_openvending(struct map_session_data *sd, int id, struct s_vending *
}
return;
}
-void HP_clif_vendingreport(struct map_session_data *sd, int index, int amount) {
+void HP_clif_vendingreport(struct map_session_data *sd, int index, int amount, uint32 char_id, int zeny) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_vendingreport_pre ) {
- void (*preHookFunc) (struct map_session_data **sd, int *index, int *amount);
+ void (*preHookFunc) (struct map_session_data **sd, int *index, int *amount, uint32 *char_id, int *zeny);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_vendingreport_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_vendingreport_pre[hIndex].func;
- preHookFunc(&sd, &index, &amount);
+ preHookFunc(&sd, &index, &amount, &char_id, &zeny);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -13462,13 +13462,13 @@ void HP_clif_vendingreport(struct map_session_data *sd, int index, int amount) {
}
}
{
- HPMHooks.source.clif.vendingreport(sd, index, amount);
+ HPMHooks.source.clif.vendingreport(sd, index, amount, char_id, zeny);
}
if( HPMHooks.count.HP_clif_vendingreport_post ) {
- void (*postHookFunc) (struct map_session_data *sd, int index, int amount);
+ void (*postHookFunc) (struct map_session_data *sd, int index, int amount, uint32 char_id, int zeny);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_vendingreport_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_vendingreport_post[hIndex].func;
- postHookFunc(sd, index, amount);
+ postHookFunc(sd, index, amount, char_id, zeny);
}
}
return;
@@ -17200,14 +17200,14 @@ void HP_clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, short r
}
return;
}
-void HP_clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount) {
+void HP_clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_buyingstore_update_item_pre ) {
- void (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount);
+ void (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount, uint32 *char_id, int *zeny);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_update_item_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_buyingstore_update_item_pre[hIndex].func;
- preHookFunc(&sd, &nameid, &amount);
+ preHookFunc(&sd, &nameid, &amount, &char_id, &zeny);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -17215,13 +17215,13 @@ void HP_clif_buyingstore_update_item(struct map_session_data *sd, unsigned short
}
}
{
- HPMHooks.source.clif.buyingstore_update_item(sd, nameid, amount);
+ HPMHooks.source.clif.buyingstore_update_item(sd, nameid, amount, char_id, zeny);
}
if( HPMHooks.count.HP_clif_buyingstore_update_item_post ) {
- void (*postHookFunc) (struct map_session_data *sd, unsigned short nameid, unsigned short amount);
+ void (*postHookFunc) (struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_update_item_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_buyingstore_update_item_post[hIndex].func;
- postHookFunc(sd, nameid, amount);
+ postHookFunc(sd, nameid, amount, char_id, zeny);
}
}
return;
@@ -18246,6 +18246,32 @@ bool HP_clif_isdisguised(struct block_list *bl) {
}
return retVal___;
}
+void HP_clif_navigate_to(struct map_session_data *sd, const char *mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_clif_navigate_to_pre ) {
+ void (*preHookFunc) (struct map_session_data **sd, const char **mapname, uint16 *x, uint16 *y, uint8 *flag, bool *hideWindow, uint16 *mob_id);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_navigate_to_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_clif_navigate_to_pre[hIndex].func;
+ preHookFunc(&sd, &mapname, &x, &y, &flag, &hideWindow, &mob_id);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.navigate_to(sd, mapname, x, y, flag, hideWindow, mob_id);
+ }
+ if( HPMHooks.count.HP_clif_navigate_to_post ) {
+ void (*postHookFunc) (struct map_session_data *sd, const char *mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_navigate_to_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_clif_navigate_to_post[hIndex].func;
+ postHookFunc(sd, mapname, x, y, flag, hideWindow, mob_id);
+ }
+ }
+ return;
+}
unsigned char HP_clif_bl_type(struct block_list *bl) {
int hIndex = 0;
unsigned char retVal___ = 0;
@@ -36946,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;
@@ -36965,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);
@@ -37108,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;
@@ -37127,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);
@@ -37243,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;
@@ -37262,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);
@@ -37432,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;
@@ -37451,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);
@@ -37567,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;
@@ -37586,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);
@@ -37944,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;
@@ -37963,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);
@@ -39272,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;
@@ -58994,6 +58647,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;
@@ -70906,6 +70586,87 @@ bool HP_skill_validate_skilldb(struct s_skill_db *skt, const char *source) {
}
return retVal___;
}
+int HP_skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_skill_validate_weapontype_sub_pre ) {
+ int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_weapontype_sub_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_skill_validate_weapontype_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&type, &on, &sk);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.skill.validate_weapontype_sub(type, on, sk);
+ }
+ if( HPMHooks.count.HP_skill_validate_weapontype_sub_post ) {
+ int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_weapontype_sub_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_skill_validate_weapontype_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, type, on, sk);
+ }
+ }
+ return retVal___;
+}
+int HP_skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_skill_validate_ammotype_sub_pre ) {
+ int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_ammotype_sub_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_skill_validate_ammotype_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&type, &on, &sk);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.skill.validate_ammotype_sub(type, on, sk);
+ }
+ if( HPMHooks.count.HP_skill_validate_ammotype_sub_post ) {
+ int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_ammotype_sub_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_skill_validate_ammotype_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, type, on, sk);
+ }
+ }
+ return retVal___;
+}
+int HP_skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *sk) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_skill_validate_unit_flag_sub_pre ) {
+ int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_unit_flag_sub_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_skill_validate_unit_flag_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&type, &on, &sk);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.skill.validate_unit_flag_sub(type, on, sk);
+ }
+ if( HPMHooks.count.HP_skill_validate_unit_flag_sub_post ) {
+ int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_unit_flag_sub_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_skill_validate_unit_flag_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, type, on, sk);
+ }
+ }
+ return retVal___;
+}
bool HP_skill_read_skilldb(const char *filename) {
int hIndex = 0;
bool retVal___ = false;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
index 54861ed6f..0cc52b595 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
@@ -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/db2sql.c b/src/plugins/db2sql.c
index af5ab99af..f801e4147 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -457,7 +457,7 @@ void itemdb2sql_tableheader(void)
" `equip_jobs` bigint(20) UNSIGNED DEFAULT NULL,\n"
" `equip_upper` tinyint(8) UNSIGNED DEFAULT NULL,\n"
" `equip_genders` tinyint(2) UNSIGNED DEFAULT NULL,\n"
- " `equip_locations` smallint(4) UNSIGNED DEFAULT NULL,\n"
+ " `equip_locations` mediumint(8) UNSIGNED DEFAULT NULL,\n"
" `weapon_level` tinyint(2) UNSIGNED DEFAULT NULL,\n"
" `equip_level_min` smallint(5) UNSIGNED DEFAULT NULL,\n"
" `equip_level_max` smallint(5) UNSIGNED DEFAULT NULL,\n"
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