Files
TrinityCore/src/server/scripts/Examples/example_misc.cpp
Nay 3561ab98ba Misc: Use override and final C++11 keywords in a few places (mostly scripts)
OVERRIDE and FINAL are TC macros (expand to nothing if compiler does not  support C++11)
2013-07-06 20:21:45 +01:00

83 lines
2.2 KiB
C++

/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 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 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
SDName: Example_Misc
SD%Complete: 100
SDComment: Item, Areatrigger and other small code examples
SDCategory: Script Examples
EndScriptData */
#include "ScriptMgr.h"
#include "Player.h"
class AT_example_areatrigger : public AreaTriggerScript
{
public:
AT_example_areatrigger()
: AreaTriggerScript("example_areatrigger")
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) OVERRIDE
{
player->Kill(player);
return true;
}
};
class ItemUse_example_item : public ItemScript
{
public:
ItemUse_example_item()
: ItemScript("example_item")
{
}
bool OnUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/) OVERRIDE
{
sScriptMgr->LoadDatabase();
return true;
}
};
class GOHello_example_go_teleporter : public GameObjectScript
{
public:
GOHello_example_go_teleporter()
: GameObjectScript("example_go_teleporter")
{
}
bool OnGossipHello(Player* player, GameObject* /*go*/) OVERRIDE
{
player->TeleportTo(0, 1807.07f, 336.105f, 70.3975f, 0.0f);
return false;
}
};
void AddSC_example_misc()
{
new AT_example_areatrigger();
new ItemUse_example_item();
new GOHello_example_go_teleporter();
}