diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 4 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 18 | ||||
-rw-r--r-- | src/map/npc.h | 1 | ||||
-rw-r--r-- | src/map/skill.c | 8 |
6 files changed, 19 insertions, 14 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ff88f2c63..de71819de 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -77,7 +77,7 @@ struct atcmd_binding_data* get_atcommandbind_byname(const char* name) { } const char* atcommand_msgsd(struct map_session_data *sd, int msg_number) { - Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG); + Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG && atcommand->msg_table[0][msg_number] != NULL); if (!sd || sd->lang_id >= atcommand->max_message_table || !atcommand->msg_table[sd->lang_id][msg_number]) return atcommand->msg_table[0][msg_number]; return atcommand->msg_table[sd->lang_id][msg_number]; @@ -85,7 +85,7 @@ const char* atcommand_msgsd(struct map_session_data *sd, int msg_number) { const char* atcommand_msgfd(int fd, int msg_number) { struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL; - Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG); + Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG && atcommand->msg_table[0][msg_number] != NULL); if (!sd || sd->lang_id >= atcommand->max_message_table || !atcommand->msg_table[sd->lang_id][msg_number]) return atcommand->msg_table[0][msg_number]; return atcommand->msg_table[sd->lang_id][msg_number]; diff --git a/src/map/battle.c b/src/map/battle.c index 10990f013..d1cdd19c4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7106,6 +7106,7 @@ static const struct battle_data { { "mvp_tomb_enabled", &battle_config.mvp_tomb_enabled, 1, 0, 1 }, { "feature.atcommand_suggestions", &battle_config.atcommand_suggestions_enabled, 0, 0, 1 }, { "min_npc_vendchat_distance", &battle_config.min_npc_vendchat_distance, 3, 0, 100 }, + { "vendchat_near_hiddennpc", &battle_config.vendchat_near_hiddennpc, 0, 0, 1 }, { "atcommand_mobinfo_type", &battle_config.atcommand_mobinfo_type, 0, 0, 1 }, { "homunculus_max_level", &battle_config.hom_max_level, 99, 0, MAX_LEVEL, }, { "homunculus_S_max_level", &battle_config.hom_S_max_level, 150, 0, MAX_LEVEL, }, diff --git a/src/map/battle.h b/src/map/battle.h index eeecaaf89..68a427e72 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -471,6 +471,7 @@ struct Battle_Config { int atcommand_suggestions_enabled; int min_npc_vendchat_distance; + int vendchat_near_hiddennpc; int atcommand_mobinfo_type; int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95] diff --git a/src/map/npc.c b/src/map/npc.c index 9573c1c6f..21970a42f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -137,6 +137,9 @@ int npc_isnear_sub(struct block_list* bl, va_list args) { if( nd->option & (OPTION_HIDE|OPTION_INVISIBLE) ) return 0; + if( battle_config.vendchat_near_hiddennpc && ( nd->class_ == FAKE_NPC || nd->class_ == HIDDEN_WARP_CLASS ) ) + return 0; + return 1; } @@ -2514,7 +2517,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con // Parse View // Support for using Constants in place of NPC View IDs. int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) { - int val = -1, i = 0; + int val = FAKE_NPC, i = 0; char viewid[1024]; // Max size of name from const.txt, see script->read_constdb. // Extract view ID / constant @@ -2538,7 +2541,7 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c } else { // NPC has an ID specified for view id. val = atoi(w4); - if (val != -1) + if (val != FAKE_NPC) // TODO: Add this to the constants table and replace -1 with FAKE_NPC in the scripts, then remove this check. ShowWarning("npc_parseview: Use of numeric NPC view IDs is deprecated and may be removed in a future update. Please use NPC view constants instead. ID '%d' specified in file '%s', line '%d'.\n", val, filepath, strline(buffer, start-buffer)); } @@ -2549,8 +2552,7 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c // Checks if given view is an ID or constant. bool npc_viewisid(const char * viewid) { - if(atoi(viewid) != -1) - { + if (atoi(viewid) != FAKE_NPC) { // Loop through view, looking for non-numeric character. while (*viewid) { if (ISDIGIT(*viewid++) == 0) return false; @@ -2786,7 +2788,7 @@ const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* s return strchr(start,'\n');// continue } - class_ = m == -1 ? -1 : npc->parseview(w4, start, buffer, filepath); + class_ = m == -1 ? FAKE_NPC : npc->parseview(w4, start, buffer, filepath); nd = npc->create_npc(type, m, x, y, dir, class_); CREATE(nd->u.shop.shop_item, struct npc_item_list, i); memcpy(nd->u.shop.shop_item, items, sizeof(items[0])*i); @@ -2954,7 +2956,7 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* npc->convertlabel_db(label_list,filepath); } - class_ = m == -1 ? -1 : npc->parseview(w4, start, buffer, filepath); + class_ = m == -1 ? FAKE_NPC : npc->parseview(w4, start, buffer, filepath); nd = npc->create_npc(SCRIPT, m, x, y, dir, class_); if (sscanf(w4, "%*[^,],%d,%d", &xs, &ys) == 2) { // OnTouch area defined @@ -3224,7 +3226,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch return end;// next line, try to continue } - class_ = m == -1 ? -1 : npc->parseview(w4, start, buffer, filepath); + class_ = m == -1 ? FAKE_NPC : npc->parseview(w4, start, buffer, filepath); nd = npc->create_npc(dnd->subtype, m, x, y, dir, class_); npc->parsename(nd, w3, start, buffer, filepath); nd->path = npc->retainpathreference(filepath); @@ -4685,7 +4687,7 @@ int do_init_npc(bool minimal) { npc->fake_nd = (struct npc_data *)aCalloc(1,sizeof(struct npc_data)); npc->fake_nd->bl.m = -1; npc->fake_nd->bl.id = npc->get_new_npc_id(); - npc->fake_nd->class_ = -1; + npc->fake_nd->class_ = FAKE_NPC; npc->fake_nd->speed = 200; strcpy(npc->fake_nd->name,"FAKE_NPC"); memcpy(npc->fake_nd->exname, npc->fake_nd->name, 9); diff --git a/src/map/npc.h b/src/map/npc.h index 60be1fbe4..e7fc16a21 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -109,6 +109,7 @@ struct npc_data { #define START_NPC_NUM 110000000 enum actor_classes { + FAKE_NPC = -1, WARP_CLASS = 45, HIDDEN_WARP_CLASS = 139, MOB_TOMB = 565, diff --git a/src/map/skill.c b/src/map/skill.c index cdf1c031f..8984bf0fa 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -11878,8 +11878,8 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 //Take into account these hit more times than the timer interval can handle. do skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0); - while(--src->val2 && x == bl->x && y == bl->y - && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); + while (src->alive != 0 && --src->val2 != 0 && x == bl->x && y == bl->y + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); if (src->val2<=0) skill->delunit(src); @@ -11961,8 +11961,8 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 sg->limit = DIFF_TICK32(tick,sg->tick); break; } - } while( x == bl->x && y == bl->y && sg->alive_count - && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl) ); + } while (src->alive != 0 && x == bl->x && y == bl->y && sg->alive_count != 0 + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); map->freeblock_unlock(); } break; |