Fixed secure timeout triggering npc_scriptcont debug messages (#5239)

This commit is contained in:
Daegaladh 2020-07-28 19:40:04 +02:00 committed by GitHub
parent 4a819c4f61
commit 2e88b27b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -12857,16 +12857,15 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd){
int npc_id = RFIFOL(fd,info->pos[0]);
uint8 select = RFIFOB(fd,info->pos[1]);
if( (select > sd->npc_menu && select != 0xff) || select == 0 ) {
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer != INVALID_TIMER ) {
if( sd->npc_idle_timer == INVALID_TIMER && !sd->state.ignoretimeout )
return;
#endif
if( (select > sd->npc_menu && select != 0xff) || select == 0 ) {
TBL_NPC* nd = map_id2nd(npc_id);
ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name);
clif_GM_kick(NULL,sd);
#ifdef SECURE_NPCTIMEOUT
}
#endif
return;
}

View File

@ -1462,6 +1462,11 @@ bool npc_scriptcont(struct map_session_data* sd, int id, bool closing){
nullpo_retr(true, sd);
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer == INVALID_TIMER && !sd->state.ignoretimeout )
return true;
#endif
if( id != sd->npc_id ){
TBL_NPC* nd_sd = (TBL_NPC*)map_id2bl(sd->npc_id);
TBL_NPC* nd = BL_CAST(BL_NPC, target);

View File

@ -4369,7 +4369,7 @@ void script_attach_state(struct script_state* st){
sd->npc_item_flag = st->npc_item_flag; // load default.
sd->state.disable_atcommand_on_npc = battle_config.atcommand_disable_npc && (!pc_has_permission(sd, PC_PERM_ENABLE_COMMAND));
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer == INVALID_TIMER )
if( sd->npc_idle_timer == INVALID_TIMER && !sd->state.ignoretimeout )
sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_secure_timeout_timer,sd->bl.id,0);
sd->npc_idle_tick = gettick();
#endif