From db231e817c5f6d6783b07d91e1d8b0d1243829dd Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 17 Feb 2008 22:36:02 +0000 Subject: - Updated Eye of Hellion to use the new format of the input command. - corrected login_fd/char_fd being uninitialized in the char servers. - Changed a bit around how status_base_atk works to avoid overflows. - Added a check to prevent using consume-delay items when you cannot use skills, since that opens an exploit if the item also has non-skill-casting components to its script. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12214 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/char.c | 2 +- src/char_sql/char.c | 2 +- src/map/atcommand.c | 2 +- src/map/pc.c | 7 +++++++ src/map/status.c | 15 +++++++++++---- 5 files changed, 21 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index d853a72ba..ae0c8593e 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -64,7 +64,7 @@ struct mmo_map_server { unsigned short map[MAX_MAP_PER_SERVER]; } server[MAX_MAP_SERVERS]; -int login_fd, char_fd; +int login_fd=-1, char_fd=-1; char userid[24]; char passwd[24]; char server_name[20]; diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 7839c1b96..c3fcde1e1 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -84,7 +84,7 @@ struct mmo_map_server { unsigned short map[MAX_MAP_PER_SERVER]; } server[MAX_MAP_SERVERS]; -int login_fd, char_fd; +int login_fd=-1, char_fd=-1; char userid[24]; char passwd[24]; char server_name[20]; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0faa040ef..8da0f1265 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5182,7 +5182,7 @@ int atcommand_disguise(const int fd, struct map_session_data* sd, const char* co *------------------------------------------*/ int atcommand_disguiseall(const int fd, struct map_session_data* sd, const char* command, const char* message) { - int mob_id=0, i=0; + int mob_id=0; struct map_session_data *pl_sd; struct s_mapiterator* iter; nullpo_retr(-1, sd); diff --git a/src/map/pc.c b/src/map/pc.c index 218e40e24..99fcb0ace 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3087,6 +3087,13 @@ int pc_useitem(struct map_session_data *sd,int n) )) return 0; + //Since most delay-consume items involve using a "skill-type" target cursor, + //perform a skill-use check before going through. [Skotlex] + //resurrection was picked as testing skill, as a non-offensive, generic skill, it will do. + if (sd->inventory_data[n]->flag.delay_consume && + !status_check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)) + return 0; + sd->itemid = sd->status.inventory[n].nameid; sd->itemindex = n; if(sd->catch_target_class != -1) //Abort pet catching. diff --git a/src/map/status.c b/src/map/status.c index 015ce1ddf..d4836919f 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1226,7 +1226,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat return amotion; } -static int status_base_atk(struct block_list *bl, struct status_data *status) +static unsigned short status_base_atk(struct block_list *bl, struct status_data *status) { int flag = 0, str, dex, dstr; @@ -1259,7 +1259,7 @@ static int status_base_atk(struct block_list *bl, struct status_data *status) str += dstr*dstr; if (bl->type == BL_PC) str+= dex/5 + status->luk/5; - return str; + return cap_value(str, 0, USHRT_MAX); } #define status_base_matk_max(status) (status->int_+(status->int_/5)*(status->int_/5)) @@ -1293,7 +1293,11 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev else status->flee2 = 0; - status->batk += status_base_atk(bl, status); + if (status->batk) { + int temp = status->batk + status_base_atk(bl, status); + status->batk = cap_value(temp, 0, USHRT_MAX); + } else + status->batk = status_base_atk(bl, status); if (status->cri) switch (bl->type) { case BL_MOB: @@ -3004,7 +3008,10 @@ void status_calc_bl(struct block_list *bl, unsigned long flag) status->batk = status_base_atk(bl,status); temp = b_status->batk - status_base_atk(bl,b_status); if (temp) - status->batk += temp; + { + temp += status->batk; + status->batk = cap_value(temp, 0, USHRT_MAX); + } status->batk = status_calc_batk(bl, sc, status->batk); } -- cgit v1.2.3-70-g09d2