Merge with kaetemi-optimize

hg/feature/sound
kaetemi 11 years ago
commit 04d4aaa18c

@ -66,6 +66,11 @@ namespace NLGUI
*/
bool affect(const CInterfaceExprValue &value);
};
struct CCDBTargetInfo
{
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> Leaf;
std::string LeafName;
};
/// Updates triggered interface links when triggered by the observed branch
@ -85,7 +90,7 @@ namespace NLGUI
* If there are no target element, the link is permanent (removed at exit)
* NB : The target is not updated during this call.
*/
bool init(const std::vector<CTargetInfo> &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
bool init(const std::vector<CTargetInfo> &targets, const std::vector<CCDBTargetInfo> &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
// force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved.
static void updateAllLinks();
// force all trigered links to be updated
@ -119,6 +124,7 @@ namespace NLGUI
* \return true if all targets are valid
*/
static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect);
static bool splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect, std::vector<CInterfaceLink::CCDBTargetInfo> &cdbTargetsVect);
////////////////////////////////////////////////////////////////////////////////////////////////////////
private:
friend struct CRemoveTargetPred;
@ -135,12 +141,14 @@ namespace NLGUI
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
private:
std::vector<CTarget> _Targets;
std::vector<CCDBTargetInfo> _CDBTargets;
TNodeVect _ObservedNodes;
std::string _Expr;
CInterfaceExprNode *_ParseTree;
std::string _ActionHandler;
std::string _AHParams;
std::string _AHCond;
CInterfaceExprNode *_AHCondParsed;
CInterfaceGroup *_AHParent;
static TLinkList _LinkList;
TLinkList::iterator _ListEntry;

@ -444,7 +444,7 @@ namespace NLGUI
}
float getAlphaRolloverSpeed();
void resetAlphaRolloverSpeed();
void resetAlphaRolloverSpeedProps();
void setContainerAlpha( uint8 alpha );
uint8 getContainerAlpha() const { return _ContainerAlpha; }
@ -454,6 +454,7 @@ namespace NLGUI
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
void updateGlobalAlphas();
void resetGlobalAlphasProps();
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
void updateInterfaceTimes( const SInterfaceTimes &times ){ interfaceTimes = times; }
@ -528,6 +529,11 @@ namespace NLGUI
NLMISC::CCDBNodeLeaf *_AProp;
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB;
NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB;
NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB;
NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB;
uint8 _ContainerAlpha;
uint8 _GlobalContentAlpha;
uint8 _GlobalContainerAlpha;

@ -2325,7 +2325,8 @@ namespace NLGUI
_LUAOnDbChange[dbList]= newLink;
// Init and attach to list of untargeted links
std::vector<CInterfaceLink::CTargetInfo> noTargets;
newLink->init(noTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this);
std::vector<CInterfaceLink::CCDBTargetInfo> noCdbTargets;
newLink->init(noTargets, noCdbTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this);
}
// ------------------------------------------------------------------------------------------------

