Add script commands to set spell cooldowns.

This commit is contained in:
ratkosrb
2018-04-25 19:19:57 +03:00
parent 19e3a65426
commit 331d0faa55
6 changed files with 117 additions and 3 deletions
+39
View File
@@ -933,6 +933,45 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename)
}
case SCRIPT_COMMAND_REMOVE_GUARDIANS:
{
if (tmp.removeGuardian.creatureId)
{
if (!ObjectMgr::GetCreatureTemplate(tmp.removeGuardian.creatureId))
{
if (!sObjectMgr.IsExistingCreatureId(tmp.removeGuardian.creatureId))
{
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_REMOVE_GUARDIANS for script id %u", tablename, tmp.removeGuardian.creatureId, tmp.id);
continue;
}
else
DisableScriptAction(tmp);
}
}
break;
}
case SCRIPT_COMMAND_ADD_SPELL_COOLDOWN:
{
if (!sSpellMgr.GetSpellEntry(tmp.addCooldown.spellId))
{
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_ADD_SPELL_COOLDOWN for script id %u", tablename, tmp.addCooldown.spellId, tmp.id);
continue;
}
if (tmp.addCooldown.cooldown == 0)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_ADD_SPELL_COOLDOWN for script id %u.", tablename, tmp.addCooldown.cooldown, tmp.id);
continue;
}
break;
}
case SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN:
{
if (tmp.removeCooldown.spellId)
{
if (!sSpellMgr.GetSpellEntry(tmp.removeCooldown.spellId))
{
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN for script id %u", tablename, tmp.removeCooldown.spellId, tmp.id);
continue;
}
}
break;
}
}