diff options
| author | XTZGZoReX <none@none> | 2010-08-06 19:23:43 +0200 |
|---|---|---|
| committer | XTZGZoReX <none@none> | 2010-08-06 19:23:43 +0200 |
| commit | 946adf469c14deeaf202cba5378fb5edfd792bd6 (patch) | |
| tree | ce27f0aaa34c6cd06fbdf234ec31ff6abc9ce80c /src/server/scripts | |
| parent | 2562a4651f94e2dc40ccce108a2497c2c26bfff6 (diff) | |
*** New core <-> script library interface - complete rewrite of the old one.
* Removed the misdesigned on_events script/hooks.
* Lots of related cleanups and assertions.
* The interface is now fully object-oriented.
** Scripts no longer use function pointers.
** Scripts no longer use the general-purpose Script struct for everything.
** Script types are split into separate classes which must be inherited depending on what functionality is desired.
* Several script types have been added to allow extending functionality in a code-only manner (some script types require
assignment in the recently added ScriptName columns in the database, though).
** SpellHandlerScript: Wrapper around spell scripts (returns new SpellScript objects (`spell_script_names`.`ScriptName`)).
** ServerScript: Allows scripting events that occur in the network layer.
** WorldScript: Allows scripting certain world-global events.
** FormulaScript: Allows hooking and interfering with core formulas.
** *MapScript: Allows hooking different map types (including world, instance, and battleground maps (`instance_template`.`ScriptName`)).
** ItemScript: Allows scripting of items (like the old interface (`item_template`.`ScriptName`)).
** CreatureScript: Allows scripting of creatures/AI (like the old interface (`creature_template`.`ScriptName`)).
** GameObjectScript: Allows scripting of gameobjects (like the old interface (`gameobject_template`.`ScriptName`)).
** AreaTriggerScript: Allows scripting triggered area triggers (like the old interface (`areatrigger_scripts`.`ScriptName`)).
** OutdoorPvPScript: Script which should return OutdoorPvP objects for use by OutdoorPvPMgr (`outdoorpvp_template`.`ScriptName`).
** CommandScript: Allows extending the in-core command table.
** WeatherScript: Allows scripting of weather changes (`game_weather`.`ScriptName`).
** AuctionHouseScript: Allows scripting of auction events.
** ConditionScript: Allows scripting of conditions (`conditions`.`ScriptName`).
** DynamicObjectScript: Allows scripting of dynamicobjects.
** TransportScript: Allows scripting of transport events (`transports`.`ScriptName`).
* OutdoorPvP objects are now created through scripts. This effectively means that they'll need to be moved to scripts
before the they're functional again.
* The whole idea with this new interface is to allow expanding core functionality without touching core code. If further
hooks are needed to expand functionality of the core, let us know; we'll add them, if we agree that it is appropriate
to do so.
*** NOTE: The scripts project will _not_ build before it has been adapted to the new interface.
*** Thanks to everyone who helped out with related preparations and suggestions!
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/server/scripts/Custom/on_events.cpp | 125 | ||||
| -rw-r--r-- | src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h | 48 |
3 files changed, 25 insertions, 150 deletions
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index eef7b7f65d3..b7cef4d8832 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -31,7 +31,6 @@ set(scripts_STAT_SRCS ${scripts_world} ${scripts_spells} ${scripts_examples} - Custom/on_events.cpp ../game/AI/ScriptedAI/ScriptedEscortAI.cpp ../game/AI/ScriptedAI/ScriptedCreature.cpp ../game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -90,6 +89,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle ${CMAKE_SOURCE_DIR}/src/server/game/Events diff --git a/src/server/scripts/Custom/on_events.cpp b/src/server/scripts/Custom/on_events.cpp deleted file mode 100644 index 58cc8275a3a..00000000000 --- a/src/server/scripts/Custom/on_events.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/> - * - * 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/>. - */ - -#include "ScriptPCH.h" -#include <cstring> - -//This function is called when the player logs in (every login) -void OnLogin(Player * /*pPlayer*/) -{ - -} - -//This function is called when the player logs out -void OnLogout(Player * /*pPlayer*/) -{ - -} - -//This function is called when the player kills another player -void OnPVPKill(Player * /*killer*/, Player * /*killed*/) -{ - -} - -//This function is called when a players AreaID changes -void OnAreaChange(Player * /*pPlayer*/, AreaTableEntry const * /*pArea*/) -{ - -} - -//This is called when a player kills a creature (non pvp) -void OnCreatureKill(Player * /*pPlayer*/, Creature * /*pCreature*/) -{ - -} - -//This function is called when a player has a money exchange -int32 OnGetMoney(Player * /*pPlayer*/, int32 amount) -{ - return amount; -} - -//This function is called whenever a player gets XP -uint32 OnGetXP(Player * /*pPlayer*/, uint32 amount) -{ - return amount; -} - -//This function is called when a player clicks a GO Object -bool OnGoClick(Player * /*pPlayer*/, GameObject * /*pGameObject*/) -{ - return true; -} - -//This function is called when a player clicks and item -bool OnItemClick(Player * /*pPlayer*/, Item * /*pItem*/) -{ - return true; -} - -//This function is called when a player opens an item (like a clam) -bool OnItemOpen(Player * /*pPlayer*/, Item * /*pItem*/) -{ - return true; -} - -//This function is called when a player sends a chat message -bool OnPlayerChat(Player * /*pPlayer*/, const char * /*text*/) -{ - return true; -} - -//this function is called when the server starts -void OnServerStartup() -{ - -} -//this function is called when the server shuts down -void OnServerShutdown() -{ - -} - -//this function is called when a player casts a spell -bool OnSpellCast(Unit * /*pUnitTarget*/, Item * /*pItemTarget*/, GameObject * /*pGoTarget*/, uint32 /*i*/, SpellEntry const * /*spell*/) -{ - return true; -} - - void AddSC_onevents() -{ - Script *newscript; - newscript = new Script; - newscript->Name = "scripted_on_events"; - newscript->pOnLogin = &OnLogin; - newscript->pOnLogout = &OnLogout; - newscript->pOnPVPKill = &OnPVPKill; - newscript->pOnAreaChange = &OnAreaChange; - newscript->pOnCreatureKill = &OnCreatureKill; - newscript->pOnGetMoney = &OnGetMoney; - newscript->pOnGetXP = &OnGetXP; - newscript->pOnGoClick = &OnGoClick; - newscript->pOnItemClick = &OnItemClick; - newscript->pOnItemOpen = &OnItemOpen; - newscript->pOnPlayerChat = &OnPlayerChat; - newscript->pOnServerShutdown = &OnServerShutdown; - newscript->pOnServerStartup = &OnServerStartup; - newscript->pOnSpellCast = &OnSpellCast; - - newscript->RegisterSelf(); -} diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h index 2fdd536b698..375e586f13b 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h @@ -5,32 +5,32 @@ #ifndef DEF_ZF_H #define DEF_ZF_H - enum zfEntries - { - ENTRY_ZUMRAH = 7271, - ENTRY_BLY = 7604, - ENTRY_RAVEN = 7605, - ENTRY_ORO = 7606, - ENTRY_WEEGLI = 7607, - ENTRY_MURTA = 7608, +enum zfEntries +{ + ENTRY_ZUMRAH = 7271, + ENTRY_BLY = 7604, + ENTRY_RAVEN = 7605, + ENTRY_ORO = 7606, + ENTRY_WEEGLI = 7607, + ENTRY_MURTA = 7608, - GO_END_DOOR = 146084, + GO_END_DOOR = 146084, - EVENT_PYRAMID = 1, - EVENT_GAHZRILLA - }; + EVENT_PYRAMID = 1, + EVENT_GAHZRILLA +}; - enum zfPyramidPhases - { - PYRAMID_NOT_STARTED, //default - PYRAMID_CAGES_OPEN, //happens in GO hello for cages - PYRAMID_ARRIVED_AT_STAIR , //happens in Weegli's movementinform - PYRAMID_WAVE_1, - PYRAMID_PRE_WAVE_2, - PYRAMID_WAVE_2, - PYRAMID_PRE_WAVE_3, - PYRAMID_WAVE_3, - PYRAMID_KILLED_ALL_TROLLS, - }; +enum zfPyramidPhases +{ + PYRAMID_NOT_STARTED, //default + PYRAMID_CAGES_OPEN, //happens in GO hello for cages + PYRAMID_ARRIVED_AT_STAIR , //happens in Weegli's movementinform + PYRAMID_WAVE_1, + PYRAMID_PRE_WAVE_2, + PYRAMID_WAVE_2, + PYRAMID_PRE_WAVE_3, + PYRAMID_WAVE_3, + PYRAMID_KILLED_ALL_TROLLS, +}; #endif
\ No newline at end of file |