@ -165,6 +165,7 @@ namespace NLGUI
_NextTriggeredLink[0] = _NextTriggeredLink[1] = NULL;
_Triggered[0] = _Triggered[1] = false;
_ParseTree = NULL;
_AHCondParsed = NULL;
}
//===========================================================
@ -187,10 +188,13 @@ namespace NLGUI
_LinkList.erase(_ListEntry);
delete _ParseTree;
_ParseTree = NULL;
delete _AHCondParsed;
_AHCondParsed = NULL;
}
//===========================================================
bool CInterfaceLink::init(const std::vector<CTargetInfo> &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup)
bool CInterfaceLink::init(const std::vector<CTargetInfo> &targets, const std::vector<CCDBTargetInfo> &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup)
{
CInterfaceExprValue result;
// Build the parse tree
@ -236,6 +240,7 @@ namespace NLGUI
// There are no target for this link, so, put in a dedicated list to ensure that the link will be destroyed at exit
_LinksWithNoTarget.push_back(TLinkSmartPtr(this));
}
_CDBTargets = cdbTargets;
// create observers
createObservers(_ObservedNodes);
@ -243,7 +248,12 @@ namespace NLGUI
//
_ActionHandler = actionHandler;
_AHParams = ahParams;
nlassert(!_AHCondParsed);
_AHCond = ahCond;
if (!ahCond.empty())
{
_AHCondParsed = CInterfaceExpr::buildExprTree(ahCond);
}
_AHParent = parentGroup;
return true;
}
@ -356,16 +366,44 @@ namespace NLGUI
}
}
}
if (_CDBTargets.size())
{
CInterfaceExprValue resultCopy = result;
if (resultCopy.toInteger())
{
sint64 resultValue = resultCopy.getInteger();
for (uint k = 0; k < _CDBTargets.size(); ++k)
{
NLMISC::CCDBNodeLeaf *node = _CDBTargets[k].Leaf;
if (!node)
{
node = _CDBTargets[k].Leaf = NLGUI::CDBManager::getInstance()->getDbProp(_CDBTargets[k].LeafName, false);
}
if (node)
{
// assuming setvalue64 always works
node->setValue64(resultValue);
}
else
{
nlwarning("CInterfaceLink::update: Node does not exist: '%s'", _CDBTargets[k].LeafName.c_str());
}
}
}
else
{
nlwarning("CInterfaceLink::update: Result conversion to db target failed");
}
}
// if there's an action handler, execute it
if (!_ActionHandler.empty())
{
// If there is a condition, test it.
bool launch= true;
if(!_AHCond.empty())
bool launch = _AHCond.empty();
if (_AHCondParsed) // todo: maybe makes more sense to make condition also cover target
{
launch= false;
CInterfaceExprValue result;
if(CInterfaceExpr::eval(_AHCond, result))
_AHCondParsed->eval(result);
launch = result.getBool();
}
if (launch)
@ -517,6 +555,11 @@ namespace NLGUI
continue;
}
std::string::size_type lastPos = targetNames[k].find_last_not_of(" ");
if (startPos >= lastPos)
{
nlwarning("<splitLinkTargets> empty target encountered");
continue;
}
if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem))
{
@ -531,6 +574,70 @@ namespace NLGUI
}
// ***************************************************************************
bool CInterfaceLink::splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup,std::vector<CInterfaceLink::CTargetInfo> &targetsVect, std::vector<CInterfaceLink::CCDBTargetInfo> &cdbTargetsVect)
{
std::vector<std::string> targetNames;
NLMISC::splitString(targets, ",", targetNames);
targetsVect.clear();
targetsVect.reserve(targetNames.size());
cdbTargetsVect.clear(); // no reserve because less used
bool everythingOk = true;
for (uint k = 0; k < targetNames.size(); ++k)
{
std::string::size_type startPos = targetNames[k].find_first_not_of(" ");
if(startPos == std::string::npos)
{
// todo hulud interface syntax error
nlwarning("<splitLinkTargets> empty target encountered");
continue;
}
std::string::size_type lastPos = targetNames[k].find_last_not_of(" ");
if (startPos >= (lastPos+1))
{
nlwarning("<splitLinkTargets> empty target encountered");
continue;
}
if (targetNames[k][startPos] == '@')
{
CInterfaceLink::CCDBTargetInfo ti;
ti.LeafName = targetNames[k].substr((startPos+1), (lastPos+1) - (startPos+1));
// Do not allow Write on SERVER: or LOCAL:
static const std::string dbServer= "SERVER:";
static const std::string dbLocal= "LOCAL:";
static const std::string dbLocalR2= "LOCAL:R2";
if( (0==ti.LeafName.compare(0, dbServer.size(), dbServer)) ||
(0==ti.LeafName.compare(0, dbLocal.size(), dbLocal))
)
{
if (0!=ti.LeafName.compare(0, dbLocalR2.size(), dbLocalR2))
{
//nlwarning("You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database");
nlstop;
return false;
}
}
ti.Leaf = NLGUI::CDBManager::getInstance()->getDbProp(ti.LeafName, false);
cdbTargetsVect.push_back(ti);
}
else
{
CInterfaceLink::CTargetInfo ti;
if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem))
{
// todo hulud interface syntax error
nlwarning("<splitLinkTargets> Can't get link target");
everythingOk = false;
continue;
}
targetsVect.push_back(ti);
}
}
return everythingOk;
}
//===========================================================
void CInterfaceLink::checkNbRefs()
{

@ -997,6 +997,7 @@ namespace NLGUI
std::vector<CInterfaceLink::CTargetInfo> targets;
std::vector<CInterfaceLink::CCDBTargetInfo> cdbTargets;
ptr = (char*) xmlGetProp (cur, (xmlChar*)"target");
std::string target;
@ -1004,7 +1005,7 @@ namespace NLGUI
{
target = std::string( (const char*)ptr );
if( !editorMode )
CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets);
CInterfaceLink::splitLinkTargetsExt(std::string((const char*)ptr), parentGroup, targets, cdbTargets);
}
// optional action handler
@ -1022,7 +1023,7 @@ namespace NLGUI
if( !editorMode )
{
CInterfaceLink *il = new CInterfaceLink;
il->init(targets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm'
il->init(targets, cdbTargets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm'
}
else
{

@ -1035,8 +1035,8 @@ namespace NLGUI
setCapturePointerRight(NULL);
resetColorProps();
_AlphaRolloverSpeedDB = NULL;
resetAlphaRolloverSpeedProps();
resetGlobalAlphasProps();
activeAnims.clear();
}
@ -1967,10 +1967,18 @@ namespace NLGUI
}
// Update global color from database
setGlobalColor( NLMISC::CRGBA ( (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(),
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(),
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(),
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) );
if (!_RProp)
{
_RProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
_GProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G");
_BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
_AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
}
setGlobalColor(NLMISC::CRGBA(
(uint8)_RProp->getValue32(),
(uint8)_GProp->getValue32(),
(uint8)_BProp->getValue32(),
(uint8)_AProp->getValue32()));
NLMISC::CRGBA c = getGlobalColorForContent();
NLMISC::CRGBA gc = getGlobalColor();
@ -2965,7 +2973,7 @@ namespace NLGUI
return fTmp*fTmp*fTmp;
}
void CWidgetManager::resetAlphaRolloverSpeed()
void CWidgetManager::resetAlphaRolloverSpeedProps()
{
_AlphaRolloverSpeedDB = NULL;
}
@ -2981,10 +2989,29 @@ namespace NLGUI
void CWidgetManager::updateGlobalAlphas()
{
_GlobalContentAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32();
_GlobalContainerAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32();
_GlobalRolloverFactorContent = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32();
_GlobalRolloverFactorContainer = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32();
if (!_GlobalContentAlphaDB)
{
_GlobalContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA");
nlassert(_GlobalContentAlphaDB);
_GlobalContainerAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA");
nlassert(_GlobalContainerAlphaDB);
_GlobalContentRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR");
nlassert(_GlobalContentRolloverFactorDB);
_GlobalContainerRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR");
nlassert(_GlobalContainerRolloverFactorDB);
}
_GlobalContentAlpha = (uint8)_GlobalContentAlphaDB->getValue32();
_GlobalContainerAlpha = (uint8)_GlobalContainerAlphaDB->getValue32();
_GlobalRolloverFactorContent = (uint8)_GlobalContentRolloverFactorDB->getValue32();
_GlobalRolloverFactorContainer = (uint8)_GlobalContainerRolloverFactorDB->getValue32();
}
void CWidgetManager::resetGlobalAlphasProps()
{
_GlobalContentAlphaDB = NULL;
_GlobalContainerAlphaDB = NULL;
_GlobalContentRolloverFactorDB = NULL;
_GlobalContainerRolloverFactorDB = NULL;
}
void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler )
@ -3171,6 +3198,8 @@ namespace NLGUI
_LastYContextHelp= -10000;
resetColorProps();
resetAlphaRolloverSpeedProps();
resetGlobalAlphasProps();
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
_GlobalColorForContent = _GlobalColor;

