mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10945] Restore check scripting lib API at load.
Also report result of script library load/reload to chat/console.
This commit is contained in:
parent
d4018322b9
commit
84b5ee3b43
10 changed files with 69 additions and 14 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_10932_01_mangos_game_event_creature_data` bit(1) default NULL
|
||||
`required_10945_01_mangos_mangos_string` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -3796,6 +3796,9 @@ INSERT INTO `mangos_string` VALUES
|
|||
(1163,'Achievement %u doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1164,'Achievement criteria %u doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1165,'Spell %u not have auras.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1166,'Scripting library not found or not accessable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1167,'Scripting library has wrong list functions (outdated?).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||
|
|
|
|||
8
sql/updates/10945_01_mangos_mangos_string.sql
Normal file
8
sql/updates/10945_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_10932_01_mangos_game_event_creature_data required_10945_01_mangos_mangos_string bit;
|
||||
|
||||
DELETE FROM mangos_string WHERE entry IN (1166,1167,1168);
|
||||
|
||||
INSERT INTO mangos_string VALUES
|
||||
(1166,'Scripting library not found or not accessable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1167,'Scripting library has wrong list functions (outdated?).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1168,'Scripting library reloaded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
|
|
@ -139,6 +139,7 @@ pkgdata_DATA = \
|
|||
10906_01_mangos_spell_proc_event.sql \
|
||||
10906_02_mangos_spell_bonus_data.sql \
|
||||
10932_01_mangos_game_event_creature_data.sql \
|
||||
10945_01_mangos_mangos_string.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -258,4 +259,5 @@ EXTRA_DIST = \
|
|||
10906_01_mangos_spell_proc_event.sql \
|
||||
10906_02_mangos_spell_bonus_data.sql \
|
||||
10932_01_mangos_game_event_creature_data.sql \
|
||||
10945_01_mangos_mangos_string.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ enum MangosStrings
|
|||
// Room for more level 2 376-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
LANG_SCRIPTS_RELOADED_ANNOUNCE = 400,
|
||||
LANG_YOU_CHANGE_SECURITY = 401,
|
||||
LANG_YOURS_SECURITY_CHANGED = 402,
|
||||
LANG_YOURS_SECURITY_IS_LOW = 403,
|
||||
|
|
@ -885,7 +885,10 @@ enum MangosStrings
|
|||
LANG_ACHIEVEMENT_NOT_EXIST = 1163,
|
||||
LANG_ACHIEVEMENT_CRITERIA_NOT_EXIST = 1164,
|
||||
LANG_SPELL_NO_HAVE_AURAS = 1165,
|
||||
// Room for more level 3 1166-1199 not used
|
||||
LANG_SCRIPTS_NOT_FOUND = 1166,
|
||||
LANG_SCRIPTS_WRONG_API = 1167,
|
||||
LANG_SCRIPTS_RELOADED_OK = 1168,
|
||||
// Room for more level 3 1169-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
|
|
|||
|
|
@ -938,10 +938,20 @@ bool ChatHandler::HandleLoadScriptsCommand(char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
if (!sScriptMgr.LoadScriptLibrary(args))
|
||||
return true;
|
||||
switch(sScriptMgr.LoadScriptLibrary(args))
|
||||
{
|
||||
case SCRIPT_LOAR_OK:
|
||||
sWorld.SendWorldText(LANG_SCRIPTS_RELOADED_ANNOUNCE);
|
||||
SendSysMessage(LANG_SCRIPTS_RELOADED_OK);
|
||||
break;
|
||||
case SCRIPT_LOAR_ERR_NOT_FOUND:
|
||||
SendSysMessage(LANG_SCRIPTS_NOT_FOUND);
|
||||
break;
|
||||
case SCRIPT_LOAR_ERR_WRONG_API:
|
||||
SendSysMessage(LANG_SCRIPTS_WRONG_API);
|
||||
break;
|
||||
}
|
||||
|
||||
sWorld.SendWorldText(LANG_SCRIPTS_RELOADED);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1032,7 +1032,7 @@ bool ScriptMgr::OnAuraDummy(Aura const* pAura, bool apply)
|
|||
return m_pOnAuraDummy != NULL && m_pOnAuraDummy(pAura, apply);
|
||||
}
|
||||
|
||||
bool ScriptMgr::LoadScriptLibrary(const char* libName)
|
||||
ScriptLoadResult ScriptMgr::LoadScriptLibrary(const char* libName)
|
||||
{
|
||||
UnloadScriptLibrary();
|
||||
|
||||
|
|
@ -1042,7 +1042,7 @@ bool ScriptMgr::LoadScriptLibrary(const char* libName)
|
|||
m_hScriptLib = MANGOS_LOAD_LIBRARY(name.c_str());
|
||||
|
||||
if (!m_hScriptLib)
|
||||
return false;
|
||||
return SCRIPT_LOAR_ERR_NOT_FOUND;
|
||||
|
||||
GetScriptHookPtr(m_pOnInitScriptLibrary, "InitScriptLibrary");
|
||||
GetScriptHookPtr(m_pOnFreeScriptLibrary, "FreeScriptLibrary");
|
||||
|
|
@ -1073,13 +1073,24 @@ bool ScriptMgr::LoadScriptLibrary(const char* libName)
|
|||
GetScriptHookPtr(m_pOnEffectDummyItem, "EffectDummyItem");
|
||||
GetScriptHookPtr(m_pOnAuraDummy, "AuraDummy");
|
||||
|
||||
if (!m_pOnInitScriptLibrary || !m_pOnFreeScriptLibrary || !m_pGetScriptLibraryVersion ||
|
||||
!m_pGetCreatureAI || !m_pCreateInstanceData ||
|
||||
!m_pOnGossipHello || !m_pOnGOGossipHello || !m_pOnGossipSelect ||
|
||||
!m_pOnGOGossipSelect || !m_pOnGossipSelectWithCode || !m_pOnGOGossipSelectWithCode ||
|
||||
!m_pOnQuestAccept || !m_pOnGOQuestAccept || !m_pOnItemQuestAccept ||
|
||||
!m_pOnQuestRewarded || !m_pOnGOQuestRewarded || !m_pGetNPCDialogStatus ||
|
||||
!m_pGetGODialogStatus || !m_pOnGOUse || !m_pOnItemUse ||
|
||||
!m_pOnAreaTrigger || !m_pOnProcessEvent || !m_pOnEffectDummyCreature ||
|
||||
!m_pOnEffectDummyGO || !m_pOnEffectDummyItem || !m_pOnAuraDummy)
|
||||
return SCRIPT_LOAR_ERR_WRONG_API;
|
||||
|
||||
if (m_pOnInitScriptLibrary)
|
||||
m_pOnInitScriptLibrary();
|
||||
|
||||
if (m_pGetScriptLibraryVersion)
|
||||
sWorld.SetScriptsVersion(m_pGetScriptLibraryVersion());
|
||||
|
||||
return true;
|
||||
return SCRIPT_LOAR_OK;
|
||||
}
|
||||
|
||||
void ScriptMgr::UnloadScriptLibrary()
|
||||
|
|
|
|||
|
|
@ -304,6 +304,13 @@ extern ScriptMapMap sEventScripts;
|
|||
extern ScriptMapMap sGossipScripts;
|
||||
extern ScriptMapMap sCreatureMovementScripts;
|
||||
|
||||
enum ScriptLoadResult
|
||||
{
|
||||
SCRIPT_LOAR_OK,
|
||||
SCRIPT_LOAR_ERR_NOT_FOUND,
|
||||
SCRIPT_LOAR_ERR_WRONG_API
|
||||
};
|
||||
|
||||
class ScriptMgr
|
||||
{
|
||||
public:
|
||||
|
|
@ -330,7 +337,7 @@ class ScriptMgr
|
|||
const char* GetScriptName(uint32 id) const { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
||||
uint32 GetScriptId(const char *name) const;
|
||||
|
||||
bool LoadScriptLibrary(const char* libName);
|
||||
ScriptLoadResult LoadScriptLibrary(const char* libName);
|
||||
void UnloadScriptLibrary();
|
||||
|
||||
CreatureAI* GetCreatureAI(Creature* pCreature);
|
||||
|
|
|
|||
|
|
@ -1249,8 +1249,19 @@ void World::SetInitialWorldSettings()
|
|||
sLog.outString( "Loading CreatureEventAI Scripts...");
|
||||
sEventAIMgr.LoadCreatureEventAI_Scripts();
|
||||
|
||||
sLog.outString( "Initializing Scripts..." );
|
||||
sScriptMgr.LoadScriptLibrary(MANGOS_SCRIPT_NAME);
|
||||
sLog.outString("Initializing Scripts...");
|
||||
switch(sScriptMgr.LoadScriptLibrary(MANGOS_SCRIPT_NAME))
|
||||
{
|
||||
case SCRIPT_LOAR_OK:
|
||||
sLog.outString("Scripting library loaded.");
|
||||
break;
|
||||
case SCRIPT_LOAR_ERR_NOT_FOUND:
|
||||
sLog.outError("Scripting library not found or not accessable.");
|
||||
break;
|
||||
case SCRIPT_LOAR_ERR_WRONG_API:
|
||||
sLog.outError("Scripting library has wrong list functions (outdated?).");
|
||||
break;
|
||||
}
|
||||
|
||||
///- Initialize game time and timers
|
||||
sLog.outString( "DEBUG:: Initialize game time and timers" );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10944"
|
||||
#define REVISION_NR "10945"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_10862_01_characters_mail"
|
||||
#define REVISION_DB_MANGOS "required_10932_01_mangos_game_event_creature_data"
|
||||
#define REVISION_DB_MANGOS "required_10945_01_mangos_mangos_string"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue