aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/scripts/system')
-rw-r--r--src/bindings/scripts/system/ScriptLoader.cpp23
-rw-r--r--src/bindings/scripts/system/ScriptLoader.h3
-rw-r--r--src/bindings/scripts/system/system.cpp47
-rw-r--r--src/bindings/scripts/system/system.h24
4 files changed, 0 insertions, 97 deletions
diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp
index aa36753cf84..c19015181c5 100644
--- a/src/bindings/scripts/system/ScriptLoader.cpp
+++ b/src/bindings/scripts/system/ScriptLoader.cpp
@@ -1,17 +1,13 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
-
#include "precompiled.h"
-
//custom
-
//examples
extern void AddSC_example_creature();
extern void AddSC_example_escort();
extern void AddSC_example_gossip_codebox();
extern void AddSC_example_misc();
-
//world
extern void AddSC_areatrigger_scripts();
extern void AddSC_boss_emeriss();
@@ -24,7 +20,6 @@ extern void AddSC_item_scripts();
extern void AddSC_npc_professions();
extern void AddSC_npcs_special();
extern void AddSC_npc_taxi();
-
//eastern kingdoms
extern void AddSC_blackrock_depths(); //Blackrock Depths
extern void AddSC_boss_ambassador_flamelash();
@@ -169,7 +164,6 @@ extern void AddSC_boss_hazzarah();
extern void AddSC_boss_renataki();
extern void AddSC_boss_wushoolay();
extern void AddSC_instance_zulgurub();
-
//extern void AddSC_alterac_mountains();
extern void AddSC_arathi_highlands();
extern void AddSC_blasted_lands();
@@ -195,7 +189,6 @@ extern void AddSC_undercity();
extern void AddSC_western_plaguelands();
extern void AddSC_westfall();
extern void AddSC_wetlands();
-
//kalimdor
extern void AddSC_instance_blackfathom_deeps(); //Blackfathom Depths
extern void AddSC_hyjal(); //CoT Battle for Mt. Hyjal
@@ -236,7 +229,6 @@ extern void AddSC_instance_temple_of_ahnqiraj();
extern void AddSC_wailing_caverns(); //Wailing caverns
extern void AddSC_instance_wailing_caverns();
extern void AddSC_zulfarrak(); //Zul'Farrak
-
extern void AddSC_ashenvale();
extern void AddSC_azshara();
extern void AddSC_azuremyst_isle();
@@ -259,7 +251,6 @@ extern void AddSC_thousand_needles();
extern void AddSC_thunder_bluff();
extern void AddSC_ungoro_crater();
extern void AddSC_winterspring();
-
//northrend
extern void AddSC_boss_slad_ran();
extern void AddSC_boss_moorabi();
@@ -339,7 +330,6 @@ extern void AddSC_boss_xevozz();
extern void AddSC_boss_zuramat();
extern void AddSC_instance_violet_hold();
extern void AddSC_violet_hold();
-
extern void AddSC_borean_tundra();
extern void AddSC_dragonblight();
extern void AddSC_grizzly_hills();
@@ -349,7 +339,6 @@ extern void AddSC_sholazar_basin();
extern void AddSC_storm_peaks();
extern void AddSC_wintergrasp();
extern void AddSC_zuldrak();
-
//outland
extern void AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts
extern void AddSC_boss_shirrak_the_dead_watcher();
@@ -420,7 +409,6 @@ extern void AddSC_boss_gatewatcher_iron_hand(); //TK The Mechanar
extern void AddSC_boss_nethermancer_sepethrea();
extern void AddSC_boss_pathaleon_the_calculator();
extern void AddSC_instance_mechanar();
-
extern void AddSC_blades_edge_mountains();
extern void AddSC_boss_doomlordkazzak();
extern void AddSC_boss_doomwalker();
@@ -432,17 +420,14 @@ extern void AddSC_shattrath_city();
extern void AddSC_terokkar_forest();
extern void AddSC_zangarmarsh();
extern void AddSC_onevents();
-
void AddScripts()
{
//custom
-
//examples
AddSC_example_creature();
AddSC_example_escort();
AddSC_example_gossip_codebox();
AddSC_example_misc();
-
//world
AddSC_areatrigger_scripts();
AddSC_boss_emeriss();
@@ -455,7 +440,6 @@ void AddScripts()
AddSC_npc_professions();
AddSC_npcs_special();
AddSC_npc_taxi();
-
//eastern kingdoms
AddSC_blackrock_depths(); //Blackrock Depths
AddSC_boss_ambassador_flamelash();
@@ -600,7 +584,6 @@ void AddScripts()
AddSC_boss_renataki();
AddSC_boss_wushoolay();
AddSC_instance_zulgurub();
-
//AddSC_alterac_mountains();
AddSC_arathi_highlands();
AddSC_blasted_lands();
@@ -626,7 +609,6 @@ void AddScripts()
AddSC_western_plaguelands();
AddSC_westfall();
AddSC_wetlands();
-
//kalimdor
AddSC_instance_blackfathom_deeps(); //Blackfathom Depths
AddSC_hyjal(); //CoT Battle for Mt. Hyjal
@@ -667,7 +649,6 @@ void AddScripts()
AddSC_wailing_caverns(); //Wailing caverns
AddSC_instance_wailing_caverns();
AddSC_zulfarrak(); //Zul'Farrak
-
AddSC_ashenvale();
AddSC_azshara();
AddSC_azuremyst_isle();
@@ -690,7 +671,6 @@ void AddScripts()
AddSC_thunder_bluff();
AddSC_ungoro_crater();
AddSC_winterspring();
-
//northrend
AddSC_boss_slad_ran(); //Gundrak
AddSC_boss_moorabi();
@@ -770,7 +750,6 @@ void AddScripts()
AddSC_boss_zuramat();
AddSC_instance_violet_hold();
AddSC_violet_hold();
-
AddSC_borean_tundra();
AddSC_dragonblight();
AddSC_grizzly_hills();
@@ -780,7 +759,6 @@ void AddScripts()
AddSC_storm_peaks();
AddSC_wintergrasp();
AddSC_zuldrak();
-
//outland
AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts
AddSC_boss_shirrak_the_dead_watcher();
@@ -851,7 +829,6 @@ void AddScripts()
AddSC_boss_nethermancer_sepethrea();
AddSC_boss_pathaleon_the_calculator();
AddSC_instance_mechanar();
-
AddSC_blades_edge_mountains();
AddSC_boss_doomlordkazzak();
AddSC_boss_doomwalker();
diff --git a/src/bindings/scripts/system/ScriptLoader.h b/src/bindings/scripts/system/ScriptLoader.h
index 57fb7d821f1..ad992e5cf12 100644
--- a/src/bindings/scripts/system/ScriptLoader.h
+++ b/src/bindings/scripts/system/ScriptLoader.h
@@ -1,10 +1,7 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
-
#ifndef SC_SCRIPTLOADER_H
#define SC_SCRIPTLOADER_H
-
void AddScripts();
-
#endif
diff --git a/src/bindings/scripts/system/system.cpp b/src/bindings/scripts/system/system.cpp
index 4ed51825262..1518f5bb29e 100644
--- a/src/bindings/scripts/system/system.cpp
+++ b/src/bindings/scripts/system/system.cpp
@@ -17,34 +17,27 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include "precompiled.h"
#include "system.h"
#include "ProgressBar.h"
#include "ObjectMgr.h"
#include "Database/DatabaseEnv.h"
-
DatabaseType TScriptDB;
-
SystemMgr::SystemMgr()
{
}
-
SystemMgr& SystemMgr::Instance()
{
static SystemMgr pSysMgr;
return pSysMgr;
}
-
void SystemMgr::LoadVersion()
{
//Get Version information
QueryResult* pResult = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1");
-
if (pResult)
{
Field* pFields = pResult->Fetch();
-
outstring_log("TSCR: Database version is: %s", pFields[0].GetString());
outstring_log("");
}
@@ -54,61 +47,48 @@ void SystemMgr::LoadVersion()
outstring_log("");
}
}
-
void SystemMgr::LoadScriptTexts()
{
outstring_log("TSCR: Loading Script Texts...");
LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2));
-
QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts");
-
outstring_log("TSCR: Loading Script Texts additional data...");
-
if (pResult)
{
barGoLink bar(pResult->GetRowCount());
uint32 uiCount = 0;
-
do
{
bar.step();
Field* pFields = pResult->Fetch();
StringTextData pTemp;
-
int32 iId = pFields[0].GetInt32();
pTemp.uiSoundId = pFields[1].GetUInt32();
pTemp.uiType = pFields[2].GetUInt32();
pTemp.uiLanguage = pFields[3].GetUInt32();
pTemp.uiEmote = pFields[4].GetUInt32();
-
if (iId >= 0)
{
error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
continue;
}
-
if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
{
error_db_log("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
continue;
}
-
if (pTemp.uiSoundId)
{
if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
}
-
if (!GetLanguageDescByID(pTemp.uiLanguage))
error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
-
if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
-
m_mTextDataMap[iId] = pTemp;
++uiCount;
} while (pResult->NextRow());
-
outstring_log("");
outstring_log(">> Loaded %u additional Script Texts data.", uiCount);
}
@@ -120,61 +100,48 @@ void SystemMgr::LoadScriptTexts()
outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
}
}
-
void SystemMgr::LoadScriptTextsCustom()
{
outstring_log("TSCR: Loading Custom Texts...");
LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3));
-
QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts");
-
outstring_log("TSCR: Loading Custom Texts additional data...");
-
if (pResult)
{
barGoLink bar(pResult->GetRowCount());
uint32 uiCount = 0;
-
do
{
bar.step();
Field* pFields = pResult->Fetch();
StringTextData pTemp;
-
int32 iId = pFields[0].GetInt32();
pTemp.uiSoundId = pFields[1].GetUInt32();
pTemp.uiType = pFields[2].GetUInt32();
pTemp.uiLanguage = pFields[3].GetUInt32();
pTemp.uiEmote = pFields[4].GetUInt32();
-
if (iId >= 0)
{
error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
continue;
}
-
if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
{
error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
continue;
}
-
if (pTemp.uiSoundId)
{
if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))
error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);
}
-
if (!GetLanguageDescByID(pTemp.uiLanguage))
error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);
-
if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)
error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);
-
m_mTextDataMap[iId] = pTemp;
++uiCount;
} while (pResult->NextRow());
-
outstring_log("");
outstring_log(">> Loaded %u additional Custom Texts data.", uiCount);
}
@@ -186,14 +153,11 @@ void SystemMgr::LoadScriptTextsCustom()
outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
}
}
-
void SystemMgr::LoadScriptWaypoints()
{
// Drop Existing Waypoint list
m_mPointMoveMap.clear();
-
uint64 uiCreatureCount = 0;
-
// Load Waypoints
QueryResult* pResult = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
if (pResult)
@@ -201,22 +165,17 @@ void SystemMgr::LoadScriptWaypoints()
uiCreatureCount = pResult->GetRowCount();
delete pResult;
}
-
outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount);
-
pResult = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
-
if (pResult)
{
barGoLink bar(pResult->GetRowCount());
uint32 uiNodeCount = 0;
-
do
{
bar.step();
Field* pFields = pResult->Fetch();
ScriptPointMove pTemp;
-
pTemp.uiCreatureEntry = pFields[0].GetUInt32();
uint32 uiEntry = pTemp.uiCreatureEntry;
pTemp.uiPointId = pFields[1].GetUInt32();
@@ -224,24 +183,18 @@ void SystemMgr::LoadScriptWaypoints()
pTemp.fY = pFields[3].GetFloat();
pTemp.fZ = pFields[4].GetFloat();
pTemp.uiWaitTime = pFields[5].GetUInt32();
-
CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.uiCreatureEntry);
-
if (!pCInfo)
{
error_db_log("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry);
continue;
}
-
if (!pCInfo->ScriptID)
error_db_log("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry);
-
m_mPointMoveMap[uiEntry].push_back(pTemp);
++uiNodeCount;
} while (pResult->NextRow());
-
delete pResult;
-
outstring_log("");
outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount);
}
diff --git a/src/bindings/scripts/system/system.h b/src/bindings/scripts/system/system.h
index 479f856514a..83742a3c329 100644
--- a/src/bindings/scripts/system/system.h
+++ b/src/bindings/scripts/system/system.h
@@ -1,14 +1,10 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
-
#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.
//N=Neutral, A=Alliance, H=Horde.
//NEUTRAL or FRIEND = Hostility to player surroundings (not a good definition)
@@ -18,21 +14,16 @@ enum eEscortFaction
FACTION_ESCORT_A_NEUTRAL_PASSIVE = 10,
FACTION_ESCORT_H_NEUTRAL_PASSIVE = 33,
FACTION_ESCORT_N_NEUTRAL_PASSIVE = 113,
-
FACTION_ESCORT_A_NEUTRAL_ACTIVE = 231,
FACTION_ESCORT_H_NEUTRAL_ACTIVE = 232,
FACTION_ESCORT_N_NEUTRAL_ACTIVE = 250,
-
FACTION_ESCORT_N_FRIEND_PASSIVE = 290,
FACTION_ESCORT_N_FRIEND_ACTIVE = 495,
-
FACTION_ESCORT_A_PASSIVE = 774,
FACTION_ESCORT_H_PASSIVE = 775,
-
FACTION_ESCORT_N_ACTIVE = 1986,
FACTION_ESCORT_H_ACTIVE = 2046
};
-
struct ScriptPointMove
{
uint32 uiCreatureEntry;
@@ -42,7 +33,6 @@ struct ScriptPointMove
float fZ;
uint32 uiWaitTime;
};
-
struct StringTextData
{
uint32 uiSoundId;
@@ -50,53 +40,39 @@ struct StringTextData
uint32 uiLanguage;
uint32 uiEmote;
};
-
#define pSystemMgr SystemMgr::Instance()
-
class SystemMgr
{
public:
SystemMgr();
~SystemMgr() {}
-
static SystemMgr& Instance();
-
//Maps and lists
typedef UNORDERED_MAP<int32, StringTextData> TextDataMap;
typedef UNORDERED_MAP<uint32, std::vector<ScriptPointMove> > PointMoveMap;
-
//Database
void LoadVersion();
void LoadScriptTexts();
void LoadScriptTextsCustom();
void LoadScriptWaypoints();
-
//Retrive from storage
StringTextData const* GetTextData(int32 uiTextId) const
{
TextDataMap::const_iterator itr = m_mTextDataMap.find(uiTextId);
-
if (itr == m_mTextDataMap.end())
return NULL;
-
return &itr->second;
}
-
std::vector<ScriptPointMove> const &GetPointMoveList(uint32 uiCreatureEntry) const
{
static std::vector<ScriptPointMove> vEmpty;
-
PointMoveMap::const_iterator itr = m_mPointMoveMap.find(uiCreatureEntry);
-
if (itr == m_mPointMoveMap.end())
return vEmpty;
-
return itr->second;
}
-
protected:
TextDataMap m_mTextDataMap; //additional data for text strings
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
};
-
#endif