@ -2882,15 +2882,12 @@ This MUST follow the Enum MISSION_DESC::TIconId
type="bool"
value="true" />
<!-- Blend between day and night (lightLevel = 0 day) (lightLevel = 1 night) -->
<link expr="depends(@UI:VARIABLES:CURRENT_TIME)"
action="set"
params="dblink=UI:SAVE:COLOR:R|value=ilinear(getLightLevel(), getRed(intToColor(@UI:SAVE:DAY_COLOR)), getRed(intToColor(@UI:SAVE:NIGHT_COLOR)))" />
<link expr="depends(@UI:VARIABLES:CURRENT_TIME)"
action="set"
params="dblink=UI:SAVE:COLOR:G|value=ilinear(getLightLevel(), getGreen(intToColor(@UI:SAVE:DAY_COLOR)), getGreen(intToColor(@UI:SAVE:NIGHT_COLOR)))" />
<link expr="depends(@UI:VARIABLES:CURRENT_TIME)"
action="set"
params="dblink=UI:SAVE:COLOR:B|value=ilinear(getLightLevel(), getBlue(intToColor(@UI:SAVE:DAY_COLOR)), getBlue(intToColor(@UI:SAVE:NIGHT_COLOR)))" />
<link expr="identity(ilinear(getLightLevel(), getRed(intToColor(@UI:SAVE:DAY_COLOR)), getRed(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
target="@UI:SAVE:COLOR:R" />
<link expr="identity(ilinear(getLightLevel(), getGreen(intToColor(@UI:SAVE:DAY_COLOR)), getGreen(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
target="@UI:SAVE:COLOR:G" />
<link expr="identity(ilinear(getLightLevel(), getBlue(intToColor(@UI:SAVE:DAY_COLOR)), getBlue(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
target="@UI:SAVE:COLOR:B" />
<!--<link expr="depends(@UI:VARIABLES:CURRENT_TIME)" action="set"
params="dblink=UI:SAVE:COLOR:A|value=ilinear(getLightLevel(), @UI:SAVE:DAY_COLOR:A, @UI:SAVE:NIGHT_COLOR:A)" />-->
<!-- The User Target Slot and UID -->

@ -425,9 +425,7 @@
<link expr="@UI:VARIABLES:OPEN_RESPAWN" target="ui:interface:respawn_map:active" />
<!-- Set the Open Flag when the delay has expired -->
<link expr="depends(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, @UI:VARIABLES:CURRENT_TIME)" action="set"
params="dblink=UI:VARIABLES:OPEN_RESPAWN|
value=and(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, le(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, @UI:VARIABLES:CURRENT_TIME) )" />
<link expr="and(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, le(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, @UI:VARIABLES:CURRENT_TIME))" target="@UI:VARIABLES:OPEN_RESPAWN" />
<!--
Verify player mode. because at init, mode == 0, => the window won't be opened by default

@ -62,18 +62,11 @@ end
------------------------------------------------------------------------------------------------------------
function game:outpostUpdateTimeZone()
-- update time zone auto?
local tzAuto= getDbProp('UI:SAVE:OUTPOST:TIME_ZONE_AUTO');
if(tzAuto==0) then
return;
end
-- every 5 seconds?
local curTick = getDbProp('UI:VARIABLES:CURRENT_SERVER_TICK');
if(curTick - game.Outpost.LastTimeZoneUpdate > 50) then
setDbProp('UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE', curTick + 50);
game.Outpost.LastTimeZoneUpdate = curTick;
runAH(nil,'outpost_update_time_zone_auto','');
end
end
------------------------------------------------------------------------------------------------------------
function game:outpostIsStatusWar(status)

@ -21,8 +21,9 @@
<!-- Save the Time Zone config -->
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE" type="sint32" value="0" />
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE_AUTO" type="sint32" value="1" />
<variable entry="UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE" type="sint32" value="0" />
<!-- just a script called at init and every 5 seconds, to setup TIME_ZONE, if time_zone is auto-->
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" action="lua:game:outpostUpdateTimeZone()" />
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" cond="and(eq(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, 1), ge(@UI:VARIABLES:CURRENT_SERVER_TICK, @UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE))" action="lua:game:outpostUpdateTimeZone()" />
<!-- Temp Variables -->

@ -318,7 +318,11 @@ void CCDBSynchronised::writeInitInProgressIntoUIDB()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM)
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CDB_INIT_IN_PROGRESS")->setValueBool(_InitInProgress);
{
NLMISC::CCDBNodeLeaf *node = m_CDBInitInProgressDB ? (&*m_CDBInitInProgressDB)
: (m_CDBInitInProgressDB = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CDB_INIT_IN_PROGRESS"));
node->setValueBool(_InitInProgress);
}
else
nlwarning("InterfaceManager not created");
}

@ -151,6 +151,8 @@ private:
bool allInitPacketReceived() const { return _InitDeltaReceived == 2; } // Classic database + inventory
void writeInitInProgressIntoUIDB();
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_CDBInitInProgressDB;
};

@ -58,6 +58,7 @@ uint32 MissionRingId = 0;
UInstance selectedInstance;
const UInstance noSelectedInstance;
string selectedInstanceURL;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> s_UserCharFade;
///////////////
@ -273,7 +274,8 @@ void checkUnderCursor()
entity= EntitiesMngr.getEntityUnderPos(cursX, cursY, ClientCfg.SelectionDist, isPlayerUnderCursor);
// If the mouse is over the player make the player transparent
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false);
CCDBNodeLeaf *pNL = s_UserCharFade ? &*s_UserCharFade
: (s_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false));
if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
{
// If the nearest entity is the player, hide!

@ -435,28 +435,47 @@ void CEntityManager::initialize(uint nbMaxEntity)
for (i=0; i<MAX_NUM_MISSIONS; i++)
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
{
textId = ICDBNode::CTextId( "SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE" );
std::string text = toString("SERVER:MISSIONS:%d:TARGET%d:TITLE", i, j);
textId = ICDBNode::CTextId(text);
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&MissionTargetObserver, textId );
_MissionTargetTitleDB[i][j] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_MissionTargetTitleDB[i][j]);
}
// Add an Observer to the Team database
for (i=0; i<MaxNumPeopleInTeam; i++)
{
textId = ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:UID", i) );
std::string text = toString(TEAM_DB_PATH ":%d:UID", i);
textId = ICDBNode::CTextId(text);
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamUIDObserver, textId );
_GroupMemberUidDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_GroupMemberUidDB[i]);
textId = ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:NAME", i) );
text = toString(TEAM_DB_PATH ":%d:NAME", i);
textId = ICDBNode::CTextId(text);
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamPresentObserver, textId );
_GroupMemberNameDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_GroupMemberNameDB[i]);
}
// Add an Observer to the Animal database
for (i=0; i<MAX_INVENTORY_ANIMAL; i++)
{
textId = ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:UID",i) );
std::string text = toString("SERVER:PACK_ANIMAL:BEAST%d:UID", i);
textId = ICDBNode::CTextId(text);
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalUIDObserver, textId);
_BeastUidDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_BeastUidDB[i]);
textId = ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS",i) );
text = toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", i);
textId = ICDBNode::CTextId(text);
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalStatusObserver, textId);
_BeastStatusDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_BeastStatusDB[i]);
text = toString("SERVER:PACK_ANIMAL:BEAST%d:TYPE", i);
_BeastTypeDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false);
nlassert(_BeastTypeDB[i]);
}
}// initialize //

@ -29,6 +29,10 @@
#include "ground_fx_manager.h"
#include "projectile_manager.h"
#include "user_entity.h"
// Some constants
#include "game_share/mission_desc.h"
#include "interface_v3/people_interraction.h"
#include "game_share/inventories.h"
// Misc.
#include "nel/misc/types_nl.h"
#include "nel/misc/stream.h"
@ -149,6 +153,14 @@ private:
NL3D::UInstance _LastInstanceUnderPos;
// DB node pointers used to update some entity flags
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _MissionTargetTitleDB[MAX_NUM_MISSIONS][MAX_NUM_MISSION_TARGETS];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GroupMemberUidDB[MaxNumPeopleInTeam];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GroupMemberNameDB[MaxNumPeopleInTeam];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _BeastUidDB[MAX_INVENTORY_ANIMAL];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _BeastStatusDB[MAX_INVENTORY_ANIMAL];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _BeastTypeDB[MAX_INVENTORY_ANIMAL];
//////////////
//// DEBUG ///
uint _NbUser;
@ -344,6 +356,13 @@ public:
*/
void refreshInsceneInterfaceOfFriendNPC(uint slot);
inline NLMISC::CCDBNodeLeaf *getMissionTargetTitleDB(int mission, int target) { return _MissionTargetTitleDB[mission][target]; }
inline NLMISC::CCDBNodeLeaf *getGroupMemberUidDB(int member) { return _GroupMemberUidDB[member]; }
inline NLMISC::CCDBNodeLeaf *getGroupMemberNameDB(int member) { return _GroupMemberNameDB[member]; }
inline NLMISC::CCDBNodeLeaf *getBeastUidDB(int beast) { return _BeastUidDB[beast]; }
inline NLMISC::CCDBNodeLeaf *getBeastStatusDB(int beast) { return _BeastStatusDB[beast]; }
inline NLMISC::CCDBNodeLeaf *getBeastTypeDB(int beast) { return _BeastTypeDB[beast]; }
private:
// NB: don't return unselectable entities

