From 7798e1e70bbfd3716283abf66bd269a7e6b7b6b6 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Mon, 10 Mar 2014 03:21:09 +0800 Subject: set_constant the send_target fix bug 8049 http://hercules.ws/board/tracker/issue-8049-specialeffect-target-self-doesnt-work/ --- src/map/script.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index bef5f37e0..3aba1b031 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -19107,6 +19107,40 @@ void script_hardcoded_constants(void) { /* status option compounds */ script->set_constant("Option_Dragon",OPTION_DRAGON,false); script->set_constant("Option_Costume",OPTION_COSTUME,false); + + /* send_target */ + script->set_constant("ALL_CLIENT",ALL_CLIENT,false); + script->set_constant("ALL_SAMEMAP",ALL_SAMEMAP,false); + script->set_constant("AREA",AREA,false); + script->set_constant("AREA_WOS",AREA_WOS,false); + script->set_constant("AREA_WOC",AREA_WOC,false); + script->set_constant("AREA_WOSC",AREA_WOSC,false); + script->set_constant("AREA_CHAT_WOC",AREA_CHAT_WOC,false); + script->set_constant("CHAT",CHAT,false); + script->set_constant("CHAT_WOS",CHAT_WOS,false); + script->set_constant("PARTY",PARTY,false); + script->set_constant("PARTY_WOS",PARTY_WOS,false); + script->set_constant("PARTY_SAMEMAP",PARTY_SAMEMAP,false); + script->set_constant("PARTY_SAMEMAP_WOS",PARTY_SAMEMAP_WOS,false); + script->set_constant("PARTY_AREA",PARTY_AREA,false); + script->set_constant("PARTY_AREA_WOS",PARTY_AREA_WOS,false); + script->set_constant("GUILD",GUILD,false); + script->set_constant("GUILD_WOS",GUILD_WOS,false); + script->set_constant("GUILD_SAMEMAP",GUILD_SAMEMAP,false); + script->set_constant("GUILD_SAMEMAP_WOS",GUILD_SAMEMAP_WOS,false); + script->set_constant("GUILD_AREA",GUILD_AREA,false); + script->set_constant("GUILD_AREA_WOS",GUILD_AREA_WOS,false); + script->set_constant("GUILD_NOBG",GUILD_NOBG,false); + script->set_constant("DUEL",DUEL,false); + script->set_constant("DUEL_WOS",DUEL_WOS,false); + script->set_constant("SELF",SELF,false); + script->set_constant("BG",BG,false); + script->set_constant("BG_WOS",BG_WOS,false); + script->set_constant("BG_SAMEMAP",BG_SAMEMAP,false); + script->set_constant("BG_SAMEMAP_WOS",BG_SAMEMAP_WOS,false); + script->set_constant("BG_AREA",BG_AREA,false); + script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false); + script->set_constant("BG_QUEUE",BG_QUEUE,false); } /** -- cgit v1.2.3-70-g09d2 From 73ab0c441de0f74c2e621a594df7e269ce89bfc5 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 10 Mar 2014 17:03:08 -0300 Subject: Fixed Bug 8046 Fixed issue with permanent statuses being removed during logout for memory-freeing operations, special thanks to streusel and all those who contributed to the bug report. http://hercules.ws/board/tracker/issue-8046-cart-disappearance/ Signed-off-by: shennetsind --- src/map/pc.h | 1 + src/map/status.c | 2 +- src/map/unit.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/pc.h b/src/map/pc.h index 66915492a..cc95b07e1 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -187,6 +187,7 @@ struct map_session_data { unsigned int hpmeter_visible : 1; unsigned int itemcheck : 1; unsigned int standalone : 1;/* [Ind/Hercules <3] */ + unsigned int loggingout : 1; } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; diff --git a/src/map/status.c b/src/map/status.c index 5dcf35198..f23a48fe0 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -9605,7 +9605,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if (sce->timer != tid && tid != INVALID_TIMER) return 0; - if( sd && sce->timer == INVALID_TIMER ) + if( sd && sce->timer == INVALID_TIMER && !sd->state.loggingout ) chrif->del_scdata_single(sd->status.account_id,sd->status.char_id,type); if (tid == INVALID_TIMER) { diff --git a/src/map/unit.c b/src/map/unit.c index 47cf07ef6..5dd63879f 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2330,6 +2330,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) { int i; unsigned int k; + sd->state.loggingout = 1; + if( status->isdead(bl) ) pc->setrestartvalue(sd,2); -- cgit v1.2.3-70-g09d2 From 42a5acec288f8ca364aee42472c8e0321ab0e5e4 Mon Sep 17 00:00:00 2001 From: panikon Date: Mon, 10 Mar 2014 19:52:02 -0300 Subject: Fixed issue 8043 http://hercules.ws/board/tracker/issue-8043-arch-bishop-lauda-ramus/ Also corrected similar issue with AB_LAUDAAGNUS, now both skills can be used properly whether the caster is in a party or not. Special thanks to kyeme for reporting this issue --- src/map/skill.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/skill.c b/src/map/skill.c index 8750695ae..e854b5fe9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8151,7 +8151,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case AB_LAUDAAGNUS: - if( flag&1 || sd == NULL ) { + if( (flag&1 || sd == NULL) || !sd->status.party_id) { if( tsc && (tsc->data[SC_FREEZE] || tsc->data[SC_STONE] || tsc->data[SC_BLIND] || tsc->data[SC_BURNING] || tsc->data[SC_FROSTMISTY] || tsc->data[SC_COLD])) { // Success Chance: (40 + 10 * Skill Level) % @@ -8171,8 +8171,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case AB_LAUDARAMUS: - if( flag&1 || sd == NULL ) { - if( tsc && (tsc->data[SC_SLEEP] || tsc->data[SC_STUN] || tsc->data[SC_MANDRAGORA] || tsc->data[SC_SILENCE] || tsc->data[SC_DEEP_SLEEP]) ){ + if( (flag&1 || sd == NULL) || !sd->status.party_id ) { + if( tsc && (tsc->data[SC_SLEEP] || tsc->data[SC_STUN] || tsc->data[SC_MANDRAGORA] || + tsc->data[SC_SILENCE] || tsc->data[SC_DEEP_SLEEP]) ){ // Success Chance: (40 + 10 * Skill Level) % if( rnd()%100 > 40+10*skill_lv ) break; status_change_end(bl, SC_SLEEP, INVALID_TIMER); -- cgit v1.2.3-70-g09d2 From 400c6a2e625197f70326587401b13ab02659682f Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 11 Mar 2014 02:58:45 +0100 Subject: Fixed some warnings (unused functions) pointed out by clang-5.1. Signed-off-by: Haru --- src/map/clif.c | 20 ++++++++------------ src/map/status.c | 2 ++ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index c61a72597..1c5f7e003 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -99,17 +99,16 @@ static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, sh p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); } - +#if 0 // Currently unused static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) { WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir); } - +#endif // 0 static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { WBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } - static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) { p += pos; @@ -126,7 +125,11 @@ static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* } } +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +#if 0 // currently unused static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { p += pos; @@ -154,19 +157,12 @@ static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short sy0[0] = ( p[5] & 0x0f ) >> 0; } } - - -static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { - RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); -} - - static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } +#endif // 0 - -//To idenfity disguised characters. +//To identify disguised characters. static inline bool disguised(struct block_list* bl) { return (bool)( bl->type == BL_PC && ((TBL_PC*)bl)->disguise != -1 ); } diff --git a/src/map/status.c b/src/map/status.c index f23a48fe0..4a81fcb05 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1985,7 +1985,9 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_ return cap_value(str, 0, USHRT_MAX); } +#ifndef RENEWAL static inline unsigned short status_base_matk_min(const struct status_data *st){ return st->int_+(st->int_/7)*(st->int_/7); } +#endif // not RENEWAL static inline unsigned short status_base_matk_max(const struct status_data *st){ return st->int_+(st->int_/5)*(st->int_/5); } unsigned short status_base_matk(const struct status_data *st, int level) { -- cgit v1.2.3-70-g09d2 From 302ba47df72db7f34b9146df81a155bbd29602f4 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 11 Mar 2014 15:31:07 -0300 Subject: Fixed Bug 8067 Sample plugin compiler error on msvc, credits to AnnieRuru (Thank you!) http://hercules.ws/board/tracker/issue-8067-pluginsamplec-throws-error-on-microsoft-compiler/ Signed-off-by: shennetsind --- src/plugins/sample.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/sample.c b/src/plugins/sample.c index 750ab31f9..819aae08c 100644 --- a/src/plugins/sample.c +++ b/src/plugins/sample.c @@ -13,6 +13,7 @@ #include "../map/script.h" #include "../map/pc.h" #include "../map/clif.h" +#include "../common/strlib.h" #include "../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */ @@ -106,7 +107,7 @@ int my_pc_dropitem_post(int retVal, struct map_session_data *sd,int *n,int *amou if( retVal != 1 ) return retVal;/* we don't do anything if pc_dropitem didn't return 1 (success) */ if( my_pc_dropitem_storage ) {/* signs whether pre-hook did this */ char output[99]; - snprintf(output,99,"[ Warning ] you can only drop 1 item at a time, capped from %d to 1",my_pc_dropitem_storage); + safesnprintf(output,99,"[ Warning ] you can only drop 1 item at a time, capped from %d to 1",my_pc_dropitem_storage); clif->colormes(sd->fd,COLOR_RED,output); } return 1; @@ -131,6 +132,7 @@ HPExport void plugin_init (void) { script = GET_SYMBOL("script"); clif = GET_SYMBOL("clif"); pc = GET_SYMBOL("pc"); + strlib = GET_SYMBOL("strlib"); /* session[] */ session = GET_SYMBOL("session"); -- cgit v1.2.3-70-g09d2 From 44819f75ab08b78ed7d09d3bbae0dc78a63aca52 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 11 Mar 2014 16:32:50 -0300 Subject: Fixed Bug 8072 Special Thanks to kyeme, Haruna http://hercules.ws/board/tracker/issue-8072-map-crash-autotrade/ Signed-off-by: shennetsind --- src/map/clif.c | 6 +++--- src/map/pc.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 1c5f7e003..cf6257628 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9927,13 +9927,13 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) } WFIFOSET(fd, WFIFOW(fd,2)); + // Chat logging type 'O' / Global Chat + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message); + #ifdef PCRE_SUPPORT // trigger listening npcs map->foreachinrange(npc_chat->sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl); #endif - - // Chat logging type 'O' / Global Chat - logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message); } diff --git a/src/map/pc.c b/src/map/pc.c index 87f14bcd9..5eb682415 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10477,6 +10477,12 @@ void pc_autotrade_prepare(struct map_session_data *sd) { sex = sd->status.sex; safestrncpy(title, sd->message, sizeof(title)); + sd->npc_id = 0; + sd->npc_shopid = 0; + if (sd->st) { + sd->st->state = END; + sd->st = NULL; + } map->quit(sd); chrif->auth_delete(account_id, char_id, ST_LOGOUT); -- cgit v1.2.3-70-g09d2 From 571d9e25008d8b386e28d7f1fd02f2690edf1f8c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 11 Mar 2014 17:23:20 -0300 Subject: Fixed getvariableofnpc Would crash when target npc's variable database is empty. Special Thanks to Haruna, ossi0110 Signed-off-by: shennetsind --- src/map/script.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index c2d9b2278..bba771a3c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15692,6 +15692,9 @@ BUILDIN(getvariableofnpc) return false; } + if( !nd->u.scr.script->local.vars ) + nd->u.scr.script->local.vars = i64db_alloc(DB_OPT_RELEASE_DATA); + script->push_val(st->stack, C_NAME, reference_getuid(data), &nd->u.scr.script->local); return true; } -- cgit v1.2.3-70-g09d2