*Fix Windows build, implement ScriptMgr config accessors, by Paradox
--HG-- branch : trunk
This commit is contained in:
@@ -123,6 +123,35 @@ void ScriptsInit(char const* cfg_file = _TRINITY_SCRIPT_CONFIG)
|
|||||||
//*********************************
|
//*********************************
|
||||||
//*** Functions used globally ***
|
//*** 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)
|
void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
|
||||||
{
|
{
|
||||||
if (!pSource)
|
if (!pSource)
|
||||||
|
|||||||
@@ -86,6 +86,11 @@ struct Script
|
|||||||
void RegisterSelf();
|
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
|
//Generic scripting text function
|
||||||
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit *pTarget = NULL);
|
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit *pTarget = NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ EndContentData */
|
|||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "escort_ai.h"
|
#include "escort_ai.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "World.h"
|
|
||||||
|
|
||||||
/*########
|
/*########
|
||||||
# npc_air_force_bots
|
# npc_air_force_bots
|
||||||
@@ -1184,7 +1183,7 @@ bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature)
|
|||||||
if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer))
|
if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer))
|
||||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE1, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_UNLEARNTALENTS);
|
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);
|
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))
|
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());
|
pPlayer->SendTalentWipeConfirm(pCreature->GetGUID());
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
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)
|
if (pPlayer->GetMoney() < 10000000)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user