@ -120,6 +120,7 @@ NLMISC::CRGBA CEntityCL::_PvpAllyColor;
NLMISC::CRGBA CEntityCL::_GMTitleColor[CHARACTER_TITLE::EndGmTitle - CHARACTER_TITLE::BeginGmTitle + 1];
uint8 CEntityCL::_InvalidGMTitleCode = 0xFF;
NLMISC::CRefPtr<CCDBNodeLeaf> CEntityCL::_OpacityMinNodeLeaf;
NLMISC::CRefPtr<CCDBNodeLeaf> CEntityCL::_ShowReticleLeaf;
// Context help
@ -2646,7 +2647,7 @@ void CEntityCL::updateMissionTarget()
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
{
// Get the db prop
CCDBNodeLeaf *prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE", false);
CCDBNodeLeaf *prop = EntitiesMngr.getMissionTargetTitleDB(i, j); // NLGUI::CDBManager::getInstance()->getDbProp("SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE", false);
if (prop)
{
_MissionTarget = _NameId == (uint32)prop->getValue32();
@ -2846,8 +2847,8 @@ void CEntityCL::updateIsInTeam ()
for (uint i=0; i<MaxNumPeopleInTeam; i++)
{
// Get the db prop
CCDBNodeLeaf *uidProp = NLGUI::CDBManager::getInstance()->getDbProp(toString(TEAM_DB_PATH ":%d:UID", i), false);
CCDBNodeLeaf *presentProp = NLGUI::CDBManager::getInstance()->getDbProp(toString(TEAM_DB_PATH ":%d:NAME", i), false);
CCDBNodeLeaf *uidProp = EntitiesMngr.getGroupMemberUidDB(i);
CCDBNodeLeaf *presentProp = EntitiesMngr.getGroupMemberNameDB(i);
// If same Entity uid than the one in the Database, ok the entity is in the Player TEAM!!
if (uidProp && uidProp->getValue32() == (sint32)dataSetId() &&
presentProp && presentProp->getValueBool() )
@ -2876,9 +2877,9 @@ void CEntityCL::updateIsUserAnimal ()
for (uint i=0; i<MAX_INVENTORY_ANIMAL; i++)
{
// Get the db prop
CCDBNodeLeaf *uidProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:UID", i), false);
CCDBNodeLeaf *statusProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", i), false);
CCDBNodeLeaf *typeProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:TYPE", i), false);
CCDBNodeLeaf *uidProp = EntitiesMngr.getBeastUidDB(i);
CCDBNodeLeaf *statusProp = EntitiesMngr.getBeastStatusDB(i);
CCDBNodeLeaf *typeProp = EntitiesMngr.getBeastTypeDB(i);
// I must have the same Id, and the animal entry must be ok.
if(uidProp && statusProp && typeProp && uidProp->getValue32() == (sint32)dataSetId() &&
ANIMAL_STATUS::isSpawned((ANIMAL_STATUS::EAnimalStatus)(statusProp->getValue32()) ))
@ -3041,7 +3042,9 @@ void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */,
bool bShowReticle = true;
CCDBNodeLeaf* node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_RETICLE");
CCDBNodeLeaf *node = (CCDBNodeLeaf *)_ShowReticleLeaf ? &*_ShowReticleLeaf
: (_ShowReticleLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_RETICLE", false));
if (node)
{
bShowReticle = node->getValueBool();

@ -1112,6 +1112,7 @@ protected:
sint64 _LastLocalSelectBoxComputeTime;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _OpacityMinNodeLeaf;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _ShowReticleLeaf;
protected:
/**

@ -425,14 +425,15 @@ class CActionHandlerAddLink : public IActionHandler
}
std::vector<CInterfaceLink::CTargetInfo> targetsVect;
bool result = CInterfaceLink::splitLinkTargets(targets, parentGroup, targetsVect);
std::vector<CInterfaceLink::CCDBTargetInfo> cdbTargetsVect;
bool result = CInterfaceLink::splitLinkTargetsExt(targets, parentGroup, targetsVect, cdbTargetsVect);
if (!result)
{
nlwarning("<CActionHandlerAddLink> Couldn't parse all links");
}
// add the link
CInterfaceLink *il = new CInterfaceLink;
il->init(targetsVect, expr, ah, ahparam, ahcond, parentGroup);
il->init(targetsVect, cdbTargetsVect, expr, ah, ahparam, ahcond, parentGroup);
CInterfaceManager *im = CInterfaceManager::getInstance();
CWidgetManager::getInstance()->getParser()->addLink(il, id);
il->update();

@ -41,16 +41,77 @@ uint CGroupInSceneUserInfo::_BatLength = 0;
CCDBNodeLeaf *CGroupInSceneUserInfo::_Value = NULL;
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueBegin = NULL;
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueEnd = NULL;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> CGroupInSceneUserInfo::_GuildIconLeaf[256];
// ***************************************************************************
NLMISC_REGISTER_OBJECT(CViewBase, CGroupInSceneUserInfo, std::string, "in_scene_user_info");
REGISTER_UI_CLASS(CGroupInSceneUserInfo)
namespace {
// Has more entries than actually in config, as not all types have all entries.
class CConfigSaveInsceneDB
{
public:
void setPrefix(const std::string &prefix) { _DBPrefix = prefix; }
inline NLMISC::CCDBNodeLeaf *getGuildSymbol() { return _GuildSymbol ? (&*_GuildSymbol) : (_GuildSymbol = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "GUILD_SYMBOL")); }
inline NLMISC::CCDBNodeLeaf *getName() { return _Name ? (&*_Name) : (_Name = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NAME")); }
inline NLMISC::CCDBNodeLeaf *getTitle() { return _Title ? (&*_Title) : (_Title = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "TITLE")); }
inline NLMISC::CCDBNodeLeaf *getRPTags() { return _RPTags ? (&*_RPTags) : (_RPTags = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "RPTAGS")); }
inline NLMISC::CCDBNodeLeaf *getGuildName() { return _GuildName ? (&*_GuildName) : (_GuildName = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "GUILD_NAME")); }
inline NLMISC::CCDBNodeLeaf *getHP() { return _HP ? (&*_HP) : (_HP = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "HP")); }
inline NLMISC::CCDBNodeLeaf *getSta() { return _Sta ? (&*_Sta) : (_Sta = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "STA")); }
inline NLMISC::CCDBNodeLeaf *getSap() { return _Sap ? (&*_Sap) : (_Sap = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "SAP")); }
inline NLMISC::CCDBNodeLeaf *getFocus() { return _Focus ? (&*_Focus) : (_Focus = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "FOCUS")); }
inline NLMISC::CCDBNodeLeaf *getAction() { return _Action ? (&*_Action) : (_Action = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "ACTION")); }
inline NLMISC::CCDBNodeLeaf *getMessages() { return _Messages ? (&*_Messages) : (_Messages = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MESSAGES")); }
inline NLMISC::CCDBNodeLeaf *getPvPLogo() { return _PvPLogo ? (&*_PvPLogo) : (_PvPLogo = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "PVP_LOGO")); }
inline NLMISC::CCDBNodeLeaf *getNPCName() { return _NPCName ? (&*_NPCName) : (_NPCName = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NPCNAME")); }
inline NLMISC::CCDBNodeLeaf *getNPCTitle() { return _NPCTitle ? (&*_NPCTitle) : (_NPCTitle = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NPCTITLE")); }
inline NLMISC::CCDBNodeLeaf *getMissionIcon() { return _MissionIcon ? (&*_MissionIcon) : (_MissionIcon = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MISSION_ICON")); }
inline NLMISC::CCDBNodeLeaf *getMiniMissionIcon() { return _MiniMissionIcon ? (&*_MiniMissionIcon) : (_MiniMissionIcon = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MINI_MISSION_ICON")); }
private:
std::string _DBPrefix;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildSymbol;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Name;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Title;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _RPTags;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildName;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _HP;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Sta;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Sap;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Focus;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Action;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _Messages;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _PvPLogo;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _NPCName;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _NPCTitle;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _MissionIcon;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _MiniMissionIcon;
};
CConfigSaveInsceneDB _ConfigSaveInsceneDB[4]; // USER/FRIEND/ENEMY/SOURCE
bool _ConfigSaveInsceneDBInit = false;
#define SAVE_USER 0
#define SAVE_FRIEND 1
#define SAVE_ENEMY 2
#define SAVE_SOURCE 3
}
CGroupInSceneUserInfo::CGroupInSceneUserInfo(const TCtorParam &param)
: CGroupInScene(param)
{
if (!_ConfigSaveInsceneDBInit)
{
_ConfigSaveInsceneDB[0].setPrefix("UI:SAVE:INSCENE:USER:");
_ConfigSaveInsceneDB[1].setPrefix("UI:SAVE:INSCENE:FRIEND:");
_ConfigSaveInsceneDB[2].setPrefix("UI:SAVE:INSCENE:ENEMY:");
_ConfigSaveInsceneDB[3].setPrefix("UI:SAVE:INSCENE:SOURCE:");
_ConfigSaveInsceneDBInit = true;
}
_Name = NULL;
_Title = NULL;
_GuildName = NULL;
@ -130,7 +191,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
bool needPvPLogo= false;
bool permanentContent = false;
bool rpTags = false;
bool displayMissionIcons = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:INSCENE:FRIEND:MISSION_ICON")->getValueBool();
bool displayMissionIcons = _ConfigSaveInsceneDB[SAVE_FRIEND].getMissionIcon()->getValueBool();
// Names
const char *templateName;
@ -156,7 +217,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
// Active fields and bars
if ( isForageSource )
{
string dbEntry = "UI:SAVE:INSCENE:SOURCE:";
CForageSourceCL *forageSource = static_cast<CForageSourceCL*>(entity);
name = !entityName.empty() /*&& NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool()*/;
@ -175,32 +235,32 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
}
else if(npcFriendAndNeutral)
{
string dbEntry;
int dbEntry;
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
// For RoleMasters, merchants etc... must display name and function, and nothing else
for(uint i=0;i<NumBars;i++)
bars[i]= false;
name= !entityName.empty() && CDBManager::getInstance()->getDbProp(dbEntry+"NPCNAME")->getValueBool();
name= !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCName()->getValueBool();
symbol= false;
title= !entityTitle.empty() && CDBManager::getInstance()->getDbProp(dbEntry+"NPCTITLE")->getValueBool();
title= !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCTitle()->getValueBool();
guildName= false;
templateName = "in_scene_user_info";
rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"RPTAGS")->getValueBool();
rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && _ConfigSaveInsceneDB[dbEntry].getRPTags()->getValueBool();
}
else
{
// Base entry in database
string dbEntry;
int dbEntry;
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
name = !entityName.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool();
title = !entityTitle.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"TITLE")->getValueBool();
rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"RPTAGS")->getValueBool();
name = !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getName()->getValueBool();
title = !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getTitle()->getValueBool();
rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && _ConfigSaveInsceneDB[dbEntry].getRPTags()->getValueBool();
// if name is empty but not title, title is displayed as name
if (!title && entityName.empty() && !entityTitle.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool())
if (!title && entityName.empty() && !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getName()->getValueBool())
title = true;
templateName = "in_scene_user_info";
// special guild
if(NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"GUILD_SYMBOL")->getValueBool())
if(_ConfigSaveInsceneDB[dbEntry].getGuildSymbol()->getValueBool())
{
// if symbol not still available, wait for one when VP received
symbol = (entity->getGuildSymbol() != 0);
@ -211,7 +271,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
symbol= false;
needGuildSymbolId = false;
}
if(NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"GUILD_NAME")->getValueBool())
if(_ConfigSaveInsceneDB[dbEntry].getGuildName()->getValueBool())
{
// if guild name not still available, wait for one when VP received
guildName = (entity->getGuildNameID() != 0);
@ -222,7 +282,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
guildName= false;
needGuildNameId= false;
}
needPvPLogo = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"PVP_LOGO")->getValueBool();
needPvPLogo = _ConfigSaveInsceneDB[dbEntry].getPvPLogo()->getValueBool();
eventFaction = (entity->getEventFactionID() != 0);
}
@ -799,9 +859,9 @@ REGISTER_ACTION_HANDLER( CHandlerResetCharacterInScene, "reset_character_in_scen
// ***************************************************************************
void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars )
void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars )
{
dbEntry = isUser?"UI:SAVE:INSCENE:USER:":isFriend?"UI:SAVE:INSCENE:FRIEND:":"UI:SAVE:INSCENE:ENEMY:";
dbEntry = isUser?SAVE_USER:isFriend?SAVE_FRIEND:SAVE_ENEMY;
// if currently is edition mode, then bars are not displayed
if (ClientCfg.R2EDEnabled && R2::isEditionCurrent())
{
@ -813,11 +873,11 @@ void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser,
}
else
{
bars[HP] = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"HP")->getValueBool();
bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"SAP")->getValueBool();
bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"STA")->getValueBool();
bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"FOCUS")->getValueBool();
bars[Action] = (isUser) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"ACTION")->getValueBool();
bars[HP] = _ConfigSaveInsceneDB[dbEntry].getHP()->getValueBool();
bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSap()->getValueBool();
bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSta()->getValueBool();
bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getFocus()->getValueBool();
bars[Action] = (isUser) && _ConfigSaveInsceneDB[dbEntry].getAction()->getValueBool();
}
}
@ -831,7 +891,7 @@ void CGroupInSceneUserInfo::setLeftGroupActive( bool active )
if ( _Entity->isUser() || _Entity->isForageSource() )
return;
string dbEntry;
int dbEntry;
bool barSettings [NumBars];
getBarSettings( CInterfaceManager::getInstance(), _Entity->isUser(), _Entity->isPlayer(), _Entity->isViewedAsFriend(), dbEntry, barSettings );
@ -943,8 +1003,13 @@ void CGroupInSceneUserInfo::updateDynamicData ()
if (_Entity->getGuildSymbol() != 0)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (!_GuildIconLeaf[_Entity->slot()])
{
string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON";
NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf)->setValue64(_Entity->getGuildSymbol());
_GuildIconLeaf[_Entity->slot()] = NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf);
}
nlassert(&*_GuildIconLeaf[_Entity->slot()]);
(&*_GuildIconLeaf[_Entity->slot()])->setValue64(_Entity->getGuildSymbol());
}
// Set the event faction

