Files
mod-transmog/src/cs_transmog.cpp
Skjalf f8e65ac3cd feat: Implement optional transmogs (#62)
* feat: Implement optional transmogs

* logic

* Enable disabling transmog

* Update transmog.conf.dist

* Hide the npc if transmog is off
2022-01-11 13:27:54 -03:00

65 lines
1.9 KiB
C++

/*
* 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/>.
*/
#include "Chat.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Transmogrification.h"
using namespace Acore::ChatCommands;
class transmog_commandscript : public CommandScript
{
public:
transmog_commandscript() : CommandScript("transmog_commandscript") { }
ChatCommandTable GetCommands() const override
{
static ChatCommandTable commandTable =
{
{ "transmog", HandleDisableTransMogVisual, SEC_PLAYER, Console::No },
};
return commandTable;
}
static bool HandleDisableTransMogVisual(ChatHandler* handler, bool hide)
{
Player* player = handler->GetPlayer();
if (hide)
{
player->UpdatePlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG, 0);
handler->SendSysMessage(LANG_CMD_TRANSMOG_SHOW);
}
else
{
player->UpdatePlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG, 1);
handler->SendSysMessage(LANG_CMD_TRANSMOG_HIDE);
}
player->UpdateObjectVisibility();
return true;
}
};
void AddSC_transmog_commandscript()
{
new transmog_commandscript();
}