diff options
-rw-r--r-- | db/const.txt | 33 | ||||
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/map/pc.h | 1 | ||||
-rw-r--r-- | src/map/script.c | 37 | ||||
-rw-r--r-- | src/map/skill.c | 7 | ||||
-rw-r--r-- | src/map/status.c | 4 | ||||
-rw-r--r-- | src/map/unit.c | 2 | ||||
-rw-r--r-- | src/plugins/sample.c | 4 |
9 files changed, 67 insertions, 53 deletions
diff --git a/db/const.txt b/db/const.txt index 8b4e5027b..7136d9678 100644 --- a/db/const.txt +++ b/db/const.txt @@ -1367,39 +1367,6 @@ MOB_ELEMENT 20 MOB_MODE 21 MOB_MVPEXP 22 -ALL_CLIENT 0 -ALL_SAMEMAP 1 -AREA 2 -AREA_WOS 3 -AREA_WOC 4 -AREA_WOSC 5 -AREA_CHAT_WOC 6 -CHAT 7 -CHAT_WOS 8 -PARTY 9 -PARTY_WOS 10 -PARTY_SAMEMAP 11 -PARTY_SAMEMAP_WOS 12 -PARTY_AREA 13 -PARTY_AREA_WOS 14 -GUILD 15 -GUILD_WOS 16 -GUILD_SAMEMAP 17 -GUILD_SAMEMAP_WOS 18 -GUILD_AREA 19 -GUILD_AREA_WOS 20 -GUILD_NOBG 21 -DUEL 22 -DUEL_WOS 23 -CHAT_MAINCHAT 24 -SELF 25 -BG 26 -BG_WOS 27 -BG_SAMEMAP 28 -BG_SAMEMAP_WOS 29 -BG_AREA 30 -BG_AREA_WOS 31 - ARCH_MERC_GUILD 0 SPEAR_MERC_GUILD 1 SWORD_MERC_GUILD 2 diff --git a/src/map/clif.c b/src/map/clif.c index fc8761087..31f2e07c1 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 ); } @@ -9931,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); 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/script.c b/src/map/script.c index fef25b927..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; } @@ -19134,6 +19137,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); } /** 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); diff --git a/src/map/status.c b/src/map/status.c index 5dcf35198..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) { @@ -9605,7 +9607,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); 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"); |