@ -72,7 +72,7 @@ protected:
};
/// Fill NumBars elements into bars and set dbEntry
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars );
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
// The entity (character or forage source)
CEntityCL *_Entity;
@ -97,6 +97,9 @@ protected:
static NLMISC::CCDBNodeLeaf *_ValueBegin;
static NLMISC::CCDBNodeLeaf *_ValueEnd;
// Guild icon leafs
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
// Special guild
bool _NeedGuildNameId;
bool _NeedGuildSymbolId;

@ -511,6 +511,8 @@ CInterfaceManager::CInterfaceManager()
_LogState = false;
_KeysLoaded = false;
CWidgetManager::getInstance()->resetColorProps();
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
CWidgetManager::getInstance()->resetGlobalAlphasProps();
_NeutralColor = NULL;
_WarningColor = NULL;
_ErrorColor = NULL;
@ -1420,8 +1422,9 @@ void CInterfaceManager::uninitInGame1 ()
_NeutralColor = NULL;
_WarningColor = NULL;
_ErrorColor = NULL;
CWidgetManager::getInstance()->resetAlphaRolloverSpeed();
CWidgetManager::getInstance()->resetColorProps();
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
CWidgetManager::getInstance()->resetGlobalAlphasProps();
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
@ -1978,7 +1981,11 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
// Update Player characteristics (for Item carac requirement Redifying)
nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8);
for (uint i=0; i<CHARACTERISTICS::NUM_CHARACTERISTICS; ++i)
_CurrentPlayerCharac[i]= NLGUI::CDBManager::getInstance()->getDbValue32(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i));
{
NLMISC::CCDBNodeLeaf *node = _CurrentPlayerCharacLeaf[i] ? &*_CurrentPlayerCharacLeaf[i]
: (_CurrentPlayerCharacLeaf[i] = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false));
_CurrentPlayerCharac[i] = node ? node->getValue32() : 0;
}
CWidgetManager::getInstance()->drawViews( camera );

