diff options
author | maximius <none@none> | 2009-11-01 21:41:02 -0800 |
---|---|---|
committer | maximius <none@none> | 2009-11-01 21:41:02 -0800 |
commit | e2c39374dd22d4d90b3b32095756f84f187e0f98 (patch) | |
tree | 0788e394f222a8495c95516212091f1566026451 | |
parent | c3ba7d220824c8b1cd157fe85edae7f47d94f0d9 (diff) |
*Fix Windows build, implement ScriptMgr config accessors, by Paradox
--HG--
branch : trunk
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 29 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.h | 5 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/world/npcs_special.cpp | 5 |
3 files changed, 36 insertions, 3 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 5e7639656b3..96c8876f0fa 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -123,6 +123,35 @@ void ScriptsInit(char const* cfg_file = _TRINITY_SCRIPT_CONFIG) //********************************* //*** Functions used globally *** +std::string 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 GetConfigValueInt32(char const* option) +{ + //Get db int from file + int32 dbint = TScriptConfig.GetIntDefault(option, 0); + + return dbint; +} + +float 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/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h index 9b6202a01a0..e09a031efce 100644 --- a/src/bindings/scripts/ScriptMgr.h +++ b/src/bindings/scripts/ScriptMgr.h @@ -86,6 +86,11 @@ struct Script void RegisterSelf(); }; +//Config file accessors +std::string GetConfigValueStr(char const* option); +int32 GetConfigValueInt32(char const* option); +float GetConfigValueFloat(char const* option); + //Generic scripting text function void DoScriptText(int32 textEntry, WorldObject* pSource, Unit *pTarget = NULL); diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index 00cde589fd7..e93a788c9d4 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -40,7 +40,6 @@ EndContentData */ #include "precompiled.h" #include "escort_ai.h" #include "ObjectMgr.h" -#include "World.h" /*######## # npc_air_force_bots @@ -1184,7 +1183,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() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) + if (!(pPlayer->GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < GetConfigValueInt32("MinDualSpecLevel")))) 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)) @@ -1213,7 +1212,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() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) + if(pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < GetConfigValueInt32("MinDualSpecLevel"))) { if (pPlayer->GetMoney() < 10000000) { |