Professional Documents
Culture Documents
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright
information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
Name: disable_commandscript
%Complete: 100
Comment: All disable related commands
Category: commandscripts
EndScriptData */
#include "AchievementMgr.h"
#include "Chat.h"
#include "DisableMgr.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellMgr.h"
switch (disableType)
{
case DISABLE_TYPE_SPELL:
{
if (!sSpellMgr->GetSpellInfo(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "spell";
break;
}
case DISABLE_TYPE_QUEST:
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND,
entry);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "quest";
break;
}
case DISABLE_TYPE_MAP:
{
if (!sMapStore.LookupEntry(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "map";
break;
}
case DISABLE_TYPE_BATTLEGROUND:
{
if (!sBattlemasterListStore.LookupEntry(entry))
{
handler-
>PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "battleground";
break;
}
case DISABLE_TYPE_OUTDOORPVP:
{
if (entry > MAX_OUTDOORPVP_TYPES)
{
handler-
>PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "outdoorpvp";
break;
}
case DISABLE_TYPE_VMAP:
{
if (!sMapStore.LookupEntry(entry))
{
handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
handler->SetSentErrorMessage(true);
return false;
}
disableTypeStr = "vmap";
break;
}
default:
break;
}
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
stmt->setUInt32(0, entry);
stmt->setUInt8(1, disableType);
stmt->setUInt16(2, flags);
stmt->setString(3, disableComment);
WorldDatabase.Execute(stmt);
switch (disableType)
{
case DISABLE_TYPE_SPELL:
disableTypeStr = "spell";
break;
case DISABLE_TYPE_QUEST:
disableTypeStr = "quest";
break;
case DISABLE_TYPE_MAP:
disableTypeStr = "map";
break;
case DISABLE_TYPE_BATTLEGROUND:
disableTypeStr = "battleground";
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
disableTypeStr = "achievement criteria";
break;
case DISABLE_TYPE_OUTDOORPVP:
disableTypeStr = "outdoorpvp";
break;
case DISABLE_TYPE_VMAP:
disableTypeStr = "vmap";
break;
}
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
stmt->setUInt32(0, entry);
stmt->setUInt8(1, disableType);
WorldDatabase.Execute(stmt);
void AddSC_disable_commandscript()
{
new disable_commandscript();
}