From 0957abd4d19b82b8dc8d7db2743008fa3daff3fa Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 18 Jan 2015 20:16:28 -0200 Subject: To help pinpoint and manage the issue report in 8402 @cddebug command; broken entries will be normalized immediately, to forcefully reset the cooldown write "reset" i.e. @cddebug reset, to use on others the usual #cddebug "target" http://hercules.ws/board/tracker/issue-8402-serious-problem-with-skill-that-cant-be-cast-or-used/ Signed-off-by: shennetsind --- src/map/atcommand.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 000192b62..34ef4ec30 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9314,6 +9314,50 @@ ACMD(skdebug) { clif->message(fd,atcmd_output); return true; } +/** + * cooldown-debug + **/ +ACMD(cddebug) { + int i; + struct skill_cd* cd = NULL; + + if( !(cd = idb_get(skill->cd_db,sd->status.char_id)) ) { + clif->message(fd,"No cool down list found"); + } else { + clif->messages(fd,"Found %d registered cooldowns",cd->cursor); + for(i = 0; i < cd->cursor; i++) { + if( cd->entry[i] ) { + const struct TimerData *td = timer->get(cd->entry[i]->timer); + + if( !td || td->func != skill->blockpc_end ) { + clif->messages(fd,"Found invalid entry in slot %d for skill %s",i,skill->db[cd->entry[i]->skidx].name); + sd->blockskill[cd->entry[i]->skidx] = false; + } + } + } + } + + if( !cd || (message && *message && strcmpi(message,"reset")) ) { + for(i = 0; i < MAX_SKILL; i++) { + if( sd->blockskill[i] ) { + clif->messages(fd,"Found skill '%s', unblocking...",skill->db[i].name); + sd->blockskill[i] = false; + } + } + if( cd ) {//reset + for(i = 0; i < cd->cursor; i++) { + if( !cd->entry[i] ) continue; + timer->delete(cd->entry[i]->timer,skill->blockpc_end); + ers_free(skill->cd_entry_ers, cd->entry[i]); + } + + idb_remove(skill->cd_db,sd->status.char_id); + ers_free(skill->cd_ers, cd); + } + } + + return true; +} /** * Fills the reference of available commands in atcommand DBMap **/ @@ -9583,6 +9627,7 @@ void atcommand_basecommands(void) { ACMD_DEF(searchstore), ACMD_DEF(costume), ACMD_DEF(skdebug), + ACMD_DEF(cddebug), }; int i; -- cgit v1.2.3-60-g2f50