*Fix Windows build, implement ScriptMgr config accessors, by Paradox

--HG--
branch : trunk
This commit is contained in:
maximius
2009-11-01 21:41:02 -08:00
parent c3ba7d2208
commit e2c39374dd
3 changed files with 36 additions and 3 deletions
+29
View File
@@ -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)
+5
View File
@@ -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);
@@ -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)
{