diff options
34 files changed, 18 insertions, 335 deletions
diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h index 205135c62d0..5ebed25819a 100644 --- a/src/framework/Platform/Define.h +++ b/src/framework/Platform/Define.h @@ -40,25 +40,12 @@ #endif //TRINITY_ENDIAN #if PLATFORM == PLATFORM_WINDOWS -# define TRINITY_IMPORT __cdecl # define TRINITY_PATH_MAX MAX_PATH -#else //PLATFORM != PLATFORM_WINDOWS -# if defined(__APPLE_CC__) && defined(BIG_ENDIAN) -# define TRINITY_IMPORT __attribute__ ((longcall)) -# elif defined(__x86_64__) -# define TRINITY_IMPORT -# else -# define TRINITY_IMPORT __attribute__ ((cdecl)) -# endif //__APPLE_CC__ && BIG_ENDIAN -# define TRINITY_PATH_MAX PATH_MAX -#endif //PLATFORM - - -#if PLATFORM == PLATFORM_WINDOWS # ifndef DECLSPEC_NORETURN # define DECLSPEC_NORETURN __declspec(noreturn) # endif //DECLSPEC_NORETURN #else //PLATFORM != PLATFORM_WINDOWS +# define TRINITY_PATH_MAX PATH_MAX # define DECLSPEC_NORETURN #endif //PLATFORM diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 9ca6d410ce8..f39f36df3d6 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -225,8 +225,6 @@ SET(game_STAT_SRCS ReactorAI.h ReputationMgr.cpp ReputationMgr.h - ScriptCalls.cpp - ScriptCalls.h ScriptedSmartAI.cpp ScriptedSmartAI.h ScriptLoader.cpp diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 1262550f808..bc2b4d97a4e 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -42,7 +42,6 @@ #include "SocialMgr.h" #include "UpdateMask.h" #include "Util.h" -#include "ScriptCalls.h" #include "SpellId.h" #include "ScriptMgr.h" diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 8dae5f37aa5..3c595d49124 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -35,7 +35,6 @@ #include "Player.h" #include "UpdateMask.h" #include "SpellMgr.h" -#include "ScriptCalls.h" // Supported shift-links (client generated and server side) // |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index 4d2636afa02..057e73d3bc9 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -36,7 +36,6 @@ #include "Log.h" #include "Opcodes.h" #include "Player.h" -#include "ScriptCalls.h" #include "SpellAuras.h" #include "SpellAuraEffects.h" #include "Util.h" diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 0794b9c551d..8dd256eca6a 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -23,7 +23,6 @@ #include "PassiveAI.h" #include "Policies/SingletonImp.h" #include "MovementGenerator.h" -#include "ScriptCalls.h" #include "Pet.h" #include "TemporarySummon.h" #include "CreatureAIFactory.h" diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index 96c8155c9de..7def90fe5f4 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -37,7 +37,6 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "SpellMgr.h" -#include "ScriptCalls.h" #include "ScriptMgr.h" bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args) diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 61c86d389b7..d1a5612b95c 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -25,7 +25,6 @@ #include "Database/DatabaseEnv.h" #include "ItemEnchantmentMgr.h" #include "SpellMgr.h" -#include "ScriptCalls.h" #include "ScriptMgr.h" void AddItemsSetItem(Player*player,Item *item) diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 4abc778e485..b1853c93d77 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -109,7 +109,6 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) // full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID); //SendSysMessage(full); - //PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion()); //PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion()); //PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion()); PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 5e3b0c57b97..864f827df7d 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -36,7 +36,6 @@ #include "Guild.h" #include "ObjectAccessor.h" #include "MapManager.h" -#include "ScriptCalls.h" #include "Language.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d73833e30e2..0d65f26127b 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -33,7 +33,6 @@ #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "World.h" -#include "ScriptCalls.h" #include "Group.h" #include "MapRefManager.h" #include "Vehicle.h" diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 9f9c8f84c46..b366c37c40b 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -35,7 +35,6 @@ #include "UpdateData.h" #include "LootMgr.h" #include "Chat.h" -#include "ScriptCalls.h" #include <zlib/zlib.h> #include "ObjectAccessor.h" #include "Object.h" diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index c7e5619bdf9..fc2c590745a 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -30,7 +30,6 @@ #include "Player.h" #include "GossipDef.h" #include "UpdateMask.h" -#include "ScriptCalls.h" #include "ObjectAccessor.h" #include "Creature.h" #include "Pet.h" diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 4df3508bfab..4b9f3eddd04 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -29,7 +29,6 @@ #include "GossipDef.h" #include "QuestDef.h" #include "ObjectAccessor.h" -#include "ScriptCalls.h" #include "Group.h" #include "BattleGround.h" #include "BattleGroundAV.h" diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp deleted file mode 100644 index cc2744f5c71..00000000000 --- a/src/game/ScriptCalls.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef WIN32 -#include <dlfcn.h> -#endif - -#include "Common.h" -#include "Platform/Define.h" -#include "ScriptCalls.h" -#include "World.h" -#include "Config/ConfigEnv.h" -#include "ScriptMgr.h" - -void LoadScriptingModule() -{ - sScriptMgr.ScriptsInit(); - sWorld.SetScriptsVersion(sScriptMgr.ScriptsVersion()); -} - diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h deleted file mode 100644 index 83b93760b07..00000000000 --- a/src/game/ScriptCalls.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __SCRIPT_CALLS_H -#define __SCRIPT_CALLS_H - -#include "Common.h" -#include "ObjectMgr.h" - -class Creature; -class CreatureAI; -class GameObject; -class Item; -class Player; -class Quest; -class SpellCastTargets; -class Map; -class InstanceData; - -void LoadScriptingModule(); - -//On Event Handlers -typedef void(TRINITY_IMPORT * scriptCallOnLogin) (Player *pPlayer); -typedef void(TRINITY_IMPORT * scriptCallOnLogout) (Player *pPlayer); -typedef void(TRINITY_IMPORT * scriptCallOnPVPKill) (Player *killer, Player *killed); -typedef bool(TRINITY_IMPORT * scriptCallOnSpellCast)(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGoTarget, uint32 i, SpellEntry const *spell); -typedef uint32(TRINITY_IMPORT * scriptCallOnGetXP) (Player *pPlayer, uint32 amount); -typedef int32(TRINITY_IMPORT * scriptCallOnGetMoney) (Player *pPlayer, int32 amount); -typedef bool(TRINITY_IMPORT * scriptCallOnPlayerChat) (Player *pPlayer, const char *text); -typedef void(TRINITY_IMPORT * scriptCallOnServerStartup) (); -typedef void(TRINITY_IMPORT * scriptCallOnServerShutdown) (); -typedef void(TRINITY_IMPORT * scriptCallOnAreaChange) (Player *pPlayer, AreaTableEntry const *pArea); -typedef bool(TRINITY_IMPORT * scriptCallOnItemClick) (Player *pPlayer, Item *pItem); -typedef bool(TRINITY_IMPORT * scriptCallOnItemOpen) (Player *pPlayer, Item *pItem); -typedef bool(TRINITY_IMPORT * scriptCallOnGoClick) (Player *pPlayer, GameObject *pGameObject); -typedef void(TRINITY_IMPORT * scriptCallOnCreatureKill) (Player *pPlayer, Creature *pCreature); - -typedef bool(TRINITY_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature ); -typedef bool(TRINITY_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *); -typedef bool(TRINITY_IMPORT * scriptCallGossipSelect)(Player *player, Creature *_Creature, uint32 sender, uint32 action); -typedef bool(TRINITY_IMPORT * scriptCallGossipSelectWithCode)( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ); -typedef bool(TRINITY_IMPORT * scriptCallGOSelect)(Player *player, GameObject *_GO, uint32 sender, uint32 action); -typedef bool(TRINITY_IMPORT * scriptCallGOSelectWithCode)( Player *player, GameObject *_GO, uint32 sender, uint32 action, const char* sCode ); -typedef bool(TRINITY_IMPORT * scriptCallQuestSelect)( Player *player, Creature *_Creature, Quest const* ); -typedef bool(TRINITY_IMPORT * scriptCallQuestComplete)(Player *player, Creature *_Creature, Quest const*); -typedef uint32(TRINITY_IMPORT * scriptCallNPCDialogStatus)( Player *player, Creature *_Creature); -typedef uint32(TRINITY_IMPORT * scriptCallGODialogStatus)( Player *player, GameObject * _GO); -typedef bool(TRINITY_IMPORT * scriptCallChooseReward)( Player *player, Creature *_Creature, Quest const*, uint32 opt ); -typedef bool(TRINITY_IMPORT * scriptCallItemHello)( Player *player, Item *, Quest const*); -typedef bool(TRINITY_IMPORT * scriptCallGOHello)( Player *player, GameObject * ); -typedef bool(TRINITY_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTriggerEntry const* ); -typedef bool(TRINITY_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*); -typedef bool(TRINITY_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*); -typedef bool(TRINITY_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt ); -typedef bool(TRINITY_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets); -typedef bool(TRINITY_IMPORT * scriptCallItemExpire) (Player *player, ItemPrototype const *_ItemProto); -typedef bool(TRINITY_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget); -typedef bool(TRINITY_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget); -typedef bool(TRINITY_IMPORT * scriptCallEffectDummyItem) (Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget); -typedef CreatureAI* (TRINITY_IMPORT * scriptCallGetAI) ( Creature *_Creature ); -typedef InstanceData* (TRINITY_IMPORT * scriptCallCreateInstanceData) (Map *map); - -typedef struct -{ - scriptCallOnLogin OnLogin; - scriptCallOnLogout OnLogout; - scriptCallOnPVPKill OnPVPKill; - scriptCallOnSpellCast OnSpellCast; - scriptCallOnGetXP OnGetXP; - scriptCallOnGetMoney OnGetMoney; - scriptCallOnPlayerChat OnPlayerChat; - scriptCallOnServerStartup OnServerStartup; - scriptCallOnServerShutdown OnServerShutdown; - scriptCallOnAreaChange OnAreaChange; - scriptCallOnItemClick OnItemClick; - scriptCallOnItemOpen OnItemOpen; - scriptCallOnGoClick OnGoClick; - scriptCallOnCreatureKill OnCreatureKill; - scriptCallGossipHello GossipHello; - scriptCallGOChooseReward GOChooseReward; - scriptCallQuestAccept QuestAccept; - scriptCallGossipSelect GossipSelect; - scriptCallGossipSelectWithCode GossipSelectWithCode; - scriptCallGOSelect GOSelect; - scriptCallGOSelectWithCode GOSelectWithCode; - scriptCallQuestSelect QuestSelect; - scriptCallQuestComplete QuestComplete; - scriptCallNPCDialogStatus NPCDialogStatus; - scriptCallGODialogStatus GODialogStatus; - scriptCallChooseReward ChooseReward; - scriptCallItemHello ItemHello; - scriptCallGOHello GOHello; - scriptCallAreaTrigger scriptAreaTrigger; - scriptCallItemQuestAccept ItemQuestAccept; - scriptCallGOQuestAccept GOQuestAccept; - scriptCallItemUse ItemUse; - scriptCallItemExpire ItemExpire; - scriptCallEffectDummyGameObj EffectDummyGameObj; - scriptCallEffectDummyCreature EffectDummyCreature; - scriptCallEffectDummyItem EffectDummyItem; - scriptCallGetAI GetAI; - scriptCallCreateInstanceData CreateInstanceData; -}_ScriptSet,*ScriptsSet; -#endif - diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index d55182009d8..0f2836c161e 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -12,48 +12,20 @@ #include "ScriptSystem.h" #include "Policies/SingletonImp.h" -#define _FULLVERSION "TrinityScript" - INSTANTIATE_SINGLETON_1(ScriptMgr); int num_sc_scripts; Script *m_scripts[MAX_SCRIPTS]; -Config TScriptConfig; - void FillSpellSummary(); void LoadOverridenSQLData(); void ScriptMgr::LoadDatabase() { - //Get db string from file - std::string dbstring = TScriptConfig.GetStringDefault("WorldDatabaseInfo", ""); - - if (dbstring.empty()) - { - error_log("TSCR: Missing world database info from configuration file. Load database aborted."); - return; - } - - //Initialize connection to DB - if (!dbstring.empty() && TScriptDB.Initialize(dbstring.c_str())) - { - outstring_log("TSCR: TrinityScript database initialized successfully."); - outstring_log(""); - - pSystemMgr.LoadVersion(); - pSystemMgr.LoadScriptTexts(); - pSystemMgr.LoadScriptTextsCustom(); - pSystemMgr.LoadScriptWaypoints(); - } - else - { - error_log("TSCR: Unable to connect to database at %s. Load database aborted.", dbstring.c_str()); - return; - } - - TScriptDB.HaltDelayThread(); - + pSystemMgr.LoadVersion(); + pSystemMgr.LoadScriptTexts(); + pSystemMgr.LoadScriptTextsCustom(); + pSystemMgr.LoadScriptWaypoints(); } struct TSpellSummary { @@ -70,7 +42,7 @@ ScriptMgr::~ScriptMgr() } -void ScriptMgr::ScriptsInit(char const* cfg_file) +void ScriptMgr::ScriptsInit() { //Trinity Script startup outstring_log(" _____ _ _ _ ____ _ _"); @@ -79,15 +51,7 @@ void ScriptMgr::ScriptsInit(char const* cfg_file) outstring_log(" | || | | | | | | | |_| |_| |___) | (__| | | | |_) | |_ "); outstring_log(" |_||_| |_|_| |_|_|\\__|\\__, |____/ \\___|_| |_| .__/ \\__|"); outstring_log(" |___/ |_| "); - outstring_log("Trinity Script initializing %s", _FULLVERSION); outstring_log(""); - - //Get configuration file - if (!TScriptConfig.SetSource(cfg_file)) - error_log("TSCR: Unable to open configuration file. Database will be unaccessible. Configuration values will use default."); - else - outstring_log("TSCR: Using configuration file %s",cfg_file); - outstring_log(""); //Load database (must be called after SD2Config.SetSource). @@ -114,35 +78,6 @@ void ScriptMgr::ScriptsInit(char const* cfg_file) //********************************* //*** Functions used globally *** -std::string ScriptMgr:: GetConfigValueStr(char const* option) -{ - //Get db string from file - std::string dbstring = TScriptConfig.GetStringDefault(option, ""); - - if (dbstring.empty()) - { - error_log("TSCR: %s is not a valid option.", option); - return "error"; - } - return dbstring; -} - -int32 ScriptMgr::GetConfigValueInt32(char const* option) -{ - //Get db int from file - int32 dbint = TScriptConfig.GetIntDefault(option, 0); - - return dbint; -} - -float ScriptMgr::GetConfigValueFloat(char const* option) -{ - //Get db int from file - float dbfloat = TScriptConfig.GetFloatDefault(option, 0); - - return dbfloat; -} - void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) { if (!pSource) diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index 9ae6ad13103..056dd712fdb 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -13,10 +13,6 @@ #include "DBCStructure.h" #include "Config/ConfigEnv.h" -#ifndef _TRINITY_SCRIPT_CONFIG -# define _TRINITY_SCRIPT_CONFIG sConfig.GetFilename().c_str() -#endif _TRINITY_SCRIPT_CONFIG - class Player; class Creature; class CreatureAI; @@ -101,14 +97,10 @@ class ScriptMgr ScriptMgr(); ~ScriptMgr(); - void ScriptsInit(char const* cfg_file = _TRINITY_SCRIPT_CONFIG); + void ScriptsInit(); void LoadDatabase(); char const* ScriptsVersion(); - std::string GetConfigValueStr(char const* option); - int32 GetConfigValueInt32(char const* option); - float GetConfigValueFloat(char const* option); - //event handlers void OnLogin(Player *pPlayer); void OnLogout(Player *pPlayer); diff --git a/src/game/ScriptSystem.cpp b/src/game/ScriptSystem.cpp index 261852b27de..ffa2c6dd404 100644 --- a/src/game/ScriptSystem.cpp +++ b/src/game/ScriptSystem.cpp @@ -24,8 +24,6 @@ #include "ObjectMgr.h" #include "Database/DatabaseEnv.h" -DatabaseType TScriptDB; - SystemMgr::SystemMgr() { } @@ -39,7 +37,7 @@ SystemMgr& SystemMgr::Instance() void SystemMgr::LoadVersion() { //Get Version information - QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1"); + QueryResult_AutoPtr Result = WorldDatabase.PQuery("SELECT script_version FROM version LIMIT 1"); if (Result) { @@ -58,9 +56,9 @@ void SystemMgr::LoadVersion() void SystemMgr::LoadScriptTexts() { outstring_log("TSCR: Loading Script Texts..."); - LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); + LoadTrinityStrings(WorldDatabase,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); - QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts"); + QueryResult_AutoPtr Result = WorldDatabase.PQuery("SELECT entry, sound, type, language, emote FROM script_texts"); outstring_log("TSCR: Loading Script Texts additional data..."); @@ -124,9 +122,9 @@ void SystemMgr::LoadScriptTexts() void SystemMgr::LoadScriptTextsCustom() { outstring_log("TSCR: Loading Custom Texts..."); - LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); + LoadTrinityStrings(WorldDatabase,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); - QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); + QueryResult_AutoPtr Result = WorldDatabase.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); outstring_log("TSCR: Loading Custom Texts additional data..."); @@ -195,13 +193,13 @@ void SystemMgr::LoadScriptWaypoints() uint64 uiCreatureCount = 0; // Load Waypoints - QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); + QueryResult_AutoPtr Result = WorldDatabase.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); if (Result) uiCreatureCount = Result->GetRowCount(); outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); - Result = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); + Result = WorldDatabase.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (Result) { diff --git a/src/game/ScriptSystem.h b/src/game/ScriptSystem.h index 479f856514a..f78cd2e64fa 100644 --- a/src/game/ScriptSystem.h +++ b/src/game/ScriptSystem.h @@ -5,8 +5,6 @@ #ifndef SC_SYSTEM_H #define SC_SYSTEM_H -extern DatabaseType TScriptDB; - #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available //TODO: find better namings and definitions. diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6cbb9b16e48..ad2a6c867be 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -49,7 +49,6 @@ #include "Util.h" #include "TemporarySummon.h" #include "Vehicle.h" -#include "ScriptCalls.h" #include "SpellAuraEffects.h" #include "SpellId.h" #include "ScriptMgr.h" diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index 15d8084b828..30e019d669d 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -34,7 +34,6 @@ #include "BattleGround.h" #include "OutdoorPvPMgr.h" #include "Formulas.h" -#include "ScriptCalls.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9ced669238d..3ca24609a3e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -206,38 +206,6 @@ void AuraApplication::ClientUpdate(bool remove) m_target->SendMessageToSet(&data, true); } -void AuraApplication::ConstructAuraInfo(ByteBuffer &data) -{ - m_needClientUpdate = false; - - data << uint8(m_slot); - - if(!m_target->GetVisibleAura(m_slot)) - { - data << uint32(0); - sLog.outDebug("Aura %u removed slot %u",GetBase()->GetId(), m_slot); - return; - } - - Aura const * aura = GetBase(); - data << uint32(aura->GetId()); - uint32 flags = m_flags; - if (aura->GetMaxDuration() > 0) - flags |= AFLAG_DURATION; - data << uint8(flags); - data << uint8(aura->GetCasterLevel()); - data << uint8(aura->GetStackAmount() > 1 ? aura->GetStackAmount() : (aura->GetCharges()) ? aura->GetCharges() : 1); - - if(!(flags & AFLAG_CASTER)) - data.appendPackGUID(aura->GetCasterGUID()); - - if(flags & AFLAG_DURATION) - { - data << uint32(aura->GetMaxDuration()); - data << uint32(aura->GetDuration()); - } -} - Aura * Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID) { assert(spellproto); diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 272e1f7cfa5..f6cd3804d53 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -75,7 +75,6 @@ class AuraApplication void SetNeedClientUpdate() { m_needClientUpdate = true;} bool IsNeedClientUpdate() const { return m_needClientUpdate;} void ClientUpdate(bool remove = false); - void ConstructAuraInfo(ByteBuffer &); }; class Aura diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f089e419fa7..be7a3606086 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -56,7 +56,6 @@ #include "SocialMgr.h" #include "Util.h" #include "TemporarySummon.h" -#include "ScriptCalls.h" #include "CellImpl.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 7abb9820d71..74e29ec0b3c 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -27,7 +27,6 @@ #include "Log.h" #include "Opcodes.h" #include "Spell.h" -#include "ScriptCalls.h" #include "Totem.h" #include "TemporarySummon.h" #include "SpellAuras.h" diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2b194a42f1f..e315f70cd30 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -54,7 +54,6 @@ #include "TemporarySummon.h" #include "Vehicle.h" #include "Transports.h" -#include "ScriptCalls.h" #include "SpellId.h" #include <math.h> diff --git a/src/game/World.cpp b/src/game/World.cpp index f23d4a23d22..9b92a4f56fa 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -47,7 +47,6 @@ #include "LootMgr.h" #include "ItemEnchantmentMgr.h" #include "MapManager.h" -#include "ScriptCalls.h" #include "CreatureAIRegistry.h" #include "Policies/SingletonImp.h" #include "BattleGroundMgr.h" @@ -1584,7 +1583,7 @@ void World::SetInitialWorldSettings() CreatureEAI_Mgr.LoadCreatureEventAI_Scripts(); sLog.outString("Initializing Scripts..."); - LoadScriptingModule(); + sScriptMgr.ScriptsInit(); ///- Initialize game time and timers sLog.outDebug("DEBUG:: Initialize game time and timers"); diff --git a/src/game/World.h b/src/game/World.h index ce680e10711..e18d1803a3d 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -630,10 +630,6 @@ class World char const* GetDBVersion() { return m_DBVersion.c_str(); } char const* GetCreatureEventAIVersion() { return m_CreatureEventAIVersion.c_str(); } - //used Script version - void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } - char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } - void RecordTimeDiff(const char * text, ...); void LoadAutobroadcasts(); @@ -729,7 +725,6 @@ class World //used versions std::string m_DBVersion; std::string m_CreatureEventAIVersion; - std::string m_ScriptsVersion; std::list<std::string> m_Autobroadcasts; }; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index c87421e4d59..ddf0c9173bd 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -41,7 +41,6 @@ #include "MapManager.h" #include "SocialMgr.h" #include "zlib/zlib.h" -#include "ScriptCalls.h" #include "ScriptMgr.h" /// WorldSession constructor diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 417490e2d6d..839a4154ed3 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -43,6 +43,7 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "ObjectMgr.h" #include "ScriptMgr.h" +#include "World.h" /*######## # npc_air_force_bots @@ -1220,7 +1221,7 @@ bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE1, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_UNLEARNTALENTS); - if (!(pPlayer->GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sScriptMgr.GetConfigValueInt32("MinDualSpecLevel")))) + if (!(pPlayer->GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE3, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_LEARNDUALSPEC); if (pPlayer->getClass() == CLASS_ROGUE && pPlayer->getLevel() >= 24 && !pPlayer->HasItemCount(17126,1) && !pPlayer->GetQuestRewardStatus(6681)) @@ -1249,7 +1250,7 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 pPlayer->SendTalentWipeConfirm(pCreature->GetGUID()); break; case GOSSIP_OPTION_LEARNDUALSPEC: - if(pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sScriptMgr.GetConfigValueInt32("MinDualSpecLevel"))) + if(pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) { if (pPlayer->GetMoney() < 10000000) { diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index f8bd94fc912..f1a24d09d99 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -35,7 +35,6 @@ #include "Log.h" #include "MapManager.h" #include "Player.h" -#include "ScriptCalls.h" #include "Util.h" #if PLATFORM != WINDOWS diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index 1b7b369c5c6..4d11897d02d 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -38,7 +38,6 @@ #include "Log.h" #include "Master.h" #include "RASocket.h" -#include "ScriptCalls.h" #include "Timer.h" #include "Util.h" diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 58cf430596e..4f3a1945096 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -759,14 +759,6 @@ > </File> <File - RelativePath="..\..\src\game\ScriptCalls.cpp" - > - </File> - <File - RelativePath="..\..\src\game\ScriptCalls.h" - > - </File> - <File RelativePath="..\..\src\game\SkillDiscovery.cpp" > </File> |