@ -634,6 +634,7 @@ private:
// Item Carac requirement
sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS];
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _CurrentPlayerCharacLeaf[CHARACTERISTICS::NUM_CHARACTERISTICS];
// observers for copying database branch changes
CServerToLocalAutoCopy ServerToLocalAutoCopyInventory;

@ -558,7 +558,8 @@ void CPeopleInterraction::createTeamList()
{
CInterfaceLink *il = new CInterfaceLink;
vector<CInterfaceLink::CTargetInfo> targets;
il->init(targets, sExpr, sAction, sParams, sCond, TeamChat->getContainer());
vector<CInterfaceLink::CCDBTargetInfo> cdbTargets;
il->init(targets, cdbTargets, sExpr, sAction, sParams, sCond, TeamChat->getContainer());
}
}

@ -941,6 +941,8 @@ void CSPhraseManager::reset()
CSkillManager *pSM= CSkillManager::getInstance();
pBM->removeBrickLearnedCallback(&_ProgressionUpdate);
pSM->removeSkillChangeCallback(&_ProgressionUpdate);
_TotalMalusEquipLeaf = NULL;
}
// ***************************************************************************
@ -1122,7 +1124,9 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
// **** Compute Phrase Elements from phrase
// get the current action malus (0-100)
uint32 totalActionMalus= 0;
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
CCDBNodeLeaf *actMalus = (CCDBNodeLeaf *)_TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
: (_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false));
// root brick must not be Power or aura, because Action malus don't apply to them
// (ie leave 0 ActionMalus for Aura or Powers
if(actMalus && !rootBrick->isSpecialPower())
@ -1652,7 +1656,8 @@ float CSPhraseManager::getPhraseSumBrickProp(const CSPhraseCom &phrase, uint
else if(propId==CSBrickManager::getInstance()->StaPropId && brick->Properties[j].PropId==CSBrickManager::getInstance()->StaWeightFactorId)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
uint32 weight = (uint32) NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEFAULT_WEIGHT_HANDS")->getValue32() / 10; // weight must be in dg here
if (!_ServerUserDefaultWeightHandsLeaf) _ServerUserDefaultWeightHandsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEFAULT_WEIGHT_HANDS");
uint32 weight = (uint32)(&*_ServerUserDefaultWeightHandsLeaf)->getValue32() / 10; // weight must be in dg here
CDBCtrlSheet *ctrlSheet = dynamic_cast<CDBCtrlSheet *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:gestionsets:hands:handr"));
if (ctrlSheet)
{
@ -4501,7 +4506,8 @@ uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CSBrickManager *pBM= CSBrickManager::getInstance();
uint32 totalActionMalus= 0;
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
CCDBNodeLeaf *actMalus = (CCDBNodeLeaf *)_TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf
: (_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false));
// root brick must not be Power or aura, because Action malus don't apply to them
// (ie leave 0 ActionMalus for Aura or Powers
if (!phrase.Bricks.empty())

@ -651,6 +651,10 @@ private:
void computePhraseProgression();
void insertProgressionSkillRecurs(SKILLS::ESkills skill, uint32 value, sint *skillReqLevel, std::vector<SKILLS::ESkills> &skillsToInsert);
mutable NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _TotalMalusEquipLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _ServerUserDefaultWeightHandsLeaf;
// @}
/// return the skill of the root

@ -382,6 +382,9 @@ CGameContextMenu GameContextMenu;
NLMISC::CValueSmoother smoothFPS;
NLMISC::CValueSmoother moreSmoothFPS(64);
static CRefPtr<CCDBNodeLeaf> s_FpsLeaf;
static CRefPtr<CCDBNodeLeaf> s_UiDirectionLeaf;
// Profile
/*
@ -2296,7 +2299,8 @@ bool mainLoop()
deltaTime = smoothFPS.getSmoothValue ();
if (deltaTime > 0.0)
{
CCDBNodeLeaf*pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS");
CCDBNodeLeaf *pNL = (CCDBNodeLeaf *)s_FpsLeaf ? &*s_FpsLeaf
: (s_FpsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS"));
pNL->setValue64((sint64)(1.f/deltaTime));
}
}
@ -2801,8 +2805,10 @@ bool mainLoop()
H_AUTO_USE ( RZ_Client_Main_Loop_Net )
// Put here things you have to send to the server only once per tick like user position.
// UPDATE COMPASS
NLMISC::CCDBNodeLeaf *node = s_UiDirectionLeaf ? (&*s_UiDirectionLeaf)
: (s_UiDirectionLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DIRECTION"));
CInterfaceProperty prop;
prop.readDouble("UI:VARIABLES:DIRECTION"," ");
prop.setNodePtr(node);
if(CompassMode == 1)
{
double camDir = atan2(View.view().y, View.view().x);

@ -294,7 +294,9 @@ void CUserControls::update()
// update camera collision once per frame
View.updateCameraCollision();
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:MK_MOVE")->setValue32(autowalkState());
NLMISC::CCDBNodeLeaf *node = _UiVarMkMoveDB ? &*_UiVarMkMoveDB
: (_UiVarMkMoveDB = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:MK_MOVE"));
node->setValue32(autowalkState());
}// update //

@ -31,6 +31,9 @@
// Std.
#include <string>
namespace NLMISC {
class CCDBNodeLeaf;
}
///////////
// CLASS //
@ -305,6 +308,8 @@ private:
/// when true the next forward action will cancel any moveto
bool _NextForwardCancelMoveTo;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _UiVarMkMoveDB;
};
/// User Controls (mouse, keyboard, interfaces, ...)

@ -3861,22 +3861,28 @@ bool CNetManager::update()
CInterfaceManager *im = CInterfaceManager::getInstance();
if (im)
{
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false);
CCDBNodeLeaf *node = m_PingLeaf ? &*m_PingLeaf
: (m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false));
if (node)
node->setValue32(getPing());
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false);
node = m_UploadLeaf ? &*m_UploadLeaf
: (m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false));
if (node)
node->setValue32((sint32)(getMeanUpload()*1024.f/8.f));
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false);
node = m_DownloadLeaf ? &*m_DownloadLeaf
: (m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false));
if (node)
node->setValue32((sint32)(getMeanDownload()*1024.f/8.f));
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false);
node = m_PacketLostLeaf ? &* m_PacketLostLeaf
: (m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false));
if (node)
node->setValue32((sint32)getMeanPacketLoss());
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false);
node = m_ServerStateLeaf ? &*m_ServerStateLeaf
: (m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false));
if (node)
node->setValue32((sint32)getConnectionState());
node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false);
node = m_ConnectionQualityLeaf ? &*m_ConnectionQualityLeaf
: (m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false));
if (node)
node->setValue32((sint32)getConnectionQuality());
}

@ -43,6 +43,7 @@ void initializeNetwork();
namespace NLMISC
{
class CBitMemStream;
class CCDBNodeLeaf;
};
@ -126,6 +127,13 @@ public:
protected:
bool _IsReplayStarting;
#endif
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_PingLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_UploadLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_DownloadLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_PacketLostLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_ServerStateLeaf;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_ConnectionQualityLeaf;
};

@ -55,6 +55,7 @@ const uint32 DEFAULT_ENTITY_MIN_OPACITY = 128;
bool CTool::_MouseCaptured = false;
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> CTool::_UserCharFade;
static const CVector cardinals[] =
{
@ -551,7 +552,8 @@ void CTool::handleMouseOverPlayer(bool over)
{
//H_AUTO(R2_CTool_handleMouseOverPlayer)
// If the mouse is over the player make the player transparent
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false);
CCDBNodeLeaf *pNL = _UserCharFade ? &*_UserCharFade
: (_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false));
if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
{
// If the nearest entity is the player, hide!

@ -284,6 +284,7 @@ private:
sint64 _AutoPanDelay;
sint64 _NumPans;
static bool _MouseCaptured;
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _UserCharFade;
private:
/** compute the nearest valid surface at a given position from the island heightmap
* (heightmap must not be empty or an assertion is raised)

@ -194,10 +194,13 @@ bool ServerDrivenWeather = false;
const float WEATHER_BLEND_SPEED = 1.f / 8.f; // number of seconds to blend betwen weather states
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> s_ServerWeatherValueDB;
// ***************************************************************************
static uint16 getServerWeather()
{
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE");
CCDBNodeLeaf *node = s_ServerWeatherValueDB ? &*s_ServerWeatherValueDB
: (s_ServerWeatherValueDB = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE"));
if (!node) return 0;
return (uint16) node->getValue16();
}

Loading…
Cancel
Save