Merge with quitta-gsoc-2013
--HG-- branch : rc-botanic-webdev
This commit is contained in:
commit
a0e1d3cddf
181 changed files with 10578 additions and 3938 deletions
3
.hgeol
3
.hgeol
|
@ -2,6 +2,9 @@
|
||||||
**.h = native
|
**.h = native
|
||||||
**.cpp = native
|
**.cpp = native
|
||||||
|
|
||||||
|
**/database.xml = BIN
|
||||||
|
**/msg.xml = BIN
|
||||||
|
|
||||||
**.txt = native
|
**.txt = native
|
||||||
**.xml = native
|
**.xml = native
|
||||||
|
|
||||||
|
|
|
@ -111,9 +111,11 @@ FIND_PACKAGE(LibXml2 REQUIRED)
|
||||||
FIND_PACKAGE(PNG REQUIRED)
|
FIND_PACKAGE(PNG REQUIRED)
|
||||||
FIND_PACKAGE(Jpeg)
|
FIND_PACKAGE(Jpeg)
|
||||||
|
|
||||||
|
IF(WITH_STATIC_LIBXML2)
|
||||||
|
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
||||||
|
ENDIF(WITH_STATIC_LIBXML2)
|
||||||
IF(WITH_STATIC)
|
IF(WITH_STATIC)
|
||||||
# libxml2 could need winsock2 library
|
# libxml2 could need winsock2 library
|
||||||
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
|
||||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
||||||
|
|
||||||
# on Mac OS X libxml2 requires iconv and liblzma
|
# on Mac OS X libxml2 requires iconv and liblzma
|
||||||
|
|
|
@ -34,8 +34,8 @@ ENDIF(MSVC)
|
||||||
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
SET(PCH_FLAGS)
|
SET(PCH_FLAGS)
|
||||||
SET(PCH_ARCHS)
|
SET(PCH_ARCHS)
|
||||||
|
SET(_FLAGS)
|
||||||
|
|
||||||
SET(FLAGS)
|
|
||||||
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
|
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
|
||||||
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
|
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
|
||||||
|
@ -81,10 +81,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||||
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
||||||
|
|
||||||
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
|
||||||
|
|
||||||
# Format definitions
|
# Format definitions
|
||||||
|
IF(MSVC)
|
||||||
|
# Fix path with space
|
||||||
|
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
|
||||||
|
ELSE(MSVC)
|
||||||
|
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
||||||
SEPARATE_ARGUMENTS(_FLAGS)
|
SEPARATE_ARGUMENTS(_FLAGS)
|
||||||
|
ENDIF(MSVC)
|
||||||
|
|
||||||
|
|
||||||
IF(CLANG)
|
IF(CLANG)
|
||||||
# Determining all architectures and get common flags
|
# Determining all architectures and get common flags
|
||||||
|
|
|
@ -123,7 +123,7 @@ MACRO(NL_DEFAULT_PROPS name label)
|
||||||
VERSION ${NL_VERSION}
|
VERSION ${NL_VERSION}
|
||||||
SOVERSION ${NL_VERSION_MAJOR}
|
SOVERSION ${NL_VERSION_MAJOR}
|
||||||
COMPILE_FLAGS "/GA"
|
COMPILE_FLAGS "/GA"
|
||||||
LINK_FLAGS "/VERSION:${NL_VERSION}")
|
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
|
||||||
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
|
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
|
||||||
|
|
||||||
IF(WITH_STLPORT AND WIN32)
|
IF(WITH_STLPORT AND WIN32)
|
||||||
|
@ -247,6 +247,11 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
OPTION(WITH_STATIC "With static libraries." OFF)
|
OPTION(WITH_STATIC "With static libraries." OFF)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
IF (WITH_STATIC)
|
||||||
|
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON )
|
||||||
|
ELSE(WITH_STATIC)
|
||||||
|
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
|
||||||
|
ENDIF(WITH_STATIC)
|
||||||
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
|
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
OPTION(WITH_EXTERNAL "With provided external." ON )
|
OPTION(WITH_EXTERNAL "With provided external." ON )
|
||||||
|
|
|
@ -68,7 +68,11 @@ IF(WITH_NEL_SAMPLES)
|
||||||
ADD_SUBDIRECTORY(samples)
|
ADD_SUBDIRECTORY(samples)
|
||||||
ENDIF(WITH_NEL_SAMPLES)
|
ENDIF(WITH_NEL_SAMPLES)
|
||||||
|
|
||||||
|
# Allow to compile only max plugins without other tools.
|
||||||
|
IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
|
||||||
IF(WITH_NEL_TOOLS)
|
IF(WITH_NEL_TOOLS)
|
||||||
FIND_PACKAGE(Squish)
|
FIND_PACKAGE(Squish)
|
||||||
ADD_SUBDIRECTORY(tools)
|
|
||||||
ENDIF(WITH_NEL_TOOLS)
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
|
ADD_SUBDIRECTORY(tools)
|
||||||
|
ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,11 @@ namespace NLGUI
|
||||||
*/
|
*/
|
||||||
bool affect(const CInterfaceExprValue &value);
|
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
|
/// 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)
|
* If there are no target element, the link is permanent (removed at exit)
|
||||||
* NB : The target is not updated during this call.
|
* 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.
|
// 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();
|
static void updateAllLinks();
|
||||||
// force all trigered links to be updated
|
// force all trigered links to be updated
|
||||||
|
@ -119,6 +124,7 @@ namespace NLGUI
|
||||||
* \return true if all targets are valid
|
* \return true if all targets are valid
|
||||||
*/
|
*/
|
||||||
static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect);
|
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:
|
private:
|
||||||
friend struct CRemoveTargetPred;
|
friend struct CRemoveTargetPred;
|
||||||
|
@ -135,12 +141,14 @@ namespace NLGUI
|
||||||
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
|
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
|
||||||
private:
|
private:
|
||||||
std::vector<CTarget> _Targets;
|
std::vector<CTarget> _Targets;
|
||||||
|
std::vector<CCDBTargetInfo> _CDBTargets;
|
||||||
TNodeVect _ObservedNodes;
|
TNodeVect _ObservedNodes;
|
||||||
std::string _Expr;
|
std::string _Expr;
|
||||||
CInterfaceExprNode *_ParseTree;
|
CInterfaceExprNode *_ParseTree;
|
||||||
std::string _ActionHandler;
|
std::string _ActionHandler;
|
||||||
std::string _AHParams;
|
std::string _AHParams;
|
||||||
std::string _AHCond;
|
std::string _AHCond;
|
||||||
|
CInterfaceExprNode *_AHCondParsed;
|
||||||
CInterfaceGroup *_AHParent;
|
CInterfaceGroup *_AHParent;
|
||||||
static TLinkList _LinkList;
|
static TLinkList _LinkList;
|
||||||
TLinkList::iterator _ListEntry;
|
TLinkList::iterator _ListEntry;
|
||||||
|
|
|
@ -217,6 +217,7 @@ namespace NLGUI
|
||||||
void clear() { setTop(0); }
|
void clear() { setTop(0); }
|
||||||
int getTop();
|
int getTop();
|
||||||
bool empty() { return getTop() == 0; }
|
bool empty() { return getTop() == 0; }
|
||||||
|
void pushGlobalTable();
|
||||||
void pushValue(int index); // copie nth element of stack to the top of the stack
|
void pushValue(int index); // copie nth element of stack to the top of the stack
|
||||||
void remove(int index); // remove nth element of stack
|
void remove(int index); // remove nth element of stack
|
||||||
void insert(int index); // insert last element of the stack before the given position
|
void insert(int index); // insert last element of the stack before the given position
|
||||||
|
@ -301,7 +302,8 @@ namespace NLGUI
|
||||||
/** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex'
|
/** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex'
|
||||||
* the behaviour is the same than with call of pcall.
|
* the behaviour is the same than with call of pcall.
|
||||||
*/
|
*/
|
||||||
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex = LUA_GLOBALSINDEX, int errfunc = 0);
|
int pcallByNameGlobal(const char *functionName, int nargs, int nresults, int errfunc = 0);
|
||||||
|
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex, int errfunc = 0);
|
||||||
|
|
||||||
// push a C closure (pop n element from the stack and associate with the function)
|
// push a C closure (pop n element from the stack and associate with the function)
|
||||||
void pushCClosure(lua_CFunction function, int n);
|
void pushCClosure(lua_CFunction function, int n);
|
||||||
|
@ -367,6 +369,7 @@ namespace NLGUI
|
||||||
CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; }
|
CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; }
|
||||||
|
|
||||||
void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0);
|
void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0);
|
||||||
|
int pcallByNameInternal(const char *functionName, int nargs, int nresults, int errfunc, int initialStackSize);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,16 @@ inline void CLuaState::checkIndex(int index)
|
||||||
//H_AUTO(Lua_CLuaState_checkIndex)
|
//H_AUTO(Lua_CLuaState_checkIndex)
|
||||||
// NB : more restrictive test that in the documentation there, because
|
// NB : more restrictive test that in the documentation there, because
|
||||||
// we don't expose the check stack function
|
// we don't expose the check stack function
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
nlassert( (index!=0 && abs(index) <= getTop())
|
||||||
|
|| index == LUA_REGISTRYINDEX
|
||||||
|
);
|
||||||
|
#else
|
||||||
nlassert( (index!=0 && abs(index) <= getTop())
|
nlassert( (index!=0 && abs(index) <= getTop())
|
||||||
|| index == LUA_REGISTRYINDEX
|
|| index == LUA_REGISTRYINDEX
|
||||||
|| index == LUA_GLOBALSINDEX
|
|| index == LUA_GLOBALSINDEX
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -75,6 +81,18 @@ inline void CLuaState::setTop(int index)
|
||||||
lua_settop(_State, index);
|
lua_settop(_State, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::pushGlobalTable()
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_pushGlobalTable)
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
lua_pushglobaltable(_State);
|
||||||
|
#else
|
||||||
|
checkIndex(LUA_GLOBALSINDEX);
|
||||||
|
lua_pushvalue(_State, LUA_GLOBALSINDEX);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline void CLuaState::pushValue(int index)
|
inline void CLuaState::pushValue(int index)
|
||||||
{
|
{
|
||||||
|
@ -243,7 +261,11 @@ inline size_t CLuaState::strlen(int index)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaState_strlen)
|
//H_AUTO(Lua_CLuaState_strlen)
|
||||||
checkIndex(index);
|
checkIndex(index);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
return lua_rawlen(_State, index);
|
||||||
|
#else
|
||||||
return lua_strlen(_State, index);
|
return lua_strlen(_State, index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -342,7 +364,11 @@ inline bool CLuaState::equal(int index1, int index2)
|
||||||
//H_AUTO(Lua_CLuaState_equal)
|
//H_AUTO(Lua_CLuaState_equal)
|
||||||
checkIndex(index1);
|
checkIndex(index1);
|
||||||
checkIndex(index2);
|
checkIndex(index2);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
return lua_compare(_State, index1, index2, LUA_OPEQ) != 0;
|
||||||
|
#else
|
||||||
return lua_equal(_State, index1, index2) != 0;
|
return lua_equal(_State, index1, index2) != 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -376,7 +402,11 @@ inline bool CLuaState::lessThan(int index1, int index2)
|
||||||
//H_AUTO(Lua_CLuaState_lessThan)
|
//H_AUTO(Lua_CLuaState_lessThan)
|
||||||
checkIndex(index1);
|
checkIndex(index1);
|
||||||
checkIndex(index2);
|
checkIndex(index2);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
return lua_compare(_State, index1, index2, LUA_OPLT) != 0;
|
||||||
|
#else
|
||||||
return lua_lessthan(_State, index1, index2) != 0;
|
return lua_lessthan(_State, index1, index2) != 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -444,7 +444,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAlphaRolloverSpeed();
|
float getAlphaRolloverSpeed();
|
||||||
void resetAlphaRolloverSpeed();
|
void resetAlphaRolloverSpeedProps();
|
||||||
|
|
||||||
void setContainerAlpha( uint8 alpha );
|
void setContainerAlpha( uint8 alpha );
|
||||||
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
uint8 getContainerAlpha() const { return _ContainerAlpha; }
|
||||||
|
@ -454,6 +454,7 @@ namespace NLGUI
|
||||||
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
|
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
|
||||||
|
|
||||||
void updateGlobalAlphas();
|
void updateGlobalAlphas();
|
||||||
|
void resetGlobalAlphasProps();
|
||||||
|
|
||||||
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
||||||
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
||||||
|
@ -528,6 +529,11 @@ namespace NLGUI
|
||||||
NLMISC::CCDBNodeLeaf *_AProp;
|
NLMISC::CCDBNodeLeaf *_AProp;
|
||||||
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
|
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
|
||||||
|
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB;
|
||||||
|
NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB;
|
||||||
|
|
||||||
uint8 _ContainerAlpha;
|
uint8 _ContainerAlpha;
|
||||||
uint8 _GlobalContentAlpha;
|
uint8 _GlobalContentAlpha;
|
||||||
uint8 _GlobalContainerAlpha;
|
uint8 _GlobalContainerAlpha;
|
||||||
|
|
|
@ -104,6 +104,8 @@
|
||||||
// Windows 64bits platform SDK compilers doesn't support inline assembler
|
// Windows 64bits platform SDK compilers doesn't support inline assembler
|
||||||
# define NL_NO_ASM
|
# define NL_NO_ASM
|
||||||
# endif
|
# endif
|
||||||
|
# undef _WIN32_WINNT
|
||||||
|
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
|
||||||
# endif
|
# endif
|
||||||
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
|
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
|
|
|
@ -1488,7 +1488,10 @@ void CDriverGL::enableUsedTextureMemorySum (bool enable)
|
||||||
H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum )
|
H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum )
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL");
|
nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL");
|
||||||
|
_TextureUsed.reserve(512);
|
||||||
|
}
|
||||||
_SumTextureMemoryUsed=enable;
|
_SumTextureMemoryUsed=enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,7 +1505,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
|
||||||
uint32 memory=0;
|
uint32 memory=0;
|
||||||
|
|
||||||
// For each texture used
|
// For each texture used
|
||||||
set<CTextureDrvInfosGL*>::const_iterator ite=_TextureUsed.begin();
|
std::vector<CTextureDrvInfosGL *>::const_iterator ite = _TextureUsed.begin();
|
||||||
while (ite!=_TextureUsed.end())
|
while (ite!=_TextureUsed.end())
|
||||||
{
|
{
|
||||||
// Get the gl texture
|
// Get the gl texture
|
||||||
|
@ -1510,6 +1513,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
|
||||||
gltext= (*ite);
|
gltext= (*ite);
|
||||||
|
|
||||||
// Sum the memory used by this texture
|
// Sum the memory used by this texture
|
||||||
|
if (gltext)
|
||||||
memory+=gltext->TextureMemory;
|
memory+=gltext->TextureMemory;
|
||||||
|
|
||||||
// Next texture
|
// Next texture
|
||||||
|
|
|
@ -196,6 +196,8 @@ public:
|
||||||
|
|
||||||
bool initFrameBufferObject(ITexture * tex);
|
bool initFrameBufferObject(ITexture * tex);
|
||||||
bool activeFrameBufferObject(ITexture * tex);
|
bool activeFrameBufferObject(ITexture * tex);
|
||||||
|
|
||||||
|
std::vector<CTextureDrvInfosGL *>::size_type TextureUsedIdx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1273,7 +1275,7 @@ private:
|
||||||
uint32 _NbSetupMaterialCall;
|
uint32 _NbSetupMaterialCall;
|
||||||
uint32 _NbSetupModelMatrixCall;
|
uint32 _NbSetupModelMatrixCall;
|
||||||
bool _SumTextureMemoryUsed;
|
bool _SumTextureMemoryUsed;
|
||||||
std::set<CTextureDrvInfosGL*> _TextureUsed;
|
std::vector<CTextureDrvInfosGL *> _TextureUsed;
|
||||||
uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const;
|
uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const;
|
||||||
|
|
||||||
// VBHard Lock Profiling
|
// VBHard Lock Profiling
|
||||||
|
|
|
@ -79,6 +79,8 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri
|
||||||
InitFBO = false;
|
InitFBO = false;
|
||||||
AttachDepthStencil = true;
|
AttachDepthStencil = true;
|
||||||
UsePackedDepthStencil = drvGl->supportPackedDepthStencil();
|
UsePackedDepthStencil = drvGl->supportPackedDepthStencil();
|
||||||
|
|
||||||
|
TextureUsedIdx = 0;
|
||||||
}
|
}
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CTextureDrvInfosGL::~CTextureDrvInfosGL()
|
CTextureDrvInfosGL::~CTextureDrvInfosGL()
|
||||||
|
@ -91,7 +93,10 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
|
||||||
_Driver->_AllocatedTextureMemory-= TextureMemory;
|
_Driver->_AllocatedTextureMemory-= TextureMemory;
|
||||||
|
|
||||||
// release in TextureUsed.
|
// release in TextureUsed.
|
||||||
_Driver->_TextureUsed.erase (this);
|
if (TextureUsedIdx < _Driver->_TextureUsed.size() && _Driver->_TextureUsed[TextureUsedIdx] == this)
|
||||||
|
{
|
||||||
|
_Driver->_TextureUsed[TextureUsedIdx] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(InitFBO)
|
if(InitFBO)
|
||||||
{
|
{
|
||||||
|
@ -1492,7 +1497,11 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
||||||
if (_SumTextureMemoryUsed)
|
if (_SumTextureMemoryUsed)
|
||||||
{
|
{
|
||||||
// Insert the pointer of this texture
|
// Insert the pointer of this texture
|
||||||
_TextureUsed.insert (gltext);
|
if (gltext->TextureUsedIdx >= _TextureUsed.size() || _TextureUsed[gltext->TextureUsedIdx] != gltext)
|
||||||
|
{
|
||||||
|
gltext->TextureUsedIdx = _TextureUsed.size();
|
||||||
|
_TextureUsed.push_back(gltext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tex->isTextureCube())
|
if(tex->isTextureCube())
|
||||||
|
|
|
@ -1170,8 +1170,7 @@ void CZoneLighter::light (CLandscape &landscape, CZone& output, uint zoneToLight
|
||||||
{
|
{
|
||||||
// Last patch
|
// Last patch
|
||||||
uint lastPatch=firstPatch+patchCountByThread;
|
uint lastPatch=firstPatch+patchCountByThread;
|
||||||
if (lastPatch>patchCount)
|
lastPatch %= patchCount;
|
||||||
lastPatch=patchCount;
|
|
||||||
|
|
||||||
// Last patch computed
|
// Last patch computed
|
||||||
_LastPatchComputed[process] = firstPatch;
|
_LastPatchComputed[process] = firstPatch;
|
||||||
|
@ -3772,6 +3771,8 @@ uint CZoneLighter::getAPatch (uint process)
|
||||||
uint index = _LastPatchComputed[process];
|
uint index = _LastPatchComputed[process];
|
||||||
uint firstIndex = index;
|
uint firstIndex = index;
|
||||||
|
|
||||||
|
nlassert(index < _PatchInfo.size());
|
||||||
|
|
||||||
if (access.value().size() == 0)
|
if (access.value().size() == 0)
|
||||||
// no more patches
|
// no more patches
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
|
|
|
@ -28,10 +28,12 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
|
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
|
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
|
||||||
|
|
||||||
|
void force_link_dbgroup_combo_box_cpp() { }
|
||||||
|
|
||||||
// Compare strings
|
// Compare strings
|
||||||
static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2)
|
static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
|
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
|
||||||
|
|
||||||
|
void force_link_dbgroup_select_number_cpp() { }
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m) :
|
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m) :
|
||||||
CInterfaceGroup(param)
|
CInterfaceGroup(param)
|
||||||
|
|
|
@ -2325,7 +2325,8 @@ namespace NLGUI
|
||||||
_LUAOnDbChange[dbList]= newLink;
|
_LUAOnDbChange[dbList]= newLink;
|
||||||
// Init and attach to list of untargeted links
|
// Init and attach to list of untargeted links
|
||||||
std::vector<CInterfaceLink::CTargetInfo> noTargets;
|
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;
|
_NextTriggeredLink[0] = _NextTriggeredLink[1] = NULL;
|
||||||
_Triggered[0] = _Triggered[1] = false;
|
_Triggered[0] = _Triggered[1] = false;
|
||||||
_ParseTree = NULL;
|
_ParseTree = NULL;
|
||||||
|
_AHCondParsed = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
|
@ -187,10 +188,13 @@ namespace NLGUI
|
||||||
_LinkList.erase(_ListEntry);
|
_LinkList.erase(_ListEntry);
|
||||||
|
|
||||||
delete _ParseTree;
|
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;
|
CInterfaceExprValue result;
|
||||||
// Build the parse tree
|
// 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
|
// 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));
|
_LinksWithNoTarget.push_back(TLinkSmartPtr(this));
|
||||||
}
|
}
|
||||||
|
_CDBTargets = cdbTargets;
|
||||||
|
|
||||||
// create observers
|
// create observers
|
||||||
createObservers(_ObservedNodes);
|
createObservers(_ObservedNodes);
|
||||||
|
@ -243,7 +248,12 @@ namespace NLGUI
|
||||||
//
|
//
|
||||||
_ActionHandler = actionHandler;
|
_ActionHandler = actionHandler;
|
||||||
_AHParams = ahParams;
|
_AHParams = ahParams;
|
||||||
|
nlassert(!_AHCondParsed);
|
||||||
_AHCond = ahCond;
|
_AHCond = ahCond;
|
||||||
|
if (!ahCond.empty())
|
||||||
|
{
|
||||||
|
_AHCondParsed = CInterfaceExpr::buildExprTree(ahCond);
|
||||||
|
}
|
||||||
_AHParent = parentGroup;
|
_AHParent = parentGroup;
|
||||||
return true;
|
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 there's an action handler, execute it
|
||||||
if (!_ActionHandler.empty())
|
if (!_ActionHandler.empty())
|
||||||
{
|
{
|
||||||
// If there is a condition, test it.
|
// If there is a condition, test it.
|
||||||
bool launch= true;
|
bool launch = _AHCond.empty();
|
||||||
if(!_AHCond.empty())
|
if (_AHCondParsed) // todo: maybe makes more sense to make condition also cover target
|
||||||
{
|
{
|
||||||
launch= false;
|
|
||||||
CInterfaceExprValue result;
|
CInterfaceExprValue result;
|
||||||
if(CInterfaceExpr::eval(_AHCond, result))
|
_AHCondParsed->eval(result);
|
||||||
launch = result.getBool();
|
launch = result.getBool();
|
||||||
}
|
}
|
||||||
if (launch)
|
if (launch)
|
||||||
|
@ -517,6 +555,11 @@ namespace NLGUI
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string::size_type lastPos = targetNames[k].find_last_not_of(" ");
|
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))
|
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()
|
void CInterfaceLink::checkNbRefs()
|
||||||
{
|
{
|
||||||
|
|
|
@ -997,6 +997,7 @@ namespace NLGUI
|
||||||
|
|
||||||
|
|
||||||
std::vector<CInterfaceLink::CTargetInfo> targets;
|
std::vector<CInterfaceLink::CTargetInfo> targets;
|
||||||
|
std::vector<CInterfaceLink::CCDBTargetInfo> cdbTargets;
|
||||||
|
|
||||||
ptr = (char*) xmlGetProp (cur, (xmlChar*)"target");
|
ptr = (char*) xmlGetProp (cur, (xmlChar*)"target");
|
||||||
std::string target;
|
std::string target;
|
||||||
|
@ -1004,7 +1005,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
target = std::string( (const char*)ptr );
|
target = std::string( (const char*)ptr );
|
||||||
if( !editorMode )
|
if( !editorMode )
|
||||||
CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets);
|
CInterfaceLink::splitLinkTargetsExt(std::string((const char*)ptr), parentGroup, targets, cdbTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// optional action handler
|
// optional action handler
|
||||||
|
@ -1022,7 +1023,7 @@ namespace NLGUI
|
||||||
if( !editorMode )
|
if( !editorMode )
|
||||||
{
|
{
|
||||||
CInterfaceLink *il = new CInterfaceLink;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
{
|
{
|
||||||
void ifexprufct_forcelink();
|
void ifexprufct_forcelink();
|
||||||
|
void force_link_dbgroup_select_number_cpp();
|
||||||
|
void force_link_dbgroup_combo_box_cpp();
|
||||||
|
|
||||||
/// Necessary so the linker doesn't drop the code of these classes from the library
|
/// Necessary so the linker doesn't drop the code of these classes from the library
|
||||||
void LinkHack()
|
void LinkHack()
|
||||||
|
@ -33,5 +35,7 @@ namespace NLGUI
|
||||||
CDBViewQuantity::forceLink();
|
CDBViewQuantity::forceLink();
|
||||||
CViewPointer::forceLink();
|
CViewPointer::forceLink();
|
||||||
ifexprufct_forcelink();
|
ifexprufct_forcelink();
|
||||||
|
force_link_dbgroup_select_number_cpp();
|
||||||
|
force_link_dbgroup_combo_box_cpp();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -197,6 +197,8 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
#ifdef LUA_NEVRAX_VERSION
|
#ifdef LUA_NEVRAX_VERSION
|
||||||
_State = lua_open(l_realloc_func, l_free_func);
|
_State = lua_open(l_realloc_func, l_free_func);
|
||||||
|
#elif defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
|
||||||
|
_State = luaL_newstate();
|
||||||
#else
|
#else
|
||||||
_State = lua_open();
|
_State = lua_open();
|
||||||
#endif
|
#endif
|
||||||
|
@ -361,7 +363,11 @@ namespace NLGUI
|
||||||
rd.Str = &code;
|
rd.Str = &code;
|
||||||
rd.Done = false;
|
rd.Done = false;
|
||||||
|
|
||||||
int result = lua_load(_State, CHelper::luaChunkReaderFromString, (void *) &rd, dbgSrc.c_str());
|
int result = lua_load(_State, CHelper::luaChunkReaderFromString, (void *) &rd, dbgSrc.c_str()
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
, NULL
|
||||||
|
#endif
|
||||||
|
);
|
||||||
if (result !=0)
|
if (result !=0)
|
||||||
{
|
{
|
||||||
// pop the error code
|
// pop the error code
|
||||||
|
@ -569,9 +575,17 @@ namespace NLGUI
|
||||||
//H_AUTO(Lua_CLuaState_registerFunc)
|
//H_AUTO(Lua_CLuaState_registerFunc)
|
||||||
nlassert(function);
|
nlassert(function);
|
||||||
CLuaStackChecker lsc(this);
|
CLuaStackChecker lsc(this);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
pushGlobalTable();
|
||||||
|
#endif
|
||||||
push(name);
|
push(name);
|
||||||
push(function);
|
push(function);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
setTable(-3); // -3 is the pushGlobalTable
|
||||||
|
pop(1); // pop the pushGlobalTable value (setTable popped the 2 pushes)
|
||||||
|
#else
|
||||||
setTable(LUA_GLOBALSINDEX);
|
setTable(LUA_GLOBALSINDEX);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -643,13 +657,31 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
int CLuaState::pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex /*=LUA_GLOBALSINDEX*/, int errfunc /*= 0*/)
|
int CLuaState::pcallByNameGlobal(const char *functionName, int nargs, int nresults, int errfunc /*= 0*/)
|
||||||
|
{
|
||||||
|
int initialStackSize = getTop();
|
||||||
|
nlassert(functionName);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
pushGlobalTable();
|
||||||
|
#else
|
||||||
|
nlassert(isTable(LUA_GLOBALSINDEX));
|
||||||
|
pushValue(LUA_GLOBALSINDEX);
|
||||||
|
#endif
|
||||||
|
return pcallByNameInternal(functionName, nargs, nresults, errfunc, initialStackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex, int errfunc /*= 0*/)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaState_pcallByName)
|
|
||||||
int initialStackSize = getTop();
|
int initialStackSize = getTop();
|
||||||
nlassert(functionName);
|
nlassert(functionName);
|
||||||
nlassert(isTable(funcTableIndex));
|
nlassert(isTable(funcTableIndex));
|
||||||
pushValue(funcTableIndex);
|
pushValue(funcTableIndex);
|
||||||
|
return pcallByNameInternal(functionName, nargs, nresults, errfunc, initialStackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::pcallByNameInternal(const char *functionName, int nargs, int nresults, int errfunc /*= 0*/, int initialStackSize)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_pcallByName)
|
||||||
push(functionName);
|
push(functionName);
|
||||||
getTable(-2);
|
getTable(-2);
|
||||||
remove(-2); // get rid of the table
|
remove(-2); // get rid of the table
|
||||||
|
@ -782,7 +814,12 @@ namespace NLGUI
|
||||||
int CLuaState::getGCCount()
|
int CLuaState::getGCCount()
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaState_getGCCount)
|
//H_AUTO(Lua_CLuaState_getGCCount)
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
// deprecated
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return lua_getgccount(_State);
|
return lua_getgccount(_State);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
|
@ -474,7 +474,11 @@ namespace NLGUI
|
||||||
CLuaState *luaState = table.getLuaState();
|
CLuaState *luaState = table.getLuaState();
|
||||||
CLuaStackChecker lsc(luaState);
|
CLuaStackChecker lsc(luaState);
|
||||||
// get pointer to the 'next' function
|
// get pointer to the 'next' function
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
luaState->pushGlobalTable();
|
||||||
|
#else
|
||||||
luaState->pushValue(LUA_GLOBALSINDEX);
|
luaState->pushValue(LUA_GLOBALSINDEX);
|
||||||
|
#endif
|
||||||
_NextFunction = CLuaObject(*luaState)["next"];
|
_NextFunction = CLuaObject(*luaState)["next"];
|
||||||
//
|
//
|
||||||
nlassert(luaState);
|
nlassert(luaState);
|
||||||
|
|
|
@ -1035,8 +1035,8 @@ namespace NLGUI
|
||||||
setCapturePointerRight(NULL);
|
setCapturePointerRight(NULL);
|
||||||
|
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
|
resetAlphaRolloverSpeedProps();
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
resetGlobalAlphasProps();
|
||||||
|
|
||||||
activeAnims.clear();
|
activeAnims.clear();
|
||||||
}
|
}
|
||||||
|
@ -1967,10 +1967,18 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update global color from database
|
// Update global color from database
|
||||||
setGlobalColor( NLMISC::CRGBA ( (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(),
|
if (!_RProp)
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(),
|
{
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(),
|
_RProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
|
||||||
(uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) );
|
_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 c = getGlobalColorForContent();
|
||||||
NLMISC::CRGBA gc = getGlobalColor();
|
NLMISC::CRGBA gc = getGlobalColor();
|
||||||
|
@ -2965,7 +2973,7 @@ namespace NLGUI
|
||||||
return fTmp*fTmp*fTmp;
|
return fTmp*fTmp*fTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWidgetManager::resetAlphaRolloverSpeed()
|
void CWidgetManager::resetAlphaRolloverSpeedProps()
|
||||||
{
|
{
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
_AlphaRolloverSpeedDB = NULL;
|
||||||
}
|
}
|
||||||
|
@ -2981,10 +2989,29 @@ namespace NLGUI
|
||||||
|
|
||||||
void CWidgetManager::updateGlobalAlphas()
|
void CWidgetManager::updateGlobalAlphas()
|
||||||
{
|
{
|
||||||
_GlobalContentAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32();
|
if (!_GlobalContentAlphaDB)
|
||||||
_GlobalContainerAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32();
|
{
|
||||||
_GlobalRolloverFactorContent = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32();
|
_GlobalContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA");
|
||||||
_GlobalRolloverFactorContainer = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32();
|
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 )
|
void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler )
|
||||||
|
@ -3156,6 +3183,7 @@ namespace NLGUI
|
||||||
|
|
||||||
CWidgetManager::CWidgetManager()
|
CWidgetManager::CWidgetManager()
|
||||||
{
|
{
|
||||||
|
LinkHack();
|
||||||
CStringShared::createStringMapper();
|
CStringShared::createStringMapper();
|
||||||
|
|
||||||
CReflectableRegister::registerClasses();
|
CReflectableRegister::registerClasses();
|
||||||
|
@ -3171,6 +3199,8 @@ namespace NLGUI
|
||||||
_LastYContextHelp= -10000;
|
_LastYContextHelp= -10000;
|
||||||
|
|
||||||
resetColorProps();
|
resetColorProps();
|
||||||
|
resetAlphaRolloverSpeedProps();
|
||||||
|
resetGlobalAlphasProps();
|
||||||
|
|
||||||
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
|
||||||
_GlobalColorForContent = _GlobalColor;
|
_GlobalColorForContent = _GlobalColor;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
IF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
SUBDIRS(
|
SUBDIRS(
|
||||||
build_coarse_mesh
|
build_coarse_mesh
|
||||||
build_far_bank
|
build_far_bank
|
||||||
|
@ -21,27 +24,35 @@ SUBDIRS(
|
||||||
shapes_exporter
|
shapes_exporter
|
||||||
tga_cut
|
tga_cut
|
||||||
tga_resize
|
tga_resize
|
||||||
|
shape2obj
|
||||||
zone_check_bind
|
zone_check_bind
|
||||||
zone_dump
|
zone_dump
|
||||||
zviewer)
|
zviewer)
|
||||||
|
|
||||||
IF(WIN32)
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
ADD_SUBDIRECTORY(ig_elevation)
|
|
||||||
ADD_SUBDIRECTORY(lightmap_optimizer)
|
|
||||||
|
|
||||||
|
# For tools selection of only max plugins
|
||||||
|
IF(WIN32)
|
||||||
IF(MFC_FOUND)
|
IF(MFC_FOUND)
|
||||||
ADD_SUBDIRECTORY(object_viewer)
|
ADD_SUBDIRECTORY(object_viewer)
|
||||||
ADD_SUBDIRECTORY(object_viewer_exe)
|
|
||||||
ADD_SUBDIRECTORY(tile_edit)
|
|
||||||
ENDIF(MFC_FOUND)
|
|
||||||
|
|
||||||
IF(WITH_NEL_MAXPLUGIN)
|
IF(WITH_NEL_MAXPLUGIN)
|
||||||
IF(MAXSDK_FOUND)
|
IF(MAXSDK_FOUND)
|
||||||
ADD_SUBDIRECTORY(plugin_max)
|
ADD_SUBDIRECTORY(plugin_max)
|
||||||
ADD_SUBDIRECTORY(ligo)
|
ADD_SUBDIRECTORY(ligo)
|
||||||
ENDIF(MAXSDK_FOUND)
|
ENDIF(MAXSDK_FOUND)
|
||||||
ENDIF(WITH_NEL_MAXPLUGIN)
|
ENDIF(WITH_NEL_MAXPLUGIN)
|
||||||
|
ENDIF(MFC_FOUND)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
ADD_SUBDIRECTORY(ig_elevation)
|
||||||
|
ADD_SUBDIRECTORY(lightmap_optimizer)
|
||||||
|
IF(MFC_FOUND)
|
||||||
|
ADD_SUBDIRECTORY(object_viewer_exe)
|
||||||
|
ADD_SUBDIRECTORY(tile_edit)
|
||||||
|
ENDIF(MFC_FOUND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(WITH_QT)
|
IF(WITH_QT)
|
||||||
|
@ -59,3 +70,6 @@ ENDIF(SQUISH_FOUND)
|
||||||
|
|
||||||
#crash_log_analyser
|
#crash_log_analyser
|
||||||
#shapes_exporter
|
#shapes_exporter
|
||||||
|
|
||||||
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
|
|
|
@ -1271,7 +1271,8 @@ void CObjectViewer::go ()
|
||||||
// Calc FPS
|
// Calc FPS
|
||||||
static sint64 lastTime=NLMISC::CTime::getPerformanceTime ();
|
static sint64 lastTime=NLMISC::CTime::getPerformanceTime ();
|
||||||
sint64 newTime=NLMISC::CTime::getPerformanceTime ();
|
sint64 newTime=NLMISC::CTime::getPerformanceTime ();
|
||||||
float fps = (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
|
sint64 timeDiff = newTime - lastTime;
|
||||||
|
float fps = timeDiff > 0 ? (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)) : 1000.0f;
|
||||||
lastTime=newTime;
|
lastTime=newTime;
|
||||||
char msgBar[1024];
|
char msgBar[1024];
|
||||||
uint nbPlayingSources, nbSources;
|
uint nbPlayingSources, nbSources;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 135 KiB |
|
@ -574,36 +574,6 @@ plugin material NelMaterial
|
||||||
CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right
|
CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right
|
||||||
)
|
)
|
||||||
|
|
||||||
on cbTwoSided changed bval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on cpAmbient changed cval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on cpDiffuse changed cval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on spOpacity changed pval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on cpSpecular changed cval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on spSpecularLevel changed pval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on spGlossiness changed pval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on cpSelfIllumColor changed cval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on spSelfIllumAmount changed bval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
on cbUseSelfIllumColor changed bval do
|
|
||||||
updateUI false
|
|
||||||
|
|
||||||
Fn updateUI update =
|
Fn updateUI update =
|
||||||
(
|
(
|
||||||
if (version >= 14) then
|
if (version >= 14) then
|
||||||
|
@ -655,6 +625,36 @@ plugin material NelMaterial
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
on cbTwoSided changed bval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on cpAmbient changed cval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on cpDiffuse changed cval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on spOpacity changed pval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on cpSpecular changed cval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on spSpecularLevel changed pval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on spGlossiness changed pval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on cpSelfIllumColor changed cval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on spSelfIllumAmount changed bval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
|
on cbUseSelfIllumColor changed bval do
|
||||||
|
updateUI false
|
||||||
|
|
||||||
on nelBasicParameters open do
|
on nelBasicParameters open do
|
||||||
(
|
(
|
||||||
updateUI true
|
updateUI true
|
||||||
|
|
9
code/nel/tools/3d/shape2obj/CMakeLists.txt
Normal file
9
code/nel/tools/3d/shape2obj/CMakeLists.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FILE(GLOB SRC *.cpp)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(shape2obj ${SRC})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(shape2obj nelmisc nel3d)
|
||||||
|
NL_DEFAULT_PROPS(shape2obj "NeL, Tools, 3D: shape2obj")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(shape2obj)
|
||||||
|
|
||||||
|
INSTALL(TARGETS shape2obj RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
|
|
@ -66,7 +66,7 @@ const CIndexBuffer *getRdrPassPrimitiveBlock(const CMeshMRMSkinnedGeom *mesh, ui
|
||||||
|
|
||||||
bool ProcessMeshMRMSkinned(const std::string &filename, IShape *shapeMesh);
|
bool ProcessMeshMRMSkinned(const std::string &filename, IShape *shapeMesh);
|
||||||
bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh);
|
bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh);
|
||||||
bool ProcessMesh(const std::string &filename, IShape *shapeMesh);
|
//bool ProcessMesh(const std::string &filename, IShape *shapeMesh);
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (ProcessMeshMRMSkinned(filename, shapeMesh)) return 0;
|
if (ProcessMeshMRMSkinned(filename, shapeMesh)) return 0;
|
||||||
if (ProcessMeshMRM(filename, shapeMesh)) return 0;
|
if (ProcessMeshMRM(filename, shapeMesh)) return 0;
|
||||||
if (ProcessMesh(filename, shapeMesh)) return 0;
|
// if (ProcessMesh(filename, shapeMesh)) return 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -519,6 +519,10 @@ bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
TODO: implement this
|
||||||
|
|
||||||
bool ProcessMesh(const std::string &filename, IShape *shapeMesh)
|
bool ProcessMesh(const std::string &filename, IShape *shapeMesh)
|
||||||
{
|
{
|
||||||
CMesh *mesh = dynamic_cast<CMesh*>(shapeMesh);
|
CMesh *mesh = dynamic_cast<CMesh*>(shapeMesh);
|
||||||
|
@ -666,3 +670,5 @@ bool ProcessMesh(const std::string &filename, IShape *shapeMesh)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
|
@ -1,10 +1,17 @@
|
||||||
|
|
||||||
|
# Don't add other subdirectories if only max plugins are selected.
|
||||||
|
IF(WITH_NEL_TOOLS)
|
||||||
ADD_SUBDIRECTORY(misc)
|
ADD_SUBDIRECTORY(misc)
|
||||||
ADD_SUBDIRECTORY(memory)
|
ADD_SUBDIRECTORY(memory)
|
||||||
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
|
|
||||||
|
# Max plugins are under the 3d directory as well.
|
||||||
IF(WITH_3D)
|
IF(WITH_3D)
|
||||||
ADD_SUBDIRECTORY(3d)
|
ADD_SUBDIRECTORY(3d)
|
||||||
ENDIF(WITH_3D)
|
ENDIF(WITH_3D)
|
||||||
|
|
||||||
|
# Don't add other subdirectories if only max plugins are selected.
|
||||||
|
IF(WITH_NEL_TOOLS)
|
||||||
IF(WITH_PACS)
|
IF(WITH_PACS)
|
||||||
ADD_SUBDIRECTORY(pacs)
|
ADD_SUBDIRECTORY(pacs)
|
||||||
ENDIF(WITH_PACS)
|
ENDIF(WITH_PACS)
|
||||||
|
@ -24,5 +31,4 @@ ENDIF(WITH_SOUND)
|
||||||
IF(WITH_NEL_TESTS)
|
IF(WITH_NEL_TESTS)
|
||||||
ADD_SUBDIRECTORY(nel_unit_test)
|
ADD_SUBDIRECTORY(nel_unit_test)
|
||||||
ENDIF(WITH_NEL_TESTS)
|
ENDIF(WITH_NEL_TESTS)
|
||||||
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
#build_gamedata
|
|
||||||
|
|
|
@ -88,8 +88,6 @@ def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVaria
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
generateSimpleMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimInstallDirectory")
|
|
||||||
|
|
||||||
generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory")
|
generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory")
|
||||||
|
|
||||||
generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory")
|
generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory")
|
||||||
|
|
|
@ -100,6 +100,8 @@ def generateTaggedMaxExporter(processName, fileExtension, sourceDirectoriesVaria
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
generateTaggedMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimTagExportDirectory", "PacsPrimInstallDirectory")
|
||||||
|
|
||||||
generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory")
|
generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory")
|
||||||
|
|
||||||
generateTaggedMaxScript("ig", "ig")
|
generateTaggedMaxScript("ig", "ig")
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#
|
#
|
||||||
# \file 1_export.py
|
# \file 1_export.py
|
||||||
# \brief Export pacs_prim
|
# \brief Export pacs_prim
|
||||||
# \date 2011-09-28-07-42-GMT
|
# \date 2013-07-24-14-21-GMT
|
||||||
# \author Jan Boon (Kaetemi)
|
# \author Jan Boon (Kaetemi)
|
||||||
# Python port of game data build pipeline.
|
# Python port of game data build pipeline.
|
||||||
# Export pacs_prim
|
# Export pacs_prim
|
||||||
|
@ -33,7 +33,9 @@ sys.path.append("../../configuration")
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
if os.path.isfile("temp_log.log"):
|
||||||
|
os.remove("temp_log.log")
|
||||||
|
log = open("temp_log.log", "w")
|
||||||
from scripts import *
|
from scripts import *
|
||||||
from buildsite import *
|
from buildsite import *
|
||||||
from process import *
|
from process import *
|
||||||
|
@ -47,6 +49,7 @@ printLog(log, "-------")
|
||||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
|
|
||||||
# Find tools
|
# Find tools
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
@ -58,15 +61,18 @@ if MaxAvailable:
|
||||||
|
|
||||||
printLog(log, ">>> Export pacs_prim 3dsmax <<<")
|
printLog(log, ">>> Export pacs_prim 3dsmax <<<")
|
||||||
mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory)
|
mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory)
|
||||||
|
mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory)
|
||||||
for dir in PacsPrimSourceDirectories:
|
for dir in PacsPrimSourceDirectories:
|
||||||
mkPath(log, DatabaseDirectory + "/" + dir)
|
mkPath(log, DatabaseDirectory + "/" + dir)
|
||||||
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimExportDirectory, ".pacs_prim")):
|
if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimTagExportDirectory, ".max.tag")):
|
||||||
scriptSrc = "maxscript/pacs_prim_export.ms"
|
scriptSrc = "maxscript/pacs_prim_export.ms"
|
||||||
scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms"
|
scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms"
|
||||||
outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log"
|
outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log"
|
||||||
outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory
|
outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory
|
||||||
|
tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory
|
||||||
maxSourceDir = DatabaseDirectory + "/" + dir
|
maxSourceDir = DatabaseDirectory + "/" + dir
|
||||||
tagList = findFiles(log, outputDirectory, "", ".pacs_prim")
|
maxRunningTagFile = tagDirectory + "/max_running.tag"
|
||||||
|
tagList = findFiles(log, tagDirectory, "", ".max.tag")
|
||||||
tagLen = len(tagList)
|
tagLen = len(tagList)
|
||||||
if os.path.isfile(scriptDst):
|
if os.path.isfile(scriptDst):
|
||||||
os.remove(scriptDst)
|
os.remove(scriptDst)
|
||||||
|
@ -77,18 +83,50 @@ if MaxAvailable:
|
||||||
newline = line.replace("%OutputLogfile%", outputLogfile)
|
newline = line.replace("%OutputLogfile%", outputLogfile)
|
||||||
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
|
newline = newline.replace("%MaxSourceDirectory%", maxSourceDir)
|
||||||
newline = newline.replace("%OutputDirectory%", outputDirectory)
|
newline = newline.replace("%OutputDirectory%", outputDirectory)
|
||||||
|
newline = newline.replace("%TagDirectory%", tagDirectory)
|
||||||
sDst.write(newline)
|
sDst.write(newline)
|
||||||
sSrc.close()
|
sSrc.close()
|
||||||
sDst.close()
|
sDst.close()
|
||||||
|
zeroRetryLimit = 3
|
||||||
while tagDiff > 0:
|
while tagDiff > 0:
|
||||||
|
mrt = open(maxRunningTagFile, "w")
|
||||||
|
mrt.write("moe-moe-kyun")
|
||||||
|
mrt.close()
|
||||||
printLog(log, "MAXSCRIPT " + scriptDst)
|
printLog(log, "MAXSCRIPT " + scriptDst)
|
||||||
subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ])
|
subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ])
|
||||||
tagList = findFiles(log, outputDirectory, "", ".pacs_prim")
|
if os.path.exists(outputLogfile):
|
||||||
|
try:
|
||||||
|
lSrc = open(outputLogfile, "r")
|
||||||
|
for line in lSrc:
|
||||||
|
lineStrip = line.strip()
|
||||||
|
if (len(lineStrip) > 0):
|
||||||
|
printLog(log, lineStrip)
|
||||||
|
lSrc.close()
|
||||||
|
os.remove(outputLogfile)
|
||||||
|
except Exception:
|
||||||
|
printLog(log, "ERROR Failed to read 3dsmax log")
|
||||||
|
else:
|
||||||
|
printLog(log, "WARNING No 3dsmax log")
|
||||||
|
tagList = findFiles(log, tagDirectory, "", ".max.tag")
|
||||||
newTagLen = len(tagList)
|
newTagLen = len(tagList)
|
||||||
tagDiff = newTagLen - tagLen
|
tagDiff = newTagLen - tagLen
|
||||||
tagLen = newTagLen
|
tagLen = newTagLen
|
||||||
printLog(log, "Exported " + str(tagDiff) + " .pacs_prim files!")
|
addTagDiff = 0
|
||||||
|
if os.path.exists(maxRunningTagFile):
|
||||||
|
printLog(log, "FAIL 3ds Max crashed and/or file export failed!")
|
||||||
|
if tagDiff == 0:
|
||||||
|
if zeroRetryLimit > 0:
|
||||||
|
zeroRetryLimit = zeroRetryLimit - 1
|
||||||
|
addTagDiff = 1
|
||||||
|
else:
|
||||||
|
printLog(log, "FAIL Retry limit reached!")
|
||||||
|
else:
|
||||||
|
addTagDiff = 1
|
||||||
|
os.remove(maxRunningTagFile)
|
||||||
|
printLog(log, "Exported " + str(tagDiff) + " .max files!")
|
||||||
|
tagDiff += addTagDiff
|
||||||
os.remove(scriptDst)
|
os.remove(scriptDst)
|
||||||
|
printLog(log, "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,8 +137,10 @@ if os.path.isfile(listPath):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printLog(log, "")
|
|
||||||
log.close()
|
log.close()
|
||||||
|
if os.path.isfile("log.log"):
|
||||||
|
os.remove("log.log")
|
||||||
|
shutil.move("temp_log.log", "log.log")
|
||||||
|
|
||||||
|
|
||||||
# end of file
|
# end of file
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
-- Allocate 20 Me for the script
|
-- Allocate 20 Me for the script
|
||||||
heapSize += 15000000
|
heapSize += 15000000
|
||||||
|
|
||||||
|
-- In case of error just abort the app and don't show nel report window
|
||||||
|
NelForceQuitOnMsgDisplayer()
|
||||||
|
|
||||||
nlErrorFilename = "%OutputLogfile%"
|
nlErrorFilename = "%OutputLogfile%"
|
||||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||||
if nlErrorStream == undefined then
|
if nlErrorStream == undefined then
|
||||||
|
@ -110,7 +113,11 @@ fn runNelMaxExport inputMaxFile =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
removeRunningTag = true
|
||||||
|
|
||||||
try
|
try
|
||||||
|
(
|
||||||
|
undo off
|
||||||
(
|
(
|
||||||
-- Get files in the %MaxSourceDirectory% directory
|
-- Get files in the %MaxSourceDirectory% directory
|
||||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||||
|
@ -127,12 +134,12 @@ try
|
||||||
for i = 1 to files.count do
|
for i = 1 to files.count do
|
||||||
(
|
(
|
||||||
inputMaxFile = files[i]
|
inputMaxFile = files[i]
|
||||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim")
|
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||||
|
|
||||||
try
|
--try
|
||||||
(
|
--(
|
||||||
-- Compare file date
|
-- Compare file date
|
||||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||||
(
|
(
|
||||||
-- Free memory and file handles
|
-- Free memory and file handles
|
||||||
gc()
|
gc()
|
||||||
|
@ -145,24 +152,46 @@ try
|
||||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||||
(
|
(
|
||||||
runNelMaxExport(inputMaxFile)
|
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||||
|
|
||||||
|
-- Write a tag file
|
||||||
|
if tagThisFile == true then
|
||||||
|
(
|
||||||
|
tagFile = createFile outputTagFile
|
||||||
|
if tagFile == undefined then
|
||||||
|
(
|
||||||
|
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
print "mukyu" to: tagFile
|
||||||
|
close tagFile
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
-- Error
|
-- Error
|
||||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||||
|
removeRunningTag = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
nlerror("SKIPPED " + inputMaxFile)
|
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||||
)
|
|
||||||
)
|
|
||||||
catch
|
|
||||||
(
|
|
||||||
-- Error
|
|
||||||
nlerror("ERROR error exporting 'pacs_prim' in files " + inputMaxFile)
|
|
||||||
)
|
)
|
||||||
|
--)
|
||||||
|
--catch
|
||||||
|
--(
|
||||||
|
-- -- Error
|
||||||
|
-- nlerror("ERROR error exporting 'pacs_prim' in file " + inputMaxFile)
|
||||||
|
-- removeRunningTag = false
|
||||||
|
--)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
@ -170,15 +199,42 @@ try
|
||||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
catch
|
catch
|
||||||
(
|
(
|
||||||
-- Error
|
-- Error
|
||||||
nlerror("ERROR fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
||||||
|
nlerror("FAIL Fatal error occured")
|
||||||
|
NelForceQuitRightNow()
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
|
||||||
|
try
|
||||||
|
(
|
||||||
|
if (removeRunningTag) then
|
||||||
|
(
|
||||||
|
resetMAXFile #noPrompt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
catch
|
||||||
|
(
|
||||||
|
nlerror("FAIL Last reset fails")
|
||||||
|
removeRunningTag = false
|
||||||
|
)
|
||||||
|
|
||||||
|
if (removeRunningTag) then
|
||||||
|
(
|
||||||
|
nlerror("SUCCESS All .max files have been successfully exported")
|
||||||
|
deleteFile("%TagDirectory%/max_running.tag")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
nlerror("FAIL One or more issues occured")
|
||||||
|
NelForceQuitRightNow()
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Bye
|
-- Bye
|
||||||
|
nlerror("BYE")
|
||||||
resetMAXFile #noprompt
|
|
||||||
quitMAX #noPrompt
|
quitMAX #noPrompt
|
||||||
quitMAX() #noPrompt
|
quitMAX() #noPrompt
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@ IF(WITH_RYZOM_CLIENT)
|
||||||
ENDIF(CURL_STATIC)
|
ENDIF(CURL_STATIC)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(client)
|
ADD_SUBDIRECTORY(client)
|
||||||
|
|
||||||
|
ELSEIF(WITH_RYZOM_TOOLS)
|
||||||
|
|
||||||
|
# Need clientsheets lib for sheets packer tool
|
||||||
|
ADD_SUBDIRECTORY(client)
|
||||||
|
|
||||||
ENDIF(WITH_RYZOM_CLIENT)
|
ENDIF(WITH_RYZOM_CLIENT)
|
||||||
|
|
||||||
IF(WITH_RYZOM_TOOLS)
|
IF(WITH_RYZOM_TOOLS)
|
||||||
|
@ -53,6 +59,14 @@ IF(WITH_RYZOM_TOOLS)
|
||||||
ENDIF(WITH_RYZOM_TOOLS)
|
ENDIF(WITH_RYZOM_TOOLS)
|
||||||
|
|
||||||
IF(WITH_RYZOM_SERVER)
|
IF(WITH_RYZOM_SERVER)
|
||||||
|
|
||||||
FIND_PACKAGE(MySQL REQUIRED)
|
FIND_PACKAGE(MySQL REQUIRED)
|
||||||
ADD_SUBDIRECTORY(server)
|
ADD_SUBDIRECTORY(server)
|
||||||
|
|
||||||
|
ELSEIF(WITH_RYZOM_TOOLS)
|
||||||
|
|
||||||
|
# Need servershare for build packed collision tool
|
||||||
|
# Need aishare for build wmap tool
|
||||||
|
ADD_SUBDIRECTORY(server)
|
||||||
|
|
||||||
ENDIF(WITH_RYZOM_SERVER)
|
ENDIF(WITH_RYZOM_SERVER)
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
# Need clientsheets lib for sheets packer tool
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
|
|
||||||
|
IF(WITH_RYZOM_CLIENT)
|
||||||
|
|
||||||
#ADD_SUBDIRECTORY(data)
|
#ADD_SUBDIRECTORY(data)
|
||||||
#ADD_SUBDIRECTORY(patcher)
|
#ADD_SUBDIRECTORY(patcher)
|
||||||
|
|
||||||
|
@ -12,3 +17,5 @@ IF(RYZOM_ETC_PREFIX)
|
||||||
ELSE(RYZOM_ETC_PREFIX)
|
ELSE(RYZOM_ETC_PREFIX)
|
||||||
INSTALL(FILES client_default.cfg DESTINATION etc/ryzom)
|
INSTALL(FILES client_default.cfg DESTINATION etc/ryzom)
|
||||||
ENDIF(RYZOM_ETC_PREFIX)
|
ENDIF(RYZOM_ETC_PREFIX)
|
||||||
|
|
||||||
|
ENDIF(WITH_RYZOM_CLIENT)
|
||||||
|
|
|
@ -126,24 +126,24 @@ AutoEquipTool = 1;
|
||||||
|
|
||||||
|
|
||||||
// *** LANDSCAPE
|
// *** LANDSCAPE
|
||||||
LandscapeTileNear = 150.000000;
|
LandscapeTileNear = 50.000000;
|
||||||
LandscapeTileNear_min = 20.000000;
|
LandscapeTileNear_min = 20.000000;
|
||||||
LandscapeTileNear_max = 250.000000;
|
LandscapeTileNear_max = 100.000000;
|
||||||
LandscapeTileNear_step = 10.0;
|
LandscapeTileNear_step = 10.0;
|
||||||
LandscapeTileNear_ps0 = 20.0;
|
LandscapeTileNear_ps0 = 20.0;
|
||||||
LandscapeTileNear_ps1 = 100.0;
|
LandscapeTileNear_ps1 = 40.0;
|
||||||
LandscapeTileNear_ps2 = 150.0;
|
LandscapeTileNear_ps2 = 50.0;
|
||||||
LandscapeTileNear_ps3 = 200.0;
|
LandscapeTileNear_ps3 = 80.0;
|
||||||
|
|
||||||
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
|
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
|
||||||
LandscapeThreshold = 2000.0;
|
LandscapeThreshold = 1000.0;
|
||||||
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
|
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
|
||||||
LandscapeThreshold_max = 4000.0; // High quality => 0.0005 threshold
|
LandscapeThreshold_max = 2000.0; // High quality => 0.0005 threshold
|
||||||
LandscapeThreshold_step = 100.0;
|
LandscapeThreshold_step = 100.0;
|
||||||
LandscapeThreshold_ps0 = 100.0;
|
LandscapeThreshold_ps0 = 100.0;
|
||||||
LandscapeThreshold_ps1 = 1000.0;
|
LandscapeThreshold_ps1 = 500.0;
|
||||||
LandscapeThreshold_ps2 = 2000.0;
|
LandscapeThreshold_ps2 = 1000.0;
|
||||||
LandscapeThreshold_ps3 = 3000.0;
|
LandscapeThreshold_ps3 = 2000.0;
|
||||||
|
|
||||||
Vision = 500.000000;
|
Vision = 500.000000;
|
||||||
Vision_min = 200.000000;
|
Vision_min = 200.000000;
|
||||||
|
|
|
@ -126,24 +126,24 @@ AutoEquipTool = 1;
|
||||||
|
|
||||||
|
|
||||||
// *** LANDSCAPE
|
// *** LANDSCAPE
|
||||||
LandscapeTileNear = 150.000000;
|
LandscapeTileNear = 50.000000;
|
||||||
LandscapeTileNear_min = 20.000000;
|
LandscapeTileNear_min = 20.000000;
|
||||||
LandscapeTileNear_max = 250.000000;
|
LandscapeTileNear_max = 100.000000;
|
||||||
LandscapeTileNear_step = 10.0;
|
LandscapeTileNear_step = 10.0;
|
||||||
LandscapeTileNear_ps0 = 20.0;
|
LandscapeTileNear_ps0 = 20.0;
|
||||||
LandscapeTileNear_ps1 = 100.0;
|
LandscapeTileNear_ps1 = 40.0;
|
||||||
LandscapeTileNear_ps2 = 150.0;
|
LandscapeTileNear_ps2 = 50.0;
|
||||||
LandscapeTileNear_ps3 = 200.0;
|
LandscapeTileNear_ps3 = 80.0;
|
||||||
|
|
||||||
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
|
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
|
||||||
LandscapeThreshold = 2000.0;
|
LandscapeThreshold = 1000.0;
|
||||||
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
|
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
|
||||||
LandscapeThreshold_max = 4000.0; // High quality => 0.0005 threshold
|
LandscapeThreshold_max = 2000.0; // High quality => 0.0005 threshold
|
||||||
LandscapeThreshold_step = 100.0;
|
LandscapeThreshold_step = 100.0;
|
||||||
LandscapeThreshold_ps0 = 100.0;
|
LandscapeThreshold_ps0 = 100.0;
|
||||||
LandscapeThreshold_ps1 = 1000.0;
|
LandscapeThreshold_ps1 = 500.0;
|
||||||
LandscapeThreshold_ps2 = 2000.0;
|
LandscapeThreshold_ps2 = 1000.0;
|
||||||
LandscapeThreshold_ps3 = 3000.0;
|
LandscapeThreshold_ps3 = 2000.0;
|
||||||
|
|
||||||
Vision = 500.000000;
|
Vision = 500.000000;
|
||||||
Vision_min = 200.000000;
|
Vision_min = 200.000000;
|
||||||
|
|
|
@ -84,7 +84,7 @@ function bgdownloader:setPatchProgress(progress)
|
||||||
|
|
||||||
self:getPrioCB().active = true
|
self:getPrioCB().active = true
|
||||||
local progressPercentText = string.format("%d%%", 100 * progress)
|
local progressPercentText = string.format("%d%%", 100 * progress)
|
||||||
local progressPostfix = math.mod(os.time(), 3)
|
local progressPostfix = math.fmod(os.time(), 3)
|
||||||
local progressDate = nltime.getLocalTime() / 500
|
local progressDate = nltime.getLocalTime() / 500
|
||||||
local colValue = math.floor(230 + 24 * math.sin(progressDate))
|
local colValue = math.floor(230 + 24 * math.sin(progressDate))
|
||||||
local color = string.format("%d %d %d %d", colValue, colValue, colValue, 255)
|
local color = string.format("%d %d %d %d", colValue, colValue, colValue, 255)
|
||||||
|
|
|
@ -2882,15 +2882,12 @@ This MUST follow the Enum MISSION_DESC::TIconId
|
||||||
type="bool"
|
type="bool"
|
||||||
value="true" />
|
value="true" />
|
||||||
<!-- Blend between day and night (lightLevel = 0 day) (lightLevel = 1 night) -->
|
<!-- Blend between day and night (lightLevel = 0 day) (lightLevel = 1 night) -->
|
||||||
<link expr="depends(@UI:VARIABLES:CURRENT_TIME)"
|
<link expr="identity(ilinear(getLightLevel(), getRed(intToColor(@UI:SAVE:DAY_COLOR)), getRed(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
|
||||||
action="set"
|
target="@UI:SAVE:COLOR:R" />
|
||||||
params="dblink=UI:SAVE:COLOR:R|value=ilinear(getLightLevel(), getRed(intToColor(@UI:SAVE:DAY_COLOR)), getRed(intToColor(@UI:SAVE:NIGHT_COLOR)))" />
|
<link expr="identity(ilinear(getLightLevel(), getGreen(intToColor(@UI:SAVE:DAY_COLOR)), getGreen(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
|
||||||
<link expr="depends(@UI:VARIABLES:CURRENT_TIME)"
|
target="@UI:SAVE:COLOR:G" />
|
||||||
action="set"
|
<link expr="identity(ilinear(getLightLevel(), getBlue(intToColor(@UI:SAVE:DAY_COLOR)), getBlue(intToColor(@UI:SAVE:NIGHT_COLOR))), @UI:VARIABLES:CURRENT_TIME)"
|
||||||
params="dblink=UI:SAVE:COLOR:G|value=ilinear(getLightLevel(), getGreen(intToColor(@UI:SAVE:DAY_COLOR)), getGreen(intToColor(@UI:SAVE:NIGHT_COLOR)))" />
|
target="@UI:SAVE:COLOR:B" />
|
||||||
<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="depends(@UI:VARIABLES:CURRENT_TIME)" action="set"
|
<!--<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)" />-->
|
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 -->
|
<!-- The User Target Slot and UID -->
|
||||||
|
|
|
@ -521,7 +521,7 @@ function GameR2Loading:validateLoading()
|
||||||
|
|
||||||
local filename = GameR2Loading.CurrentFile
|
local filename = GameR2Loading.CurrentFile
|
||||||
|
|
||||||
if string.find(filename, '\.r2', -3) == nil then
|
if string.find(filename, '.r2', -3) == nil then
|
||||||
messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName"))
|
messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -863,8 +863,10 @@
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
<!--<define id="cs_url"
|
||||||
|
value="http://app.ryzom.com/ticket_system/index.php?mode=load" />-->
|
||||||
<define id="cs_url"
|
<define id="cs_url"
|
||||||
value="http://app.ryzom.com/ticket_system/index.php?mode=load" />
|
value="http://localhost:40917/www/html/index.php" />
|
||||||
<group type="container"
|
<group type="container"
|
||||||
id="cs_browser"
|
id="cs_browser"
|
||||||
w="410"
|
w="410"
|
||||||
|
@ -905,6 +907,22 @@
|
||||||
group_params_r="menu=ui:interface:base_menu_with_color"
|
group_params_r="menu=ui:interface:base_menu_with_color"
|
||||||
on_active="lua"
|
on_active="lua"
|
||||||
on_active_params="help:openCSBrowserHeader('cs_browser')">
|
on_active_params="help:openCSBrowserHeader('cs_browser')">
|
||||||
|
|
||||||
|
|
||||||
|
<!--Quitta start-->
|
||||||
|
<ctrl style="text_button_header"
|
||||||
|
button_type="push_button"
|
||||||
|
id="browse_home"
|
||||||
|
posref="MR MR"
|
||||||
|
x="-16"
|
||||||
|
y="0"
|
||||||
|
hardtext="AMS-HOME"
|
||||||
|
tooltip="uittBrowseHome"
|
||||||
|
onclick_l="browse_home"
|
||||||
|
params_l="name=ui:interface:cs_browser:content:html"
|
||||||
|
frozen="false" />
|
||||||
|
<!--Quitta end-->
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<group id="content"
|
<group id="content"
|
||||||
x="0"
|
x="0"
|
||||||
|
@ -919,9 +937,9 @@
|
||||||
url="home"
|
url="home"
|
||||||
title_prefix="uiHelpTitle"
|
title_prefix="uiHelpTitle"
|
||||||
sizeref="wh"
|
sizeref="wh"
|
||||||
x="184"
|
x="2"
|
||||||
y="0"
|
y="0"
|
||||||
w="-190"
|
w="-4"
|
||||||
h="0"
|
h="0"
|
||||||
background_color="0 0 0 255"
|
background_color="0 0 0 255"
|
||||||
error_color="255 240 48 255"
|
error_color="255 240 48 255"
|
||||||
|
@ -942,7 +960,7 @@
|
||||||
h6_font_size="12"
|
h6_font_size="12"
|
||||||
paragraph_begin_space="12"
|
paragraph_begin_space="12"
|
||||||
multi_line_space_factor="0.25"
|
multi_line_space_factor="0.25"
|
||||||
td_begin_space="0"
|
td_begin_space="10"
|
||||||
li_begin_space="4"
|
li_begin_space="4"
|
||||||
ul_begin_space="12"
|
ul_begin_space="12"
|
||||||
li_indent="-10"
|
li_indent="-10"
|
||||||
|
@ -989,43 +1007,6 @@
|
||||||
<ctrl style="skin_scroll"
|
<ctrl style="skin_scroll"
|
||||||
id="scroll_bar" />
|
id="scroll_bar" />
|
||||||
</group>
|
</group>
|
||||||
<group id="sbtree"
|
|
||||||
posref="TL TL"
|
|
||||||
x="0"
|
|
||||||
y="-12"
|
|
||||||
sizeref="h"
|
|
||||||
w="180"
|
|
||||||
h="-12">
|
|
||||||
<group id="black"
|
|
||||||
posref="BR BR"
|
|
||||||
sizeref="hw"
|
|
||||||
w="-12"
|
|
||||||
h="0"
|
|
||||||
inherit_gc_alpha="true" />
|
|
||||||
<instance template="inner_thin_border"
|
|
||||||
posparent="black"
|
|
||||||
inherit_gc_alpha="true" />
|
|
||||||
<group id="tree_list"
|
|
||||||
type="tree"
|
|
||||||
posref="TL TL"
|
|
||||||
x="16"
|
|
||||||
y="-4"
|
|
||||||
col_over="255 255 255 48"
|
|
||||||
col_select="255 255 255 80"
|
|
||||||
fontsize="10"
|
|
||||||
max_sizeparent="parent"
|
|
||||||
max_sizeref="wh"
|
|
||||||
max_w="-20"
|
|
||||||
max_h="-10">
|
|
||||||
<node name="uiCSBase"
|
|
||||||
handler="launch_help"
|
|
||||||
params="help_container=ui:interface:cs_browser|url=%cs_url" />
|
|
||||||
</group>
|
|
||||||
<ctrl style="skin_scroll"
|
|
||||||
id="scroll_bar"
|
|
||||||
align="T"
|
|
||||||
target="tree_list" />
|
|
||||||
</group>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<!--******************-->
|
<!--******************-->
|
||||||
|
|
|
@ -131,7 +131,7 @@ local function levelToForceRegion(level)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function levelToLevelForce(level)
|
local function levelToLevelForce(level)
|
||||||
return math.floor(math.mod(level, 50) * 5 / 50) + 1
|
return math.floor(math.fmod(level, 50) * 5 / 50) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
text_ref="BM BM" text_y="-2"
|
text_ref="BM BM" text_y="-2"
|
||||||
reset_focus_on_hide="false" max_historic="0"
|
reset_focus_on_hide="false" max_historic="0"
|
||||||
onenter="set_keyboard_focus" params="target=ui:login:checkpass:content:submit_gr:eb_password:eb|select_all=false"
|
onenter="set_keyboard_focus" params="target=ui:login:checkpass:content:submit_gr:eb_password:eb|select_all=false"
|
||||||
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="20" color="135 243 28 255" />
|
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="12" color="135 243 28 255" />
|
||||||
|
|
||||||
<instance template="edit_box_log" id="eb_password" posparent="txt_pas" posref="BM TM" w="240" h="24" fontsize="14" x="0" y="-4"
|
<instance template="edit_box_log" id="eb_password" posparent="txt_pas" posref="BM TM" w="240" h="24" fontsize="14" x="0" y="-4"
|
||||||
text_ref="BM BM" text_y="-2"
|
text_ref="BM BM" text_y="-2"
|
||||||
|
@ -660,7 +660,7 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t
|
||||||
text_ref="BM BM" text_y="-2"
|
text_ref="BM BM" text_y="-2"
|
||||||
on_focus="create_account_rules" on_focus_params="rules_password" reset_focus_on_hide="false" max_historic="0" entry_type="password"
|
on_focus="create_account_rules" on_focus_params="rules_password" reset_focus_on_hide="false" max_historic="0" entry_type="password"
|
||||||
onenter="set_keyboard_focus" params="target=ui:login:create_account:content:submit_gr:eb_confirm_password:eb|select_all=false"
|
onenter="set_keyboard_focus" params="target=ui:login:create_account:content:submit_gr:eb_confirm_password:eb|select_all=false"
|
||||||
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="8" color="135 243 28 255" />
|
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="20" color="135 243 28 255" />
|
||||||
|
|
||||||
<!-- confirm password -->
|
<!-- confirm password -->
|
||||||
<view type="text" id="txt_confirm_pas" posparent="txt_pas" posref="BL TL" hardtext="uiConfirmPassword" fontsize="10" x="0" y="-30" color="255 255 255 255" />
|
<view type="text" id="txt_confirm_pas" posparent="txt_pas" posref="BL TL" hardtext="uiConfirmPassword" fontsize="10" x="0" y="-30" color="255 255 255 255" />
|
||||||
|
@ -669,7 +669,7 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t
|
||||||
text_ref="BM BM" text_y="-2"
|
text_ref="BM BM" text_y="-2"
|
||||||
on_focus="create_account_rules" on_focus_params="rules_password_conf" reset_focus_on_hide="false" max_historic="0" entry_type="password"
|
on_focus="create_account_rules" on_focus_params="rules_password_conf" reset_focus_on_hide="false" max_historic="0" entry_type="password"
|
||||||
onenter="set_keyboard_focus" params="target=ui:login:create_account:content:submit_gr:eb_email:eb|select_all=false"
|
onenter="set_keyboard_focus" params="target=ui:login:create_account:content:submit_gr:eb_email:eb|select_all=false"
|
||||||
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="8" color="135 243 28 255" />
|
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="20" color="135 243 28 255" />
|
||||||
|
|
||||||
<!-- email -->
|
<!-- email -->
|
||||||
<view type="text" id="txt_email" posparent="txt_confirm_pas" posref="BL TL" hardtext="uiEmail" fontsize="10" x="0" y="-30" color="255 255 255 255" />
|
<view type="text" id="txt_email" posparent="txt_confirm_pas" posref="BL TL" hardtext="uiEmail" fontsize="10" x="0" y="-30" color="255 255 255 255" />
|
||||||
|
@ -678,7 +678,7 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t
|
||||||
text_ref="BM BM" text_y="-2"
|
text_ref="BM BM" text_y="-2"
|
||||||
on_focus="create_account_rules" on_focus_params="rules_email" reset_focus_on_hide="false" max_historic="0"
|
on_focus="create_account_rules" on_focus_params="rules_email" reset_focus_on_hide="false" max_historic="0"
|
||||||
onenter="" params=""
|
onenter="" params=""
|
||||||
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="255" color="135 243 28 255" />
|
prompt="" enter_loose_focus="true" multi_line="false" max_num_chars="254" color="135 243 28 255" />
|
||||||
|
|
||||||
<!-- accept conditions -->
|
<!-- accept conditions -->
|
||||||
<ctrl type="button" id="accept_cond" button_type="toggle_button" pushed="true"
|
<ctrl type="button" id="accept_cond" button_type="toggle_button" pushed="true"
|
||||||
|
|
|
@ -425,9 +425,7 @@
|
||||||
<link expr="@UI:VARIABLES:OPEN_RESPAWN" target="ui:interface:respawn_map:active" />
|
<link expr="@UI:VARIABLES:OPEN_RESPAWN" target="ui:interface:respawn_map:active" />
|
||||||
|
|
||||||
<!-- Set the Open Flag when the delay has expired -->
|
<!-- Set the Open Flag when the delay has expired -->
|
||||||
<link expr="depends(@UI:VARIABLES:OPEN_RESPAWN_AT_TIME, @UI:VARIABLES:CURRENT_TIME)" action="set"
|
<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" />
|
||||||
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) )" />
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Verify player mode. because at init, mode == 0, => the window won't be opened by default
|
Verify player mode. because at init, mode == 0, => the window won't be opened by default
|
||||||
|
|
|
@ -135,7 +135,7 @@ end
|
||||||
--function outgame:setPatchProgress(progress)
|
--function outgame:setPatchProgress(progress)
|
||||||
-- --debugInfo("*** 3 ***")
|
-- --debugInfo("*** 3 ***")
|
||||||
-- local progressPercentText = string.format("%d%%", 100 * progress)
|
-- local progressPercentText = string.format("%d%%", 100 * progress)
|
||||||
-- local progressPostfix = math.mod(os.time(), 3)
|
-- local progressPostfix = math.fmod(os.time(), 3)
|
||||||
-- --debugInfo("Patch in progress : " .. tostring(progress))
|
-- --debugInfo("Patch in progress : " .. tostring(progress))
|
||||||
-- local progressDate = nltime.getLocalTime() / 500
|
-- local progressDate = nltime.getLocalTime() / 500
|
||||||
-- local colValue = math.floor(230 + 24 * math.sin(progressDate))
|
-- local colValue = math.floor(230 + 24 * math.sin(progressDate))
|
||||||
|
|
|
@ -56,24 +56,17 @@ function game:outpostAdjustHour(uiLocal, prop)
|
||||||
local h = runExpr(prop);
|
local h = runExpr(prop);
|
||||||
|
|
||||||
-- add time zone and clamp hour
|
-- add time zone and clamp hour
|
||||||
h = math.mod(h + tz + 24, 24);
|
h = math.fmod(h + tz + 24, 24);
|
||||||
uiGroup[uiLocal].uc_hardtext = string.format('%02d:00', h);
|
uiGroup[uiLocal].uc_hardtext = string.format('%02d:00', h);
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
function game:outpostUpdateTimeZone()
|
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');
|
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;
|
game.Outpost.LastTimeZoneUpdate = curTick;
|
||||||
runAH(nil,'outpost_update_time_zone_auto','');
|
runAH(nil,'outpost_update_time_zone_auto','');
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
function game:outpostIsStatusWar(status)
|
function game:outpostIsStatusWar(status)
|
||||||
|
@ -288,8 +281,8 @@ function game:outpostActiveDefenderHourButton()
|
||||||
local timeRangeDef= getDbProp(path .. ':TIME_RANGE_DEF');
|
local timeRangeDef= getDbProp(path .. ':TIME_RANGE_DEF');
|
||||||
local timeRangeDefWanted= getDbProp(path .. ':TIME_RANGE_DEF_WANTED');
|
local timeRangeDefWanted= getDbProp(path .. ':TIME_RANGE_DEF_WANTED');
|
||||||
timeRangeDef= secondsSince1970ToHour( timeRangeDef );
|
timeRangeDef= secondsSince1970ToHour( timeRangeDef );
|
||||||
timeRangeDef= math.mod(timeRangeDef+24, 24);
|
timeRangeDef= math.fmod(timeRangeDef+24, 24);
|
||||||
timeRangeDefWanted= math.mod(timeRangeDefWanted+24, 24);
|
timeRangeDefWanted= math.fmod(timeRangeDefWanted+24, 24);
|
||||||
|
|
||||||
-- if time required is the one obtained, or if we are in peace
|
-- if time required is the one obtained, or if we are in peace
|
||||||
if( timeRangeDef == timeRangeDefWanted or status<=game.OutpostEnums.Peace ) then
|
if( timeRangeDef == timeRangeDefWanted or status<=game.OutpostEnums.Peace ) then
|
||||||
|
@ -323,8 +316,8 @@ function game:outpostActiveAttackerHourButton()
|
||||||
local timeRangeAtt= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT');
|
local timeRangeAtt= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT');
|
||||||
local timeRangeAttWanted= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ATTACK_PERIOD');
|
local timeRangeAttWanted= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ATTACK_PERIOD');
|
||||||
timeRangeAtt= secondsSince1970ToHour( timeRangeAtt );
|
timeRangeAtt= secondsSince1970ToHour( timeRangeAtt );
|
||||||
timeRangeAtt= math.mod(timeRangeAtt+24, 24);
|
timeRangeAtt= math.fmod(timeRangeAtt+24, 24);
|
||||||
timeRangeAttWanted= math.mod(timeRangeAttWanted+24, 24);
|
timeRangeAttWanted= math.fmod(timeRangeAttWanted+24, 24);
|
||||||
|
|
||||||
-- if time required is the one obtained
|
-- if time required is the one obtained
|
||||||
if( timeRangeAtt == timeRangeAttWanted ) then
|
if( timeRangeAtt == timeRangeAttWanted ) then
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
<!-- Save the Time Zone config -->
|
<!-- Save the Time Zone config -->
|
||||||
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE" type="sint32" value="0" />
|
<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: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-->
|
<!-- 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 -->
|
<!-- Temp Variables -->
|
||||||
|
|
|
@ -803,8 +803,8 @@ end
|
||||||
|
|
||||||
|
|
||||||
function game:timeInSecondsToReadableTime(regenTime)
|
function game:timeInSecondsToReadableTime(regenTime)
|
||||||
local seconds = math.mod(regenTime, 60)
|
local seconds = math.fmod(regenTime, 60)
|
||||||
local minutes = math.mod(math.floor(regenTime / 60), 60)
|
local minutes = math.fmod(math.floor(regenTime / 60), 60)
|
||||||
local hours = math.floor(regenTime / 3600)
|
local hours = math.floor(regenTime / 3600)
|
||||||
local result = ""
|
local result = ""
|
||||||
if seconds > 0 then result = concatUCString(tostring(seconds), i18n.get("uittSecondsShort")) end
|
if seconds > 0 then result = concatUCString(tostring(seconds), i18n.get("uittSecondsShort")) end
|
||||||
|
|
|
@ -904,7 +904,7 @@ function RingAccessPoint:onDraw()
|
||||||
self.LastRefreshTime = nltime.getLocalTime() / 1000
|
self.LastRefreshTime = nltime.getLocalTime() / 1000
|
||||||
--self:getWindow():find("refreshText").active = false
|
--self:getWindow():find("refreshText").active = false
|
||||||
else
|
else
|
||||||
local waitText = i18n.get("uiRAP_WaitMsg" .. math.mod(os.time(), 3))
|
local waitText = i18n.get("uiRAP_WaitMsg" .. math.fmod(os.time(), 3))
|
||||||
self:setInfoMessage(waitText)
|
self:setInfoMessage(waitText)
|
||||||
--local refreshText = self:getWindow():find("refreshText")
|
--local refreshText = self:getWindow():find("refreshText")
|
||||||
--if not self.ListReceived then
|
--if not self.ListReceived then
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
|
|
||||||
|
# Need clientsheets lib for sheets packer tool
|
||||||
|
ADD_SUBDIRECTORY(client_sheets)
|
||||||
|
|
||||||
|
IF(WITH_RYZOM_CLIENT)
|
||||||
|
|
||||||
# These are Windows/MFC apps
|
# These are Windows/MFC apps
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
# ADD_SUBDIRECTORY(bug_report)
|
# ADD_SUBDIRECTORY(bug_report)
|
||||||
SET(SEVENZIP_LIBRARY "ryzom_sevenzip")
|
SET(SEVENZIP_LIBRARY "ryzom_sevenzip")
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(client_sheets)
|
|
||||||
ADD_SUBDIRECTORY(seven_zip)
|
ADD_SUBDIRECTORY(seven_zip)
|
||||||
|
|
||||||
FILE(GLOB CFG ../*.cfg ../*.cfg.in)
|
FILE(GLOB CFG ../*.cfg ../*.cfg.in)
|
||||||
|
@ -124,3 +129,5 @@ IF(WITH_PCH)
|
||||||
ENDIF(WITH_PCH)
|
ENDIF(WITH_PCH)
|
||||||
|
|
||||||
INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)
|
INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)
|
||||||
|
|
||||||
|
ENDIF(WITH_RYZOM_CLIENT)
|
||||||
|
|
|
@ -318,7 +318,11 @@ void CCDBSynchronised::writeInitInProgressIntoUIDB()
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
if (pIM)
|
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
|
else
|
||||||
nlwarning("InterfaceManager not created");
|
nlwarning("InterfaceManager not created");
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,8 @@ private:
|
||||||
bool allInitPacketReceived() const { return _InitDeltaReceived == 2; } // Classic database + inventory
|
bool allInitPacketReceived() const { return _InitDeltaReceived == 2; } // Classic database + inventory
|
||||||
|
|
||||||
void writeInitInProgressIntoUIDB();
|
void writeInitInProgressIntoUIDB();
|
||||||
|
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> m_CDBInitInProgressDB;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5164,7 +5164,7 @@ NLMISC_COMMAND(luaObject, "Dump the content of a lua object", "<table name> [max
|
||||||
CLuaIHMRyzom::debugInfo(e.what());
|
CLuaIHMRyzom::debugInfo(e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
luaState->pushValue(LUA_GLOBALSINDEX);
|
luaState->pushGlobalTable();
|
||||||
CLuaObject env;
|
CLuaObject env;
|
||||||
env.pop(*luaState);
|
env.pop(*luaState);
|
||||||
uint maxDepth;
|
uint maxDepth;
|
||||||
|
|
|
@ -58,6 +58,7 @@ uint32 MissionRingId = 0;
|
||||||
UInstance selectedInstance;
|
UInstance selectedInstance;
|
||||||
const UInstance noSelectedInstance;
|
const UInstance noSelectedInstance;
|
||||||
string selectedInstanceURL;
|
string selectedInstanceURL;
|
||||||
|
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> s_UserCharFade;
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -273,7 +274,8 @@ void checkUnderCursor()
|
||||||
entity= EntitiesMngr.getEntityUnderPos(cursX, cursY, ClientCfg.SelectionDist, isPlayerUnderCursor);
|
entity= EntitiesMngr.getEntityUnderPos(cursX, cursY, ClientCfg.SelectionDist, isPlayerUnderCursor);
|
||||||
|
|
||||||
// If the mouse is over the player make the player transparent
|
// 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 ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
|
||||||
{
|
{
|
||||||
// If the nearest entity is the player, hide!
|
// 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 (i=0; i<MAX_NUM_MISSIONS; i++)
|
||||||
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
|
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 );
|
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
|
// Add an Observer to the Team database
|
||||||
for (i=0; i<MaxNumPeopleInTeam; i++)
|
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 );
|
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 );
|
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
|
// Add an Observer to the Animal database
|
||||||
for (i=0; i<MAX_INVENTORY_ANIMAL; i++)
|
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);
|
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);
|
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 //
|
}// initialize //
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
#include "ground_fx_manager.h"
|
#include "ground_fx_manager.h"
|
||||||
#include "projectile_manager.h"
|
#include "projectile_manager.h"
|
||||||
#include "user_entity.h"
|
#include "user_entity.h"
|
||||||
|
// Some constants
|
||||||
|
#include "game_share/mission_desc.h"
|
||||||
|
#include "game_share/inventories.h"
|
||||||
// Misc.
|
// Misc.
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/misc/stream.h"
|
#include "nel/misc/stream.h"
|
||||||
|
@ -36,6 +39,7 @@
|
||||||
#include "nel/misc/vector.h"
|
#include "nel/misc/vector.h"
|
||||||
#include "nel/misc/file.h"
|
#include "nel/misc/file.h"
|
||||||
#include "nel/misc/aabbox.h"
|
#include "nel/misc/aabbox.h"
|
||||||
|
#include "nel/misc/cdb_leaf.h"
|
||||||
// 3D
|
// 3D
|
||||||
#include "nel/3d/u_instance.h"
|
#include "nel/3d/u_instance.h"
|
||||||
// Std.
|
// Std.
|
||||||
|
@ -149,6 +153,14 @@ private:
|
||||||
|
|
||||||
NL3D::UInstance _LastInstanceUnderPos;
|
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[8]; // MaxNumPeopleInTeam in people_interaction.h
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GroupMemberNameDB[8]; // MaxNumPeopleInTeam in people_interaction.h
|
||||||
|
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 ///
|
//// DEBUG ///
|
||||||
uint _NbUser;
|
uint _NbUser;
|
||||||
|
@ -344,6 +356,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void refreshInsceneInterfaceOfFriendNPC(uint slot);
|
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:
|
private:
|
||||||
|
|
||||||
// NB: don't return unselectable entities
|
// 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];
|
NLMISC::CRGBA CEntityCL::_GMTitleColor[CHARACTER_TITLE::EndGmTitle - CHARACTER_TITLE::BeginGmTitle + 1];
|
||||||
uint8 CEntityCL::_InvalidGMTitleCode = 0xFF;
|
uint8 CEntityCL::_InvalidGMTitleCode = 0xFF;
|
||||||
NLMISC::CRefPtr<CCDBNodeLeaf> CEntityCL::_OpacityMinNodeLeaf;
|
NLMISC::CRefPtr<CCDBNodeLeaf> CEntityCL::_OpacityMinNodeLeaf;
|
||||||
|
NLMISC::CRefPtr<CCDBNodeLeaf> CEntityCL::_ShowReticleLeaf;
|
||||||
|
|
||||||
|
|
||||||
// Context help
|
// Context help
|
||||||
|
@ -2646,7 +2647,7 @@ void CEntityCL::updateMissionTarget()
|
||||||
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
|
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
|
||||||
{
|
{
|
||||||
// Get the db prop
|
// 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)
|
if (prop)
|
||||||
{
|
{
|
||||||
_MissionTarget = _NameId == (uint32)prop->getValue32();
|
_MissionTarget = _NameId == (uint32)prop->getValue32();
|
||||||
|
@ -2846,8 +2847,8 @@ void CEntityCL::updateIsInTeam ()
|
||||||
for (uint i=0; i<MaxNumPeopleInTeam; i++)
|
for (uint i=0; i<MaxNumPeopleInTeam; i++)
|
||||||
{
|
{
|
||||||
// Get the db prop
|
// Get the db prop
|
||||||
CCDBNodeLeaf *uidProp = NLGUI::CDBManager::getInstance()->getDbProp(toString(TEAM_DB_PATH ":%d:UID", i), false);
|
CCDBNodeLeaf *uidProp = EntitiesMngr.getGroupMemberUidDB(i);
|
||||||
CCDBNodeLeaf *presentProp = NLGUI::CDBManager::getInstance()->getDbProp(toString(TEAM_DB_PATH ":%d:NAME", i), false);
|
CCDBNodeLeaf *presentProp = EntitiesMngr.getGroupMemberNameDB(i);
|
||||||
// If same Entity uid than the one in the Database, ok the entity is in the Player TEAM!!
|
// If same Entity uid than the one in the Database, ok the entity is in the Player TEAM!!
|
||||||
if (uidProp && uidProp->getValue32() == (sint32)dataSetId() &&
|
if (uidProp && uidProp->getValue32() == (sint32)dataSetId() &&
|
||||||
presentProp && presentProp->getValueBool() )
|
presentProp && presentProp->getValueBool() )
|
||||||
|
@ -2876,9 +2877,9 @@ void CEntityCL::updateIsUserAnimal ()
|
||||||
for (uint i=0; i<MAX_INVENTORY_ANIMAL; i++)
|
for (uint i=0; i<MAX_INVENTORY_ANIMAL; i++)
|
||||||
{
|
{
|
||||||
// Get the db prop
|
// Get the db prop
|
||||||
CCDBNodeLeaf *uidProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:UID", i), false);
|
CCDBNodeLeaf *uidProp = EntitiesMngr.getBeastUidDB(i);
|
||||||
CCDBNodeLeaf *statusProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", i), false);
|
CCDBNodeLeaf *statusProp = EntitiesMngr.getBeastStatusDB(i);
|
||||||
CCDBNodeLeaf *typeProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:TYPE", i), false);
|
CCDBNodeLeaf *typeProp = EntitiesMngr.getBeastTypeDB(i);
|
||||||
// I must have the same Id, and the animal entry must be ok.
|
// I must have the same Id, and the animal entry must be ok.
|
||||||
if(uidProp && statusProp && typeProp && uidProp->getValue32() == (sint32)dataSetId() &&
|
if(uidProp && statusProp && typeProp && uidProp->getValue32() == (sint32)dataSetId() &&
|
||||||
ANIMAL_STATUS::isSpawned((ANIMAL_STATUS::EAnimalStatus)(statusProp->getValue32()) ))
|
ANIMAL_STATUS::isSpawned((ANIMAL_STATUS::EAnimalStatus)(statusProp->getValue32()) ))
|
||||||
|
@ -3041,7 +3042,9 @@ void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */,
|
||||||
|
|
||||||
bool bShowReticle = true;
|
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)
|
if (node)
|
||||||
{
|
{
|
||||||
bShowReticle = node->getValueBool();
|
bShowReticle = node->getValueBool();
|
||||||
|
|
|
@ -1112,6 +1112,7 @@ protected:
|
||||||
sint64 _LastLocalSelectBoxComputeTime;
|
sint64 _LastLocalSelectBoxComputeTime;
|
||||||
|
|
||||||
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _OpacityMinNodeLeaf;
|
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _OpacityMinNodeLeaf;
|
||||||
|
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _ShowReticleLeaf;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -425,14 +425,15 @@ class CActionHandlerAddLink : public IActionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CInterfaceLink::CTargetInfo> targetsVect;
|
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)
|
if (!result)
|
||||||
{
|
{
|
||||||
nlwarning("<CActionHandlerAddLink> Couldn't parse all links");
|
nlwarning("<CActionHandlerAddLink> Couldn't parse all links");
|
||||||
}
|
}
|
||||||
// add the link
|
// add the link
|
||||||
CInterfaceLink *il = new CInterfaceLink;
|
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();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
CWidgetManager::getInstance()->getParser()->addLink(il, id);
|
CWidgetManager::getInstance()->getParser()->addLink(il, id);
|
||||||
il->update();
|
il->update();
|
||||||
|
|
|
@ -108,7 +108,7 @@ ucstring CControlSheetTooltipInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet,
|
||||||
CLuaStackRestorer lsr(ls, 0);
|
CLuaStackRestorer lsr(ls, 0);
|
||||||
|
|
||||||
CLuaIHM::pushReflectableOnStack(*ls, (CReflectableRefPtrTarget *)ctrlSheet);
|
CLuaIHM::pushReflectableOnStack(*ls, (CReflectableRefPtrTarget *)ctrlSheet);
|
||||||
ls->pushValue(LUA_GLOBALSINDEX);
|
ls->pushGlobalTable();
|
||||||
CLuaObject game(*ls);
|
CLuaObject game(*ls);
|
||||||
game = game["game"];
|
game = game["game"];
|
||||||
game.callMethodByNameNoThrow(luaMethodName.c_str(), 1, 1);
|
game.callMethodByNameNoThrow(luaMethodName.c_str(), 1, 1);
|
||||||
|
@ -3170,7 +3170,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const
|
||||||
_PhraseAdapter = new CSPhraseComAdpater;
|
_PhraseAdapter = new CSPhraseComAdpater;
|
||||||
_PhraseAdapter->Phrase = pPM->getPhrase(phraseId);
|
_PhraseAdapter->Phrase = pPM->getPhrase(phraseId);
|
||||||
CLuaIHM::pushReflectableOnStack(*ls, _PhraseAdapter);
|
CLuaIHM::pushReflectableOnStack(*ls, _PhraseAdapter);
|
||||||
ls->pushValue(LUA_GLOBALSINDEX);
|
ls->pushGlobalTable();
|
||||||
CLuaObject game(*ls);
|
CLuaObject game(*ls);
|
||||||
game = game["game"];
|
game = game["game"];
|
||||||
game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1);
|
game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1);
|
||||||
|
|
|
@ -41,16 +41,77 @@ uint CGroupInSceneUserInfo::_BatLength = 0;
|
||||||
CCDBNodeLeaf *CGroupInSceneUserInfo::_Value = NULL;
|
CCDBNodeLeaf *CGroupInSceneUserInfo::_Value = NULL;
|
||||||
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueBegin = NULL;
|
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueBegin = NULL;
|
||||||
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueEnd = NULL;
|
CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueEnd = NULL;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> CGroupInSceneUserInfo::_GuildIconLeaf[256];
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupInSceneUserInfo, std::string, "in_scene_user_info");
|
NLMISC_REGISTER_OBJECT(CViewBase, CGroupInSceneUserInfo, std::string, "in_scene_user_info");
|
||||||
REGISTER_UI_CLASS(CGroupInSceneUserInfo)
|
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 ¶m)
|
CGroupInSceneUserInfo::CGroupInSceneUserInfo(const TCtorParam ¶m)
|
||||||
: CGroupInScene(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;
|
_Name = NULL;
|
||||||
_Title = NULL;
|
_Title = NULL;
|
||||||
_GuildName = NULL;
|
_GuildName = NULL;
|
||||||
|
@ -130,7 +191,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
bool needPvPLogo= false;
|
bool needPvPLogo= false;
|
||||||
bool permanentContent = false;
|
bool permanentContent = false;
|
||||||
bool rpTags = 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
|
// Names
|
||||||
const char *templateName;
|
const char *templateName;
|
||||||
|
@ -156,7 +217,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
// Active fields and bars
|
// Active fields and bars
|
||||||
if ( isForageSource )
|
if ( isForageSource )
|
||||||
{
|
{
|
||||||
string dbEntry = "UI:SAVE:INSCENE:SOURCE:";
|
|
||||||
CForageSourceCL *forageSource = static_cast<CForageSourceCL*>(entity);
|
CForageSourceCL *forageSource = static_cast<CForageSourceCL*>(entity);
|
||||||
|
|
||||||
name = !entityName.empty() /*&& NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool()*/;
|
name = !entityName.empty() /*&& NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool()*/;
|
||||||
|
@ -175,32 +235,32 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
}
|
}
|
||||||
else if(npcFriendAndNeutral)
|
else if(npcFriendAndNeutral)
|
||||||
{
|
{
|
||||||
string dbEntry;
|
int dbEntry;
|
||||||
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
|
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
|
||||||
// For RoleMasters, merchants etc... must display name and function, and nothing else
|
// For RoleMasters, merchants etc... must display name and function, and nothing else
|
||||||
for(uint i=0;i<NumBars;i++)
|
for(uint i=0;i<NumBars;i++)
|
||||||
bars[i]= false;
|
bars[i]= false;
|
||||||
name= !entityName.empty() && CDBManager::getInstance()->getDbProp(dbEntry+"NPCNAME")->getValueBool();
|
name= !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCName()->getValueBool();
|
||||||
symbol= false;
|
symbol= false;
|
||||||
title= !entityTitle.empty() && CDBManager::getInstance()->getDbProp(dbEntry+"NPCTITLE")->getValueBool();
|
title= !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCTitle()->getValueBool();
|
||||||
guildName= false;
|
guildName= false;
|
||||||
templateName = "in_scene_user_info";
|
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
|
else
|
||||||
{
|
{
|
||||||
// Base entry in database
|
// Base entry in database
|
||||||
string dbEntry;
|
int dbEntry;
|
||||||
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
|
getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars );
|
||||||
name = !entityName.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool();
|
name = !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getName()->getValueBool();
|
||||||
title = !entityTitle.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"TITLE")->getValueBool();
|
title = !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getTitle()->getValueBool();
|
||||||
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();
|
||||||
// if name is empty but not title, title is displayed as name
|
// 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;
|
title = true;
|
||||||
templateName = "in_scene_user_info";
|
templateName = "in_scene_user_info";
|
||||||
// special guild
|
// 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
|
// if symbol not still available, wait for one when VP received
|
||||||
symbol = (entity->getGuildSymbol() != 0);
|
symbol = (entity->getGuildSymbol() != 0);
|
||||||
|
@ -211,7 +271,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
symbol= false;
|
symbol= false;
|
||||||
needGuildSymbolId = 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
|
// if guild name not still available, wait for one when VP received
|
||||||
guildName = (entity->getGuildNameID() != 0);
|
guildName = (entity->getGuildNameID() != 0);
|
||||||
|
@ -222,7 +282,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
guildName= false;
|
guildName= false;
|
||||||
needGuildNameId= false;
|
needGuildNameId= false;
|
||||||
}
|
}
|
||||||
needPvPLogo = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"PVP_LOGO")->getValueBool();
|
needPvPLogo = _ConfigSaveInsceneDB[dbEntry].getPvPLogo()->getValueBool();
|
||||||
|
|
||||||
eventFaction = (entity->getEventFactionID() != 0);
|
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 currently is edition mode, then bars are not displayed
|
||||||
if (ClientCfg.R2EDEnabled && R2::isEditionCurrent())
|
if (ClientCfg.R2EDEnabled && R2::isEditionCurrent())
|
||||||
{
|
{
|
||||||
|
@ -813,11 +873,11 @@ void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bars[HP] = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"HP")->getValueBool();
|
bars[HP] = _ConfigSaveInsceneDB[dbEntry].getHP()->getValueBool();
|
||||||
bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"SAP")->getValueBool();
|
bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSap()->getValueBool();
|
||||||
bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"STA")->getValueBool();
|
bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSta()->getValueBool();
|
||||||
bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"FOCUS")->getValueBool();
|
bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getFocus()->getValueBool();
|
||||||
bars[Action] = (isUser) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"ACTION")->getValueBool();
|
bars[Action] = (isUser) && _ConfigSaveInsceneDB[dbEntry].getAction()->getValueBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +891,7 @@ void CGroupInSceneUserInfo::setLeftGroupActive( bool active )
|
||||||
if ( _Entity->isUser() || _Entity->isForageSource() )
|
if ( _Entity->isUser() || _Entity->isForageSource() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string dbEntry;
|
int dbEntry;
|
||||||
bool barSettings [NumBars];
|
bool barSettings [NumBars];
|
||||||
getBarSettings( CInterfaceManager::getInstance(), _Entity->isUser(), _Entity->isPlayer(), _Entity->isViewedAsFriend(), dbEntry, barSettings );
|
getBarSettings( CInterfaceManager::getInstance(), _Entity->isUser(), _Entity->isPlayer(), _Entity->isViewedAsFriend(), dbEntry, barSettings );
|
||||||
|
|
||||||
|
@ -943,8 +1003,13 @@ void CGroupInSceneUserInfo::updateDynamicData ()
|
||||||
if (_Entity->getGuildSymbol() != 0)
|
if (_Entity->getGuildSymbol() != 0)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
|
if (!_GuildIconLeaf[_Entity->slot()])
|
||||||
|
{
|
||||||
string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON";
|
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
|
// Set the event faction
|
||||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Fill NumBars elements into bars and set dbEntry
|
/// 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)
|
// The entity (character or forage source)
|
||||||
CEntityCL *_Entity;
|
CEntityCL *_Entity;
|
||||||
|
@ -97,6 +97,9 @@ protected:
|
||||||
static NLMISC::CCDBNodeLeaf *_ValueBegin;
|
static NLMISC::CCDBNodeLeaf *_ValueBegin;
|
||||||
static NLMISC::CCDBNodeLeaf *_ValueEnd;
|
static NLMISC::CCDBNodeLeaf *_ValueEnd;
|
||||||
|
|
||||||
|
// Guild icon leafs
|
||||||
|
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
|
||||||
|
|
||||||
// Special guild
|
// Special guild
|
||||||
bool _NeedGuildNameId;
|
bool _NeedGuildNameId;
|
||||||
bool _NeedGuildSymbolId;
|
bool _NeedGuildSymbolId;
|
||||||
|
|
|
@ -511,6 +511,8 @@ CInterfaceManager::CInterfaceManager()
|
||||||
_LogState = false;
|
_LogState = false;
|
||||||
_KeysLoaded = false;
|
_KeysLoaded = false;
|
||||||
CWidgetManager::getInstance()->resetColorProps();
|
CWidgetManager::getInstance()->resetColorProps();
|
||||||
|
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
|
||||||
|
CWidgetManager::getInstance()->resetGlobalAlphasProps();
|
||||||
_NeutralColor = NULL;
|
_NeutralColor = NULL;
|
||||||
_WarningColor = NULL;
|
_WarningColor = NULL;
|
||||||
_ErrorColor = NULL;
|
_ErrorColor = NULL;
|
||||||
|
@ -1420,8 +1422,9 @@ void CInterfaceManager::uninitInGame1 ()
|
||||||
_NeutralColor = NULL;
|
_NeutralColor = NULL;
|
||||||
_WarningColor = NULL;
|
_WarningColor = NULL;
|
||||||
_ErrorColor = NULL;
|
_ErrorColor = NULL;
|
||||||
CWidgetManager::getInstance()->resetAlphaRolloverSpeed();
|
|
||||||
CWidgetManager::getInstance()->resetColorProps();
|
CWidgetManager::getInstance()->resetColorProps();
|
||||||
|
CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps();
|
||||||
|
CWidgetManager::getInstance()->resetGlobalAlphasProps();
|
||||||
|
|
||||||
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
||||||
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
|
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
|
||||||
|
@ -1978,7 +1981,11 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
|
||||||
// Update Player characteristics (for Item carac requirement Redifying)
|
// Update Player characteristics (for Item carac requirement Redifying)
|
||||||
nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8);
|
nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8);
|
||||||
for (uint i=0; i<CHARACTERISTICS::NUM_CHARACTERISTICS; ++i)
|
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 );
|
CWidgetManager::getInstance()->drawViews( camera );
|
||||||
|
|
||||||
|
|
|
@ -634,6 +634,7 @@ private:
|
||||||
|
|
||||||
// Item Carac requirement
|
// Item Carac requirement
|
||||||
sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS];
|
sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS];
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _CurrentPlayerCharacLeaf[CHARACTERISTICS::NUM_CHARACTERISTICS];
|
||||||
|
|
||||||
// observers for copying database branch changes
|
// observers for copying database branch changes
|
||||||
CServerToLocalAutoCopy ServerToLocalAutoCopyInventory;
|
CServerToLocalAutoCopy ServerToLocalAutoCopyInventory;
|
||||||
|
|
|
@ -187,9 +187,11 @@ static DECLARE_INTERFACE_USER_FCT(lua)
|
||||||
// *** clear return value
|
// *** clear return value
|
||||||
const std::string retId= "__ui_internal_ret_";
|
const std::string retId= "__ui_internal_ret_";
|
||||||
CLuaStackChecker lsc(&ls);
|
CLuaStackChecker lsc(&ls);
|
||||||
|
ls.pushGlobalTable();
|
||||||
ls.push(retId);
|
ls.push(retId);
|
||||||
ls.pushNil();
|
ls.pushNil();
|
||||||
ls.setTable(LUA_GLOBALSINDEX);
|
ls.setTable(-3); //pop pop
|
||||||
|
ls.pop();
|
||||||
|
|
||||||
|
|
||||||
// *** execute script
|
// *** execute script
|
||||||
|
@ -201,8 +203,10 @@ static DECLARE_INTERFACE_USER_FCT(lua)
|
||||||
|
|
||||||
|
|
||||||
// *** retrieve and convert return value
|
// *** retrieve and convert return value
|
||||||
|
ls.pushGlobalTable();
|
||||||
ls.push(retId);
|
ls.push(retId);
|
||||||
ls.getTable(LUA_GLOBALSINDEX);
|
ls.getTable(-2);
|
||||||
|
ls.remove(-2);
|
||||||
bool ok= false;
|
bool ok= false;
|
||||||
sint type= ls.type();
|
sint type= ls.type();
|
||||||
if (type==LUA_TBOOLEAN)
|
if (type==LUA_TBOOLEAN)
|
||||||
|
@ -370,7 +374,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions( NLGUI::CLuaState &ls )
|
||||||
ls.registerFunc("SNode", CUICtor::SNode);
|
ls.registerFunc("SNode", CUICtor::SNode);
|
||||||
|
|
||||||
// *** Register the metatable for access to client.cfg (nb nico this may be more general later -> access to any config file ...)
|
// *** Register the metatable for access to client.cfg (nb nico this may be more general later -> access to any config file ...)
|
||||||
ls.pushValue(LUA_GLOBALSINDEX);
|
ls.pushGlobalTable();
|
||||||
CLuaObject globals(ls);
|
CLuaObject globals(ls);
|
||||||
CLuaObject clientCfg = globals.newTable("config");
|
CLuaObject clientCfg = globals.newTable("config");
|
||||||
CLuaObject mt = globals.newTable("__cfmt");
|
CLuaObject mt = globals.newTable("__cfmt");
|
||||||
|
|
|
@ -558,7 +558,8 @@ void CPeopleInterraction::createTeamList()
|
||||||
{
|
{
|
||||||
CInterfaceLink *il = new CInterfaceLink;
|
CInterfaceLink *il = new CInterfaceLink;
|
||||||
vector<CInterfaceLink::CTargetInfo> targets;
|
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();
|
CSkillManager *pSM= CSkillManager::getInstance();
|
||||||
pBM->removeBrickLearnedCallback(&_ProgressionUpdate);
|
pBM->removeBrickLearnedCallback(&_ProgressionUpdate);
|
||||||
pSM->removeSkillChangeCallback(&_ProgressionUpdate);
|
pSM->removeSkillChangeCallback(&_ProgressionUpdate);
|
||||||
|
|
||||||
|
_TotalMalusEquipLeaf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -1122,7 +1124,9 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase,
|
||||||
// **** Compute Phrase Elements from phrase
|
// **** Compute Phrase Elements from phrase
|
||||||
// get the current action malus (0-100)
|
// get the current action malus (0-100)
|
||||||
uint32 totalActionMalus= 0;
|
uint32 totalActionMalus= 0;
|
||||||
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
|
CCDBNodeLeaf *actMalus = _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
|
// root brick must not be Power or aura, because Action malus don't apply to them
|
||||||
// (ie leave 0 ActionMalus for Aura or Powers
|
// (ie leave 0 ActionMalus for Aura or Powers
|
||||||
if(actMalus && !rootBrick->isSpecialPower())
|
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)
|
else if(propId==CSBrickManager::getInstance()->StaPropId && brick->Properties[j].PropId==CSBrickManager::getInstance()->StaWeightFactorId)
|
||||||
{
|
{
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
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"));
|
CDBCtrlSheet *ctrlSheet = dynamic_cast<CDBCtrlSheet *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:gestionsets:hands:handr"));
|
||||||
if (ctrlSheet)
|
if (ctrlSheet)
|
||||||
{
|
{
|
||||||
|
@ -4501,7 +4506,8 @@ uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||||
CSBrickManager *pBM= CSBrickManager::getInstance();
|
CSBrickManager *pBM= CSBrickManager::getInstance();
|
||||||
uint32 totalActionMalus= 0;
|
uint32 totalActionMalus= 0;
|
||||||
CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false);
|
CCDBNodeLeaf *actMalus = _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
|
// root brick must not be Power or aura, because Action malus don't apply to them
|
||||||
// (ie leave 0 ActionMalus for Aura or Powers
|
// (ie leave 0 ActionMalus for Aura or Powers
|
||||||
if (!phrase.Bricks.empty())
|
if (!phrase.Bricks.empty())
|
||||||
|
|
|
@ -651,6 +651,10 @@ private:
|
||||||
void computePhraseProgression();
|
void computePhraseProgression();
|
||||||
void insertProgressionSkillRecurs(SKILLS::ESkills skill, uint32 value, sint *skillReqLevel, std::vector<SKILLS::ESkills> &skillsToInsert);
|
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
|
/// return the skill of the root
|
||||||
|
|
|
@ -382,6 +382,9 @@ CGameContextMenu GameContextMenu;
|
||||||
NLMISC::CValueSmoother smoothFPS;
|
NLMISC::CValueSmoother smoothFPS;
|
||||||
NLMISC::CValueSmoother moreSmoothFPS(64);
|
NLMISC::CValueSmoother moreSmoothFPS(64);
|
||||||
|
|
||||||
|
static CRefPtr<CCDBNodeLeaf> s_FpsLeaf;
|
||||||
|
static CRefPtr<CCDBNodeLeaf> s_UiDirectionLeaf;
|
||||||
|
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
/*
|
/*
|
||||||
|
@ -2296,7 +2299,8 @@ bool mainLoop()
|
||||||
deltaTime = smoothFPS.getSmoothValue ();
|
deltaTime = smoothFPS.getSmoothValue ();
|
||||||
if (deltaTime > 0.0)
|
if (deltaTime > 0.0)
|
||||||
{
|
{
|
||||||
CCDBNodeLeaf*pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS");
|
CCDBNodeLeaf *pNL = s_FpsLeaf ? &*s_FpsLeaf
|
||||||
|
: &*(s_FpsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS"));
|
||||||
pNL->setValue64((sint64)(1.f/deltaTime));
|
pNL->setValue64((sint64)(1.f/deltaTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2801,8 +2805,10 @@ bool mainLoop()
|
||||||
H_AUTO_USE ( RZ_Client_Main_Loop_Net )
|
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.
|
// Put here things you have to send to the server only once per tick like user position.
|
||||||
// UPDATE COMPASS
|
// UPDATE COMPASS
|
||||||
|
NLMISC::CCDBNodeLeaf *node = s_UiDirectionLeaf ? (&*s_UiDirectionLeaf)
|
||||||
|
: &*(s_UiDirectionLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DIRECTION"));
|
||||||
CInterfaceProperty prop;
|
CInterfaceProperty prop;
|
||||||
prop.readDouble("UI:VARIABLES:DIRECTION"," ");
|
prop.setNodePtr(node);
|
||||||
if(CompassMode == 1)
|
if(CompassMode == 1)
|
||||||
{
|
{
|
||||||
double camDir = atan2(View.view().y, View.view().x);
|
double camDir = atan2(View.view().y, View.view().x);
|
||||||
|
@ -3235,7 +3241,7 @@ class CHandlerDebugUiDumpElementUnderMouse : public IActionHandler
|
||||||
if (!lua) return;
|
if (!lua) return;
|
||||||
CLuaStackRestorer lsr(lua, 0);
|
CLuaStackRestorer lsr(lua, 0);
|
||||||
CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI);
|
CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI);
|
||||||
lua->pushValue(LUA_GLOBALSINDEX);
|
lua->pushGlobalTable();
|
||||||
CLuaObject env(*lua);
|
CLuaObject env(*lua);
|
||||||
env["inspect"].callNoThrow(1, 0);
|
env["inspect"].callNoThrow(1, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,9 @@ void CUserControls::update()
|
||||||
// update camera collision once per frame
|
// update camera collision once per frame
|
||||||
View.updateCameraCollision();
|
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 //
|
}// update //
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
// Std.
|
// Std.
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace NLMISC {
|
||||||
|
class CCDBNodeLeaf;
|
||||||
|
}
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// CLASS //
|
// CLASS //
|
||||||
|
@ -305,6 +308,8 @@ private:
|
||||||
|
|
||||||
/// when true the next forward action will cancel any moveto
|
/// when true the next forward action will cancel any moveto
|
||||||
bool _NextForwardCancelMoveTo;
|
bool _NextForwardCancelMoveTo;
|
||||||
|
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _UiVarMkMoveDB;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// User Controls (mouse, keyboard, interfaces, ...)
|
/// User Controls (mouse, keyboard, interfaces, ...)
|
||||||
|
|
|
@ -3861,22 +3861,28 @@ bool CNetManager::update()
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
if (im)
|
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)
|
if (node)
|
||||||
node->setValue32(getPing());
|
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)
|
if (node)
|
||||||
node->setValue32((sint32)(getMeanUpload()*1024.f/8.f));
|
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)
|
if (node)
|
||||||
node->setValue32((sint32)(getMeanDownload()*1024.f/8.f));
|
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)
|
if (node)
|
||||||
node->setValue32((sint32)getMeanPacketLoss());
|
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)
|
if (node)
|
||||||
node->setValue32((sint32)getConnectionState());
|
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)
|
if (node)
|
||||||
node->setValue32((sint32)getConnectionQuality());
|
node->setValue32((sint32)getConnectionQuality());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ void initializeNetwork();
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class CBitMemStream;
|
class CBitMemStream;
|
||||||
|
class CCDBNodeLeaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,6 +127,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool _IsReplayStarting;
|
bool _IsReplayStarting;
|
||||||
#endif
|
#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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ CComLuaModule::CComLuaModule(CDynamicMapClient* client, lua_State *luaState /*=
|
||||||
#ifdef LUA_NEVRAX_VERSION
|
#ifdef LUA_NEVRAX_VERSION
|
||||||
_LuaState = lua_open(NULL, NULL);
|
_LuaState = lua_open(NULL, NULL);
|
||||||
#else
|
#else
|
||||||
_LuaState = lua_open();
|
_LuaState = luaL_newstate();
|
||||||
#endif
|
#endif
|
||||||
_LuaOwnerShip = false;
|
_LuaOwnerShip = false;
|
||||||
luaopen_base(_LuaState);
|
luaopen_base(_LuaState);
|
||||||
|
@ -105,7 +105,7 @@ CComLuaModule::CComLuaModule(CDynamicMapClient* client, lua_State *luaState /*=
|
||||||
void CComLuaModule::initLuaLib()
|
void CComLuaModule::initLuaLib()
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CComLuaModule_initLuaLib)
|
//H_AUTO(R2_CComLuaModule_initLuaLib)
|
||||||
const luaL_reg methods[] =
|
const luaL_Reg methods[] =
|
||||||
{
|
{
|
||||||
{"updateScenario", CComLuaModule::luaUpdateScenario},
|
{"updateScenario", CComLuaModule::luaUpdateScenario},
|
||||||
{"requestUpdateRtScenario", CComLuaModule::luaRequestUpdateRtScenario},
|
{"requestUpdateRtScenario", CComLuaModule::luaRequestUpdateRtScenario},
|
||||||
|
@ -237,7 +237,12 @@ void CComLuaModule::initLuaLib()
|
||||||
|
|
||||||
};
|
};
|
||||||
int initialStackSize = lua_gettop(_LuaState);
|
int initialStackSize = lua_gettop(_LuaState);
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
luaL_newlib(_LuaState, methods);
|
||||||
|
lua_setglobal(_LuaState, R2_LUA_PATH);
|
||||||
|
#else
|
||||||
luaL_openlib(_LuaState, R2_LUA_PATH, methods, 0);
|
luaL_openlib(_LuaState, R2_LUA_PATH, methods, 0);
|
||||||
|
#endif
|
||||||
lua_settop(_LuaState, initialStackSize);
|
lua_settop(_LuaState, initialStackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,7 +1051,11 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
|
||||||
{
|
{
|
||||||
int initialStackSize = lua_gettop(state);
|
int initialStackSize = lua_gettop(state);
|
||||||
|
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
lua_pushglobaltable(state); // _G
|
||||||
|
#else
|
||||||
lua_pushvalue(state, LUA_GLOBALSINDEX); // _G
|
lua_pushvalue(state, LUA_GLOBALSINDEX); // _G
|
||||||
|
#endif
|
||||||
|
|
||||||
lua_pushstring(state, "r2"); // _G, "r2"
|
lua_pushstring(state, "r2"); // _G, "r2"
|
||||||
lua_gettable(state, -2); // G, r2
|
lua_gettable(state, -2); // G, r2
|
||||||
|
@ -1106,6 +1115,8 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// okay!
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1128,6 +1139,7 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1147,8 +1159,11 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
|
||||||
{
|
{
|
||||||
if (lua_getmetatable(state, -1))
|
if (lua_getmetatable(state, -1))
|
||||||
{
|
{
|
||||||
|
#if LUA_VERSION_NUM >= 502
|
||||||
|
lua_pushglobaltable(state); // obj, mt, _G
|
||||||
|
#else
|
||||||
lua_pushvalue(state, LUA_GLOBALSINDEX); // obj, mt, _G
|
lua_pushvalue(state, LUA_GLOBALSINDEX); // obj, mt, _G
|
||||||
|
#endif
|
||||||
|
|
||||||
lua_pushstring(state, "r2"); // obj, mt, _G, "r2"
|
lua_pushstring(state, "r2"); // obj, mt, _G, "r2"
|
||||||
|
|
||||||
|
|
|
@ -2613,7 +2613,7 @@ void CEditor::init(TMode initialMode, TAccessMode accessMode)
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
CLuaStackChecker lsc(&getLua());
|
CLuaStackChecker lsc(&getLua());
|
||||||
getLua().pushValue(LUA_GLOBALSINDEX);
|
getLua().pushGlobalTable();
|
||||||
_Globals.pop(getLua());
|
_Globals.pop(getLua());
|
||||||
getLua().pushValue(LUA_REGISTRYINDEX);
|
getLua().pushValue(LUA_REGISTRYINDEX);
|
||||||
_Registry.pop(getLua());
|
_Registry.pop(getLua());
|
||||||
|
@ -3956,9 +3956,11 @@ void CEditor::release()
|
||||||
// clear the environment
|
// clear the environment
|
||||||
if (CLuaManager::getInstance().getLuaState())
|
if (CLuaManager::getInstance().getLuaState())
|
||||||
{
|
{
|
||||||
|
getLua().pushGlobalTable();
|
||||||
getLua().push(R2_LUA_PATH);
|
getLua().push(R2_LUA_PATH);
|
||||||
getLua().pushNil();
|
getLua().pushNil();
|
||||||
getLua().setTable(LUA_GLOBALSINDEX);
|
getLua().setTable(-3); // pop pop
|
||||||
|
getLua().pop();
|
||||||
_Globals.release();
|
_Globals.release();
|
||||||
_Registry.release();
|
_Registry.release();
|
||||||
_ObjectProjectionMetatable.release(); // AJM
|
_ObjectProjectionMetatable.release(); // AJM
|
||||||
|
|
|
@ -55,6 +55,7 @@ const uint32 DEFAULT_ENTITY_MIN_OPACITY = 128;
|
||||||
|
|
||||||
|
|
||||||
bool CTool::_MouseCaptured = false;
|
bool CTool::_MouseCaptured = false;
|
||||||
|
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> CTool::_UserCharFade;
|
||||||
|
|
||||||
static const CVector cardinals[] =
|
static const CVector cardinals[] =
|
||||||
{
|
{
|
||||||
|
@ -551,7 +552,8 @@ void CTool::handleMouseOverPlayer(bool over)
|
||||||
{
|
{
|
||||||
//H_AUTO(R2_CTool_handleMouseOverPlayer)
|
//H_AUTO(R2_CTool_handleMouseOverPlayer)
|
||||||
// If the mouse is over the player make the player transparent
|
// 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 ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable())
|
||||||
{
|
{
|
||||||
// If the nearest entity is the player, hide!
|
// If the nearest entity is the player, hide!
|
||||||
|
|
|
@ -284,6 +284,7 @@ private:
|
||||||
sint64 _AutoPanDelay;
|
sint64 _AutoPanDelay;
|
||||||
sint64 _NumPans;
|
sint64 _NumPans;
|
||||||
static bool _MouseCaptured;
|
static bool _MouseCaptured;
|
||||||
|
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _UserCharFade;
|
||||||
private:
|
private:
|
||||||
/** compute the nearest valid surface at a given position from the island heightmap
|
/** compute the nearest valid surface at a given position from the island heightmap
|
||||||
* (heightmap must not be empty or an assertion is raised)
|
* (heightmap must not be empty or an assertion is raised)
|
||||||
|
|
|
@ -51,7 +51,7 @@ void CSessionBrowserImpl::init(CLuaState *ls)
|
||||||
{
|
{
|
||||||
nlassert(ls);
|
nlassert(ls);
|
||||||
_Lua = ls;
|
_Lua = ls;
|
||||||
_Lua->pushValue(LUA_GLOBALSINDEX);
|
_Lua->pushGlobalTable();
|
||||||
CLuaObject game(*_Lua);
|
CLuaObject game(*_Lua);
|
||||||
game = game["game"];
|
game = game["game"];
|
||||||
game.setValue("getRingSessionList", luaGetRingSessionList);
|
game.setValue("getRingSessionList", luaGetRingSessionList);
|
||||||
|
@ -759,7 +759,7 @@ void CSessionBrowserImpl::callRingAccessPointMethod(const char *name, int numArg
|
||||||
nlassert(name);
|
nlassert(name);
|
||||||
{
|
{
|
||||||
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
||||||
_Lua->pushValue(LUA_GLOBALSINDEX);
|
_Lua->pushGlobalTable();
|
||||||
CLuaObject rap(*_Lua);
|
CLuaObject rap(*_Lua);
|
||||||
rap = rap["RingAccessPoint"];
|
rap = rap["RingAccessPoint"];
|
||||||
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
||||||
|
@ -774,7 +774,7 @@ void CSessionBrowserImpl::callRingCharTrackingMethod(const char *name, int numAr
|
||||||
nlassert(name);
|
nlassert(name);
|
||||||
{
|
{
|
||||||
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
||||||
_Lua->pushValue(LUA_GLOBALSINDEX);
|
_Lua->pushGlobalTable();
|
||||||
CLuaObject rap(*_Lua);
|
CLuaObject rap(*_Lua);
|
||||||
rap = rap["CharTracking"];
|
rap = rap["CharTracking"];
|
||||||
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
||||||
|
@ -789,7 +789,7 @@ void CSessionBrowserImpl::callRingPlayerInfoMethod(const char *name, int numArg,
|
||||||
nlassert(name);
|
nlassert(name);
|
||||||
{
|
{
|
||||||
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
||||||
_Lua->pushValue(LUA_GLOBALSINDEX);
|
_Lua->pushGlobalTable();
|
||||||
CLuaObject rap(*_Lua);
|
CLuaObject rap(*_Lua);
|
||||||
rap = rap["RingPlayerInfo"];
|
rap = rap["RingPlayerInfo"];
|
||||||
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
||||||
|
@ -804,7 +804,7 @@ void CSessionBrowserImpl::callScenarioScoresMethod(const char *name, int numArg,
|
||||||
nlassert(name);
|
nlassert(name);
|
||||||
{
|
{
|
||||||
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
|
||||||
_Lua->pushValue(LUA_GLOBALSINDEX);
|
_Lua->pushGlobalTable();
|
||||||
CLuaObject rap(*_Lua);
|
CLuaObject rap(*_Lua);
|
||||||
rap = rap["ScenarioScores"];
|
rap = rap["ScenarioScores"];
|
||||||
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
rap.callMethodByNameNoThrow(name, numArg, numResult);
|
||||||
|
|
|
@ -194,10 +194,13 @@ bool ServerDrivenWeather = false;
|
||||||
|
|
||||||
const float WEATHER_BLEND_SPEED = 1.f / 8.f; // number of seconds to blend betwen weather states
|
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()
|
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;
|
if (!node) return 0;
|
||||||
return (uint16) node->getValue16();
|
return (uint16) node->getValue16();
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,10 @@ static char rz_sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93";
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#define RZ__PASSWORD_EFMT1 '-'
|
#define RZ__PASSWORD_EFMT1 '-'
|
||||||
|
|
||||||
|
#if DEBUG_CRYPT
|
||||||
|
void prtab(char *s, unsigned char *t, int num_rows);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UNIX password, and DES, encryption.
|
* UNIX password, and DES, encryption.
|
||||||
* By Tom Truscott, trt@rti.rti.org,
|
* By Tom Truscott, trt@rti.rti.org,
|
||||||
|
@ -785,7 +789,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) {
|
||||||
}
|
}
|
||||||
perm[i] = (unsigned char) k;
|
perm[i] = (unsigned char) k;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_CRYPT
|
||||||
prtab("pc1tab", perm, 8);
|
prtab("pc1tab", perm, 8);
|
||||||
#endif
|
#endif
|
||||||
rz_init_perm(PC1ROT, perm, 8, 8);
|
rz_init_perm(PC1ROT, perm, 8, 8);
|
||||||
|
@ -809,7 +813,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) {
|
||||||
if ((k%28) <= j) k -= 28;
|
if ((k%28) <= j) k -= 28;
|
||||||
perm[i] = pc2inv[k];
|
perm[i] = pc2inv[k];
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_CRYPT
|
||||||
prtab("pc2tab", perm, 8);
|
prtab("pc2tab", perm, 8);
|
||||||
#endif
|
#endif
|
||||||
rz_init_perm(PC2ROT[j], perm, 8, 8);
|
rz_init_perm(PC2ROT[j], perm, 8, 8);
|
||||||
|
@ -833,7 +837,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) {
|
||||||
perm[i*8+j] = (unsigned char) k;
|
perm[i*8+j] = (unsigned char) k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_CRYPT
|
||||||
prtab("ietab", perm, 8);
|
prtab("ietab", perm, 8);
|
||||||
#endif
|
#endif
|
||||||
rz_init_perm(IE3264, perm, 4, 8);
|
rz_init_perm(IE3264, perm, 4, 8);
|
||||||
|
@ -850,7 +854,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) {
|
||||||
}
|
}
|
||||||
perm[k-1] = i+1;
|
perm[k-1] = i+1;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_CRYPT
|
||||||
prtab("cftab", perm, 8);
|
prtab("cftab", perm, 8);
|
||||||
#endif
|
#endif
|
||||||
rz_init_perm(CF6464, perm, 8, 8);
|
rz_init_perm(CF6464, perm, 8, 8);
|
||||||
|
@ -959,12 +963,8 @@ int rz_encrypt(register char *block, int flag) {
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_CRYPT
|
||||||
STATIC
|
void prtab(char *s, unsigned char *t, int num_rows)
|
||||||
prtab(s, t, num_rows)
|
|
||||||
char *s;
|
|
||||||
unsigned char *t;
|
|
||||||
int num_rows;
|
|
||||||
{
|
{
|
||||||
register int i, j;
|
register int i, j;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
|
|
||||||
# Supporting modules and libraries.
|
# Supporting modules and libraries.
|
||||||
ADD_SUBDIRECTORY(admin_modules)
|
# Need servershare for build packed collision tool
|
||||||
|
# Need aishare for build wmap tool
|
||||||
ADD_SUBDIRECTORY(server_share)
|
ADD_SUBDIRECTORY(server_share)
|
||||||
ADD_SUBDIRECTORY(ai_share)
|
ADD_SUBDIRECTORY(ai_share)
|
||||||
|
|
||||||
|
IF(WITH_RYZOM_SERVER)
|
||||||
|
|
||||||
|
# Supporting modules and libraries.
|
||||||
|
ADD_SUBDIRECTORY(admin_modules)
|
||||||
ADD_SUBDIRECTORY(gameplay_module_lib)
|
ADD_SUBDIRECTORY(gameplay_module_lib)
|
||||||
ADD_SUBDIRECTORY(pd_lib)
|
ADD_SUBDIRECTORY(pd_lib)
|
||||||
|
|
||||||
|
@ -40,3 +47,5 @@ ADD_SUBDIRECTORY(general_utilities_service)
|
||||||
#sabrina
|
#sabrina
|
||||||
#simulation_service
|
#simulation_service
|
||||||
#testing_tool_service
|
#testing_tool_service
|
||||||
|
|
||||||
|
ENDIF(WITH_RYZOM_SERVER)
|
||||||
|
|
|
@ -9,15 +9,13 @@ ADD_SUBDIRECTORY(leveldesign)
|
||||||
ADD_SUBDIRECTORY(patch_gen)
|
ADD_SUBDIRECTORY(patch_gen)
|
||||||
ADD_SUBDIRECTORY(pdr_util)
|
ADD_SUBDIRECTORY(pdr_util)
|
||||||
ADD_SUBDIRECTORY(stats_scan)
|
ADD_SUBDIRECTORY(stats_scan)
|
||||||
|
ADD_SUBDIRECTORY(sheets_packer)
|
||||||
|
|
||||||
IF(WITH_RYZOM_CLIENT)
|
IF(WITH_RYZOM_CLIENT)
|
||||||
ADD_SUBDIRECTORY(sheets_packer)
|
|
||||||
ADD_SUBDIRECTORY(client)
|
ADD_SUBDIRECTORY(client)
|
||||||
ENDIF(WITH_RYZOM_CLIENT)
|
ENDIF(WITH_RYZOM_CLIENT)
|
||||||
|
|
||||||
IF(WITH_RYZOM_SERVER)
|
|
||||||
ADD_SUBDIRECTORY(server)
|
ADD_SUBDIRECTORY(server)
|
||||||
ENDIF(WITH_RYZOM_SERVER)
|
|
||||||
|
|
||||||
# Old stuff that doesn't compile anymore.
|
# Old stuff that doesn't compile anymore.
|
||||||
#ADD_SUBDIRECTORY(occ2huff)
|
#ADD_SUBDIRECTORY(occ2huff)
|
||||||
|
|
|
@ -206,6 +206,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -210,6 +210,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -218,6 +218,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
|
@ -203,6 +203,7 @@ ZoneExportDirectory = CommonPath + "/zone"
|
||||||
|
|
||||||
# PACS primitives directories
|
# PACS primitives directories
|
||||||
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
PacsPrimExportDirectory = CommonPath + "/pacs_prim"
|
||||||
|
PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag"
|
||||||
|
|
||||||
|
|
||||||
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE ***
|
||||||
|
|
120
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php
Normal file
120
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Assigned{
|
||||||
|
|
||||||
|
private $user;
|
||||||
|
private $ticket;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//Assigns a ticket to a user or returns error message
|
||||||
|
public static function assignTicket( $user_id, $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if ticket is already assigned, if so return "ALREADY ASSIGNED"
|
||||||
|
if(! Assigned::isAssigned($ticket_id)){
|
||||||
|
$assignation = new Assigned();
|
||||||
|
$assignation->set(array('User' => $user_id, 'Ticket' => $ticket_id));
|
||||||
|
$assignation->create();
|
||||||
|
return "SUCCESS_ASSIGNED";
|
||||||
|
}else{
|
||||||
|
return "ALREADY_ASSIGNED";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Unsign a ticket to a user or returns error message
|
||||||
|
public static function unAssignTicket( $user_id, $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if ticket is really assigned to that user
|
||||||
|
if( Assigned::isAssigned($ticket_id, $user_id)){
|
||||||
|
$assignation = new Assigned();
|
||||||
|
$assignation->set(array('User' => $user_id, 'Ticket' => $ticket_id));
|
||||||
|
$assignation->delete();
|
||||||
|
return "SUCCESS_UNASSIGNED";
|
||||||
|
}else{
|
||||||
|
return "NOT_ASSIGNED";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the id of the user assigned to a ticket
|
||||||
|
public static function getUserAssignedToTicket($ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT ticket_user.ExternId FROM `assigned` JOIN `ticket_user` ON assigned.User = ticket_user.TUserId WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id));
|
||||||
|
$user_id = $statement->fetch();
|
||||||
|
return $user_id['ExternId'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isAssigned( $ticket_id, $user_id = 0) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if ticket is already assigned
|
||||||
|
|
||||||
|
if($user_id == 0 && $dbl->execute(" SELECT * FROM `assigned` WHERE `Ticket` = :ticket_id", array('ticket_id' => $ticket_id) )->rowCount() ){
|
||||||
|
return true;
|
||||||
|
}else if( $dbl->execute(" SELECT * FROM `assigned` WHERE `Ticket` = :ticket_id and `User` = :user_id", array('ticket_id' => $ticket_id, 'user_id' => $user_id) )->rowCount()){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//set values
|
||||||
|
public function set($values) {
|
||||||
|
$this->setUser($values['User']);
|
||||||
|
$this->setTicket($values['Ticket']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "INSERT INTO `assigned` (`User`,`Ticket`) VALUES (:user, :ticket)";
|
||||||
|
$values = Array('user' => $this->getUser(), 'ticket' => $this->getTicket());
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete entry
|
||||||
|
public function delete() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "DELETE FROM `assigned` WHERE `User` = :user_id and `Ticket` = :ticket_id";
|
||||||
|
$values = array('user_id' => $this->getUser() ,'ticket_id' => $this->getTicket());
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Load with sGroupId
|
||||||
|
public function load( $user_id, $user_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM `assigned` WHERE `Ticket` = :ticket_id AND `User` = :user_id", Array('ticket_id' => $ticket_id, 'user_id' => $user_id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->set($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getUser(){
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicket(){
|
||||||
|
return $this->ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setUser($u){
|
||||||
|
$this->user = $u;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTicket($g){
|
||||||
|
$this->ticket = $g;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -5,53 +5,39 @@ class DBLayer{
|
||||||
|
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
try{
|
global $cfg;
|
||||||
$dsn = "mysql:";
|
$dsn = "mysql:";
|
||||||
$dsn .= "host=". $db['host'].";";
|
$dsn .= "host=". $cfg['db'][$db]['host'].";";
|
||||||
$dsn .= "dbname=". $db['name'].";";
|
$dsn .= "dbname=". $cfg['db'][$db]['name'].";";
|
||||||
$dsn .= "port=". $db['port'].";";
|
$dsn .= "port=". $cfg['db'][$db]['port'].";";
|
||||||
|
|
||||||
$opt = array(
|
$opt = array(
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
|
||||||
);
|
);
|
||||||
$this->PDO = new PDO($dsn,$db['user'],$db['pass'], $opt);
|
$this->PDO = new PDO($dsn,$cfg['db'][$db]['user'],$cfg['db'][$db]['pass'], $opt);
|
||||||
}catch (PDOException $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function executeWithoutParams($query){
|
public function executeWithoutParams($query){
|
||||||
try{
|
|
||||||
$statement = $this->PDO->prepare($query);
|
$statement = $this->PDO->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
return $statement;
|
return $statement;
|
||||||
}catch (PDOException $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute($query,$params){
|
public function execute($query,$params){
|
||||||
try{
|
|
||||||
$statement = $this->PDO->prepare($query);
|
$statement = $this->PDO->prepare($query);
|
||||||
$statement->execute($params);
|
$statement->execute($params);
|
||||||
return $statement;
|
return $statement;
|
||||||
}catch (PDOException $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function executeReturnId($query,$params){
|
public function executeReturnId($query,$params){
|
||||||
try{
|
|
||||||
$statement = $this->PDO->prepare($query);
|
$statement = $this->PDO->prepare($query);
|
||||||
$this->PDO->beginTransaction();
|
$this->PDO->beginTransaction();
|
||||||
$statement->execute($params);
|
$statement->execute($params);
|
||||||
$lastId =$this->PDO->lastInsertId();
|
$lastId =$this->PDO->lastInsertId();
|
||||||
$this->PDO->commit();
|
$this->PDO->commit();
|
||||||
return $lastId;
|
return $lastId;
|
||||||
}catch (PDOException $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Forwarded{
|
||||||
|
|
||||||
|
private $group;
|
||||||
|
private $ticket;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//AForward a ticket to a group, also removes the previous group where it was assigned to.
|
||||||
|
public static function forwardTicket( $group_id, $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
if (forwarded::isForwarded($ticket_id)){
|
||||||
|
$forw = new Forwarded();
|
||||||
|
$forw->load($ticket_id);
|
||||||
|
$forw->delete();
|
||||||
|
}
|
||||||
|
$forward = new Forwarded();
|
||||||
|
$forward->set(array('Group' => $group_id, 'Ticket' => $ticket_id));
|
||||||
|
$forward->create();
|
||||||
|
return "SUCCESS_FORWARDED";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSGroupOfTicket($ticket_id) {
|
||||||
|
$forw = new self();
|
||||||
|
$forw->load($ticket_id);
|
||||||
|
return $forw->getGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function isForwarded( $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
if( $dbl->execute(" SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", array('ticket_id' => $ticket_id))->rowCount()){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//set values
|
||||||
|
public function set($values) {
|
||||||
|
$this->setGroup($values['Group']);
|
||||||
|
$this->setTicket($values['Ticket']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "INSERT INTO `forwarded` (`Group`,`Ticket`) VALUES (:group, :ticket)";
|
||||||
|
$values = Array('group' => $this->getGroup(), 'ticket' => $this->getTicket());
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete entry
|
||||||
|
public function delete() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "DELETE FROM `forwarded` WHERE `Group` = :group_id and `Ticket` = :ticket_id";
|
||||||
|
$values = array('group_id' => $this->getGroup() ,'ticket_id' => $this->getTicket());
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Load with sGroupId
|
||||||
|
public function load( $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->set($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getGroup(){
|
||||||
|
return $this->group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicket(){
|
||||||
|
return $this->ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setGroup($g){
|
||||||
|
$this->group = $g;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTicket($t){
|
||||||
|
$this->ticket = $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Gui_Elements{
|
||||||
|
|
||||||
|
public static function make_table( $inputList, $funcArray ,$fieldArray){
|
||||||
|
$i = 0;
|
||||||
|
$result = Array();
|
||||||
|
foreach($inputList as $element){
|
||||||
|
$j = 0;
|
||||||
|
foreach($funcArray as $function){
|
||||||
|
$fnames = explode('->', $function);
|
||||||
|
$intermediate_result = NULL;
|
||||||
|
foreach($fnames as $fname) {
|
||||||
|
if(substr($fname, -2) == "()") {
|
||||||
|
$fname = substr($fname, 0, strlen($fname)-2);
|
||||||
|
if($intermediate_result == NULL) {
|
||||||
|
$intermediate_result = $element->$fname();
|
||||||
|
} else {
|
||||||
|
$intermediate_result = $intermediate_result->$fname();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($intermediate_result == NULL) {
|
||||||
|
$intermediate_result = $element->$fname();
|
||||||
|
} else {
|
||||||
|
$intermediate_result = $intermediate_result->$fname();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result[$i][$fieldArray[$j]] = $intermediate_result;
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function make_table_with_key_is_id( $inputList, $funcArray, $idFunction){
|
||||||
|
$result = Array();
|
||||||
|
foreach($inputList as $element){
|
||||||
|
foreach($funcArray as $function){
|
||||||
|
$result[$element->$idFunction()] = $element->$function();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function time_elapsed_string($ptime){
|
||||||
|
global $TIME_FORMAT;
|
||||||
|
$ptime = DateTime::createFromFormat($TIME_FORMAT, $ptime)->getTimestamp();
|
||||||
|
|
||||||
|
$etime = time() - $ptime;
|
||||||
|
|
||||||
|
if ($etime < 1)
|
||||||
|
{
|
||||||
|
return '0 seconds';
|
||||||
|
}
|
||||||
|
|
||||||
|
$a = array( 12 * 30 * 24 * 60 * 60 => 'year',
|
||||||
|
30 * 24 * 60 * 60 => 'month',
|
||||||
|
24 * 60 * 60 => 'day',
|
||||||
|
60 * 60 => 'hour',
|
||||||
|
60 => 'minute',
|
||||||
|
1 => 'second'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($a as $secs => $str)
|
||||||
|
{
|
||||||
|
$d = $etime / $secs;
|
||||||
|
if ($d >= 1)
|
||||||
|
{
|
||||||
|
$r = round($d);
|
||||||
|
return $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ class Helpers{
|
||||||
global $AMS_LIB;
|
global $AMS_LIB;
|
||||||
global $SITEBASE;
|
global $SITEBASE;
|
||||||
global $AMS_TRANS;
|
global $AMS_TRANS;
|
||||||
|
global $INGAME_LAYOUT;
|
||||||
require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
|
require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ class Helpers{
|
||||||
if ( helpers::check_if_game_client() or $forcelibrender = false ){
|
if ( helpers::check_if_game_client() or $forcelibrender = false ){
|
||||||
$smarty -> template_dir = $AMS_LIB . '/ingame_templates/';
|
$smarty -> template_dir = $AMS_LIB . '/ingame_templates/';
|
||||||
$smarty -> setConfigDir( $AMS_LIB . '/configs' );
|
$smarty -> setConfigDir( $AMS_LIB . '/configs' );
|
||||||
|
$variables = parse_ini_file( $AMS_LIB . '/configs/ingame_layout.ini', true );
|
||||||
|
foreach ( $variables[$INGAME_LAYOUT] as $key => $value ){
|
||||||
|
$smarty -> assign( $key, $value );
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$smarty -> template_dir = $SITEBASE . '/templates/';
|
$smarty -> template_dir = $SITEBASE . '/templates/';
|
||||||
$smarty -> setConfigDir( $SITEBASE . '/configs' );
|
$smarty -> setConfigDir( $SITEBASE . '/configs' );
|
||||||
|
@ -29,36 +34,16 @@ class Helpers{
|
||||||
$smarty -> assign( $key, $value );
|
$smarty -> assign( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
global $DEFAULT_LANGUAGE;
|
|
||||||
//if language get param is given = set cookie
|
|
||||||
//else if no get param is given and a cookie is set, use that language, else use default.
|
|
||||||
if ( isset( $_GET['language'] ) ) {
|
|
||||||
//check if the language is supported
|
|
||||||
if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){
|
|
||||||
//if it's supported, set cookie!
|
|
||||||
setcookie( 'language',$_GET['language'], time() + 60*60*24*30 );
|
|
||||||
$language = $_GET['language'];
|
|
||||||
}else{
|
|
||||||
//the language is not supported, use the default.
|
|
||||||
$language = $DEFAULT_LANGUAGE;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//if no get param is given, check if a cookie value for language is set
|
|
||||||
if ( isset( $_COOKIE['language'] ) ) {
|
|
||||||
$language = $_COOKIE['language'];
|
|
||||||
}
|
|
||||||
//else use the default
|
|
||||||
else{
|
|
||||||
$language = $DEFAULT_LANGUAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$variables = parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true );
|
$variables = Helpers::handle_language();
|
||||||
foreach ( $variables[$template] as $key => $value ){
|
foreach ( $variables[$template] as $key => $value ){
|
||||||
$smarty -> assign( $key, $value );
|
$smarty -> assign( $key, $value );
|
||||||
}
|
}
|
||||||
if( isset($vars['permission']) && $vars['permission'] == 2 ){
|
|
||||||
|
if( isset($vars['permission']) && $vars['permission'] == 3 ){
|
||||||
$inherited = "extends:layout_admin.tpl|";
|
$inherited = "extends:layout_admin.tpl|";
|
||||||
|
}else if( isset($vars['permission']) && $vars['permission'] == 2){
|
||||||
|
$inherited = "extends:layout_mod.tpl|";
|
||||||
}else if( isset($vars['permission']) && $vars['permission'] == 1){
|
}else if( isset($vars['permission']) && $vars['permission'] == 1){
|
||||||
$inherited = "extends:layout_user.tpl|";
|
$inherited = "extends:layout_user.tpl|";
|
||||||
}else{
|
}else{
|
||||||
|
@ -91,11 +76,68 @@ class Helpers{
|
||||||
static public function check_if_game_client()
|
static public function check_if_game_client()
|
||||||
{
|
{
|
||||||
// if HTTP_USER_AGENT is not set then its ryzom core
|
// if HTTP_USER_AGENT is not set then its ryzom core
|
||||||
if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
|
if ( strpos($_SERVER['HTTP_USER_AGENT'],"Ryzom") === 0){
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public function handle_language(){
|
||||||
|
global $DEFAULT_LANGUAGE;
|
||||||
|
global $AMS_TRANS;
|
||||||
|
|
||||||
|
//if language get param is given = set cookie
|
||||||
|
//else if no get param is given and a cookie is set, use that language, else use default.
|
||||||
|
if ( isset( $_GET['language'] ) ) {
|
||||||
|
//check if the language is supported
|
||||||
|
if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){
|
||||||
|
//if it's supported, set cookie!
|
||||||
|
setcookie( 'language',$_GET['language'], time() + 60*60*24*30 );
|
||||||
|
$language = $_GET['language'];
|
||||||
|
}else{
|
||||||
|
//the language is not supported, use the default.
|
||||||
|
$language = $DEFAULT_LANGUAGE;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//if no get param is given, check if a cookie value for language is set
|
||||||
|
if ( isset( $_COOKIE['language'] ) ) {
|
||||||
|
$language = $_COOKIE['language'];
|
||||||
|
}
|
||||||
|
//else use the default
|
||||||
|
else{
|
||||||
|
$language = $DEFAULT_LANGUAGE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Time output function for handling the time display function.
|
||||||
|
static public function outputTime($time){
|
||||||
|
global $TIME_FORMAT;
|
||||||
|
return date($TIME_FORMAT,strtotime($time));
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function check_login_ingame(){
|
||||||
|
if ( helpers :: check_if_game_client () or $forcelibrender = false ){
|
||||||
|
$dbr = new DBLayer("ring");
|
||||||
|
if (isset($_GET['UserId']) && isset($_COOKIE['ryzomId'])){
|
||||||
|
$id = $_GET['UserId'];
|
||||||
|
$statement = $dbr->execute("SELECT * FROM ring_users WHERE user_id=:id AND cookie =:cookie", array('id' => $id, 'cookie' => $_COOKIE['ryzomId']));
|
||||||
|
if ($statement->rowCount() ){
|
||||||
|
$entry = $statement->fetch();
|
||||||
|
//print_r($entry);
|
||||||
|
return array('id' => $entry['user_id'], 'name' => $entry['user_name']);
|
||||||
|
}else{
|
||||||
|
return "FALSE";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return "FALSE";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return "FALSE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class In_Support_Group{
|
||||||
|
|
||||||
|
private $user;
|
||||||
|
private $group;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//check if user is in in_support_group
|
||||||
|
public static function userExistsInSGroup( $user_id, $group_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if name is already used
|
||||||
|
if( $dbl->execute(" SELECT * FROM `in_support_group` WHERE `User` = :user_id and `Group` = :group_id ", array('user_id' => $user_id, 'group_id' => $group_id) )->rowCount() ){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//set values
|
||||||
|
public function set($values) {
|
||||||
|
$this->setUser($values['User']);
|
||||||
|
$this->setGroup($values['Group']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "INSERT INTO `in_support_group` (`User`,`Group`) VALUES (:user, :group)";
|
||||||
|
$values = Array('user' => $this->user, 'group' => $this->group);
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete entry
|
||||||
|
public function delete() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "DELETE FROM `in_support_group` WHERE `User` = :user_id and `Group` = :group_id";
|
||||||
|
$values = array('user_id' => $this->getUser() ,'group_id' => $this->getGroup());
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Load with sGroupId
|
||||||
|
public function load( $user_id, $group_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM `in_support_group` WHERE `Group` = :group_id", Array('group_id' => $group_id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->set($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getUser(){
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGroup(){
|
||||||
|
return $this->group;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setUser($u){
|
||||||
|
$this->user = $u;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setGroup($g){
|
||||||
|
$this->group = $g;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,378 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Mail_Handler{
|
||||||
|
|
||||||
|
private $db;
|
||||||
|
|
||||||
|
public function mail_fork() {
|
||||||
|
//Start a new child process and return the process id!
|
||||||
|
$pid = pcntl_fork();
|
||||||
|
return $pid;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function send_ticketing_mail($ticketObj, $content, $type, $author) {
|
||||||
|
global $TICKET_MAILING_SUPPORT;
|
||||||
|
if($TICKET_MAILING_SUPPORT){
|
||||||
|
$txt = "";
|
||||||
|
$subject = "";
|
||||||
|
if($type == "REPLY"){
|
||||||
|
$txt = "---------- Ticket #". $ticketObj->getTId() . " ----------\n You received a new reply on your ticket: " . $ticketObj->getTitle() .
|
||||||
|
"\n --------------------\n\n";
|
||||||
|
$subject = "New reply on [Ticket #" . $ticketObj->getTId() ."]";
|
||||||
|
$endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!";
|
||||||
|
$txt = $txt . $content . $endTxt;
|
||||||
|
self::send_mail($ticketObj->getAuthor(),$subject,$txt, $ticketObj->getTId(),$author);
|
||||||
|
}else if($type == "NEW"){
|
||||||
|
$txt = "---------- Ticket #". $ticketObj->getTId() . " ----------\n Your ticket: " . $ticketObj->getTitle() . " is newly created";
|
||||||
|
if($ticketObj->getAuthor() != $author){
|
||||||
|
$txt = $txt . " by " . Ticket_User::get_username_from_id($author);
|
||||||
|
}else{
|
||||||
|
$author = $ticketObj->getAuthor();
|
||||||
|
}
|
||||||
|
$txt = $txt . "\n --------------------\n\n";
|
||||||
|
$subject = "New ticket created [Ticket #" . $ticketObj->getTId() ."]";
|
||||||
|
$endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!";
|
||||||
|
$txt = $txt . $content . $endTxt;
|
||||||
|
self::send_mail($ticketObj->getAuthor(),$subject,$txt, $ticketObj->getTId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function send_mail($recipient, $subject, $body, $ticket_id = 0, $from = 1) {
|
||||||
|
if(is_numeric($recipient)) {
|
||||||
|
$id_user = $recipient;
|
||||||
|
$recipient = NULL;
|
||||||
|
}
|
||||||
|
$query = "INSERT INTO email (Recipient,Subject,Body,Status,Attempts,Sender,UserId,MessageId,TicketId) VALUES (:recipient, :subject, :body, :status, :attempts, :sender, :id_user, :messageId, :ticketId)";
|
||||||
|
$values = array('recipient' => $recipient, 'subject' => $subject, 'body' => $body, 'status' => 'NEW', 'attempts'=> 0, 'sender' => $from,'id_user' => $id_user, 'messageId' => 0, 'ticketId'=> $ticket_id);
|
||||||
|
$db = new DBLayer("lib");
|
||||||
|
$db->execute($query, $values);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//the main function
|
||||||
|
function cron() {
|
||||||
|
global $cfg;
|
||||||
|
$inbox_username = $cfg['mail']['username'];
|
||||||
|
$inbox_password = $cfg['mail']['password'];
|
||||||
|
$inbox_host = $cfg['mail']['host'];
|
||||||
|
$oms_reply_to = "Ryzom Ticketing Support <ticketing@".$inbox_host.">";
|
||||||
|
global $MAIL_DIR;
|
||||||
|
|
||||||
|
// Deliver new mail
|
||||||
|
echo("mail cron\n");
|
||||||
|
|
||||||
|
//creates child process
|
||||||
|
$pid = self::mail_fork();
|
||||||
|
$pidfile = '/tmp/ams_cron_email_pid';
|
||||||
|
|
||||||
|
//INFO: if $pid =
|
||||||
|
//-1: "Could not fork!\n";
|
||||||
|
// 0: "In child!\n";
|
||||||
|
//>0: "In parent!\n";
|
||||||
|
|
||||||
|
if($pid) {
|
||||||
|
|
||||||
|
// We're the parent process, do nothing!
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//make db connection here because the children have to make the connection.
|
||||||
|
$this->db = new DBLayer("lib");
|
||||||
|
|
||||||
|
//if $pidfile doesn't exist yet, then start sending the mails that are in the db.
|
||||||
|
if(!file_exists($pidfile)) {
|
||||||
|
//create the file and write the child processes id in it!
|
||||||
|
$pid = getmypid();
|
||||||
|
$file = fopen($pidfile, 'w');
|
||||||
|
fwrite($file, $pid);
|
||||||
|
fclose($file);
|
||||||
|
|
||||||
|
//select all new & failed emails & try to send them
|
||||||
|
//$emails = db_query("select * from email where status = 'NEW' or status = 'FAILED'");
|
||||||
|
$statement = $this->db->executeWithoutParams("select * from email where Status = 'NEW' or Status = 'FAILED'");
|
||||||
|
$emails = $statement->fetchAll();
|
||||||
|
|
||||||
|
foreach($emails as $email) {
|
||||||
|
$message_id = self::new_message_id($email['TicketId']);
|
||||||
|
|
||||||
|
//if recipient isn't given, then use the email of the id_user instead!
|
||||||
|
echo("Emailing {$email['Recipient']}\n");
|
||||||
|
if(!$email['Recipient']) {
|
||||||
|
$email['Recipient'] = Ticket_User::get_email_by_user_id($email['UserId']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//create sending email adres based on the $sender id
|
||||||
|
if($email['Sender'] != 0) {
|
||||||
|
$username = Ticket_User::get_username_from_id($email['Sender']);
|
||||||
|
$from = "$username <$username@$inbox_host>";
|
||||||
|
} else {
|
||||||
|
$from = $oms_reply_to;
|
||||||
|
}
|
||||||
|
$headers = "From: $from\r\n" . "Message-ID: " . $message_id ;
|
||||||
|
print("recip: " . $email['Recipient']);
|
||||||
|
print("subj: " .$email['Subject']);
|
||||||
|
print("body: " . $email['Body']);
|
||||||
|
print("headers: " . $headers);
|
||||||
|
if(mail($email['Recipient'], $email['Subject'], $email['Body'], $headers)) {
|
||||||
|
$status = "DELIVERED";
|
||||||
|
echo("Emailed {$email['Recipient']}\n");
|
||||||
|
} else {
|
||||||
|
$status = "FAILED";
|
||||||
|
echo("Email to {$email['Recipient']} failed\n");
|
||||||
|
}
|
||||||
|
//change the status of the emails.
|
||||||
|
$this->db->execute('update email set Status = ?, MessageId = ?, Attempts = Attempts + 1 where MailId = ?', array($status, $message_id, $email['MailId']));
|
||||||
|
//db_exec('update email set status = ?, message_id = ?, attempts = attempts + 1 where id_email = ?', array($status, $message_id, $email['id_email']));
|
||||||
|
}
|
||||||
|
unlink($pidfile);
|
||||||
|
}
|
||||||
|
// Check mail
|
||||||
|
|
||||||
|
//$mailbox = imap_open("{localhost:110/pop3/novalidate-cert}INBOX", $inbox_username, $inbox_password);
|
||||||
|
$mbox = imap_open($cfg['mail']['server'], $inbox_username, $inbox_password) or die('Cannot connect to mail server: ' . imap_last_error());
|
||||||
|
$message_count = imap_num_msg($mbox);
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $message_count; ++$i) {
|
||||||
|
|
||||||
|
//return task ID
|
||||||
|
self::incoming_mail_handler($mbox, $i);
|
||||||
|
$tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from);
|
||||||
|
|
||||||
|
if($tid) {
|
||||||
|
//TODO: base file on Ticket + reply id
|
||||||
|
/* $file = fopen($MAIL_DIR."/mail/".$tid, 'w');
|
||||||
|
fwrite($file, $entire_email);
|
||||||
|
fclose($file); */
|
||||||
|
}
|
||||||
|
//mark message $i of $mbox for deletion!
|
||||||
|
imap_delete($mbox, $i);
|
||||||
|
}
|
||||||
|
//delete marked messages
|
||||||
|
imap_expunge($mbox);
|
||||||
|
imap_close($mbox);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function new_message_id($ticketId) {
|
||||||
|
$time = time();
|
||||||
|
$pid = getmypid();
|
||||||
|
global $cfg;
|
||||||
|
global $ams_mail_count;
|
||||||
|
$ams_mail_count = ($ams_mail_count == '') ? 1 : $ams_mail_count + 1;
|
||||||
|
return "<ams.message".".".$ticketId.".".$pid.$ams_mail_count.".".$time."@".$cfg['mail']['host'].">";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_ticket_id_from_subject($subject){
|
||||||
|
$startpos = strpos($subject, "[Ticket #");
|
||||||
|
$tempString = substr($subject, $startpos+9);
|
||||||
|
$endpos = strpos($tempString, "]");
|
||||||
|
$ticket_id = substr($tempString, 0, $endpos);
|
||||||
|
return $ticket_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function incoming_mail_handler($mbox,$i){
|
||||||
|
|
||||||
|
$header = imap_header($mbox, $i);
|
||||||
|
$subject = self::decode_utf8($header->subject);
|
||||||
|
|
||||||
|
print_r($header);
|
||||||
|
|
||||||
|
//get ticket_id out of the message-id or else out of the subject line
|
||||||
|
$ticket_id = 0;
|
||||||
|
if(isset($header->references)){
|
||||||
|
$pieces = explode(".", $header->references);
|
||||||
|
if($pieces[0] == "<ams"){
|
||||||
|
$ticket_id = $pieces[2];
|
||||||
|
}else{
|
||||||
|
$ticket_id = self::get_ticket_id_from_subject($subject);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$ticket_id = self::get_ticket_id_from_subject($subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ticket id is found
|
||||||
|
if($ticket_id){
|
||||||
|
|
||||||
|
$entire_email = imap_fetchheader($mbox, $i) . imap_body($mbox, $i);
|
||||||
|
$subject = self::decode_utf8($header->subject);
|
||||||
|
$to = $header->to[0]->mailbox;
|
||||||
|
$from = $header->from[0]->mailbox . '@' . $header->from[0]->host;
|
||||||
|
$txt = self::get_part($mbox, $i, "TEXT/PLAIN");
|
||||||
|
//$html = self::get_part($mbox, $i, "TEXT/HTML");
|
||||||
|
|
||||||
|
//use the line ---------- Ticket # to make a distincton between the old message and the reply
|
||||||
|
$endpos = strpos($txt, ">---------- Ticket #");
|
||||||
|
if($endpos){
|
||||||
|
$txt = substr($txt, 0, $endpos);
|
||||||
|
}else{
|
||||||
|
$endpos = strpos($txt, "---------- Ticket #");
|
||||||
|
if($endpos){
|
||||||
|
$txt = substr($txt, 0, $endpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//get the id out of the email address of the person sending the email.
|
||||||
|
if($from !== NULL && !is_numeric($from)) $from = Ticket_User::get_id_from_email($from);
|
||||||
|
|
||||||
|
$user = new Ticket_User();
|
||||||
|
$user->load_With_TUserId($from);
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($ticket_id);
|
||||||
|
|
||||||
|
//if user has access to it!
|
||||||
|
if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){
|
||||||
|
Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*function ams_create_email($from, $subject, $body, $html, $recipient = 0, $sender = NULL) {
|
||||||
|
|
||||||
|
//TODO:
|
||||||
|
if($recipient == 0 && !is_string($recipient)) {
|
||||||
|
global $user;
|
||||||
|
$recipient = $user->uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($sender !== NULL && !is_numeric($sender)) $sender = self::get_id_from_username($sender);
|
||||||
|
if(!is_numeric($recipient)) $recipient = self::get_id_from_username($recipient);
|
||||||
|
|
||||||
|
$message = array(
|
||||||
|
'creator' => $sender,
|
||||||
|
'owner' => $recipient,
|
||||||
|
'type' => 'email',
|
||||||
|
'summary' => $subject,
|
||||||
|
'data' => array (
|
||||||
|
'subject' => $subject,
|
||||||
|
'body' => $body,
|
||||||
|
'html' => $html,
|
||||||
|
'sender' => oms_get_username_from_id($sender),
|
||||||
|
'from' => $from,
|
||||||
|
'recipient' => oms_get_username_from_id($recipient),
|
||||||
|
'time' => time(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
//TO ASK:
|
||||||
|
oms_task_create($message);
|
||||||
|
oms_task_index($message, array('subject', 'body', 'sender', 'recipient'));
|
||||||
|
//---------------------------
|
||||||
|
return $message['id_task'];
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*function oms_get_email($id) {
|
||||||
|
|
||||||
|
$message = oms_task_load($id);
|
||||||
|
if($message) {
|
||||||
|
oms_prepare_email($message);
|
||||||
|
return $message;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*function oms_prepare_email(&$message) {
|
||||||
|
|
||||||
|
$data = $message['data'];
|
||||||
|
$data['id_message'] = $message['id_task'];
|
||||||
|
$data['read'] = ($message['status'] != 'NEW' && $message['status'] != 'UNREAD');
|
||||||
|
$message = $data;
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*function oms_email_mark_read($mid) {
|
||||||
|
|
||||||
|
db_exec("update task set status = 'READ' where id_task = ? and type = 'email' and module = 'email'", array($mid));
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function decode_utf8($str) {
|
||||||
|
|
||||||
|
preg_match_all("/=\?UTF-8\?B\?([^\?]+)\?=/i",$str, $arr);
|
||||||
|
for ($i=0;$i<count($arr[1]);$i++){
|
||||||
|
$str=ereg_replace(ereg_replace("\?","\?",
|
||||||
|
$arr[0][$i]),base64_decode($arr[1][$i]),$str);
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_mime_type(&$structure) {
|
||||||
|
|
||||||
|
$primary_mime_type = array("TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER");
|
||||||
|
if($structure->subtype) {
|
||||||
|
return $primary_mime_type[(int) $structure->type] . '/' .$structure->subtype;
|
||||||
|
}
|
||||||
|
return "TEXT/PLAIN";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) {
|
||||||
|
|
||||||
|
if(!$structure) {
|
||||||
|
$structure = imap_fetchstructure($stream, $msg_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($structure) {
|
||||||
|
if($mime_type == self::get_mime_type($structure)) {
|
||||||
|
if(!$part_number) {
|
||||||
|
$part_number = "1";
|
||||||
|
}
|
||||||
|
$text = imap_fetchbody($stream, $msg_number, $part_number);
|
||||||
|
if($structure->encoding == 3) {
|
||||||
|
return imap_base64($text);
|
||||||
|
} else if($structure->encoding == 4) {
|
||||||
|
return imap_qprint($text);
|
||||||
|
} else {
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($structure->type == 1) /* multipart */ {
|
||||||
|
while(list($index, $sub_structure) = each($structure->parts)) {
|
||||||
|
if($part_number) {
|
||||||
|
$prefix = $part_number . '.';
|
||||||
|
} else {
|
||||||
|
$prefix = '';
|
||||||
|
}
|
||||||
|
$data = self::get_part($stream, $msg_number, $mime_type, $sub_structure,$prefix . ($index + 1));
|
||||||
|
if($data) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
} // END OF WHILE
|
||||||
|
} // END OF MULTIPART
|
||||||
|
} // END OF STRUTURE
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} // END OF FUNCTION
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Pagination{
|
||||||
|
|
||||||
|
private $element_array;
|
||||||
|
private $last;
|
||||||
|
private $current;
|
||||||
|
private $amountOfRows;
|
||||||
|
|
||||||
|
function __construct($query, $db, $nrDisplayed, $resultClass, $params = array()) {
|
||||||
|
if (!(isset($_GET['pagenum']))){
|
||||||
|
$this->current= 1;
|
||||||
|
}else{
|
||||||
|
$this->current= $_GET['pagenum'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Here we count the number of results
|
||||||
|
$db = new DBLayer($db);
|
||||||
|
$rows = $db->execute($query, $params)->rowCount();
|
||||||
|
$this->amountOfRows = $rows;
|
||||||
|
//the array hat will contain all users
|
||||||
|
|
||||||
|
if($rows > 0){
|
||||||
|
//This is the number of results displayed per page
|
||||||
|
$page_rows = $nrDisplayed;
|
||||||
|
|
||||||
|
//This tells us the page number of our last page
|
||||||
|
$this->last = ceil($rows/$page_rows);
|
||||||
|
|
||||||
|
//this makes sure the page number isn't below one, or more than our maximum pages
|
||||||
|
if ($this->current< 1)
|
||||||
|
{
|
||||||
|
$this->current= 1;
|
||||||
|
}else if ($this->current> $this->last) {
|
||||||
|
$this->current= $this->last;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This sets the range to display in our query
|
||||||
|
$max = 'limit ' .($this->current- 1) * $page_rows .',' .$page_rows;
|
||||||
|
|
||||||
|
//This is your query again, the same one... the only difference is we add $max into it
|
||||||
|
$data = $db->execute($query . " " . $max, $params);
|
||||||
|
|
||||||
|
$this->element_array = Array();
|
||||||
|
//This is where we put the results in a resultArray to be sent to smarty
|
||||||
|
while($row = $data->fetch(PDO::FETCH_ASSOC)){
|
||||||
|
$element = new $resultClass();
|
||||||
|
$element->set($row);
|
||||||
|
$this->element_array[] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getLast(){
|
||||||
|
return $this->last;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrent(){
|
||||||
|
return $this->current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getElements(){
|
||||||
|
return $this->element_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAmountOfRows(){
|
||||||
|
return $this->amountOfRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLinks($nrOfLinks){
|
||||||
|
$pageLinks = Array();
|
||||||
|
//if amount of showable links is greater than the amount of pages: show all!
|
||||||
|
if ($this->last <= $nrOfLinks){
|
||||||
|
for($var = 1; $var <= $this->last; $var++){
|
||||||
|
$pageLinks[] = $var;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$offset = ($nrOfLinks-1)/2 ;
|
||||||
|
$startpoint = $this->current - $offset;
|
||||||
|
$endpoint = $this->current + $offset;
|
||||||
|
|
||||||
|
if($startpoint < 1){
|
||||||
|
$startpoint = 1;
|
||||||
|
$endpoint = $startpoint + $nrOfLinks - 1;
|
||||||
|
}else if($endpoint > $this->last){
|
||||||
|
$endpoint = $this->last;
|
||||||
|
$startpoint = $endpoint - ($nrOfLinks -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for($var = $startpoint; $var <= $endpoint; $var++){
|
||||||
|
$pageLinks[] = $var;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $pageLinks;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Querycache{
|
||||||
|
|
||||||
|
private $SID;
|
||||||
|
private $type;
|
||||||
|
private $query;
|
||||||
|
private $db;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//set values
|
||||||
|
public function set($values) {
|
||||||
|
$this->setSID($values['SID']);
|
||||||
|
$this->setType($values['type']);
|
||||||
|
$this->setQuery($values['query']);
|
||||||
|
$this->setDb($values['db']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return constructed element based on SID
|
||||||
|
public function load_With_SID( $id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM ams_querycache WHERE SID=:id", array('id' => $id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->set($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update private data to DB.
|
||||||
|
public function update(){
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "UPDATE ams_querycache SET type= :t, query = :q, db = :d WHERE SID=:id";
|
||||||
|
$values = Array('id' => $this->getSID(), 't' => $this->getType(), 'q' => $this->getQuery(), 'd' => $this->getDb());
|
||||||
|
$statement = $dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getSID(){
|
||||||
|
return $this->SID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getType(){
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getQuery(){
|
||||||
|
return $this->query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDb(){
|
||||||
|
return $this->db;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setSID($s){
|
||||||
|
$this->SID = $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setType($t){
|
||||||
|
$this->type = $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setQuery($q){
|
||||||
|
$this->query= $q;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDb($d){
|
||||||
|
$this->db= $d;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
class Sql{
|
|
||||||
|
|
||||||
public function db_query( $query, $values = array() )
|
|
||||||
{
|
|
||||||
echo "tst";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,265 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Support_Group{
|
||||||
|
|
||||||
|
private $sGroupId;
|
||||||
|
private $name;
|
||||||
|
private $tag;
|
||||||
|
|
||||||
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//return all groups
|
||||||
|
public static function getGroup($id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM support_group WHERE SGroupId = :id", array('id' => $id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$instanceGroup = new self();
|
||||||
|
$instanceGroup->set($row);
|
||||||
|
return $instanceGroup;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//return all groups
|
||||||
|
public static function getGroups() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT * FROM support_group ORDER BY Name ASC");
|
||||||
|
$rows = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($rows as $group){
|
||||||
|
|
||||||
|
$instanceGroup = new self();
|
||||||
|
$instanceGroup->set($group);
|
||||||
|
$result[] = $instanceGroup;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//wrapper for creating a support group
|
||||||
|
public static function createSupportGroup( $name, $tag) {
|
||||||
|
|
||||||
|
if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){
|
||||||
|
$notExists = self::supportGroup_EntryNotExists($name, $tag);
|
||||||
|
if ( $notExists == "SUCCESS" ){
|
||||||
|
$sGroup = new self();
|
||||||
|
$sGroup->setName($name);
|
||||||
|
$sGroup->setTag($tag);
|
||||||
|
$sGroup->create();
|
||||||
|
return "SUCCESS";
|
||||||
|
}else{
|
||||||
|
//return NAME_TAKEN or TAG_TAKEN
|
||||||
|
return $notExists;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//RETURN ERROR that indicates SIZE
|
||||||
|
return "SIZE_ERROR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if group exists
|
||||||
|
public static function supportGroup_EntryNotExists( $name, $tag) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if name is already used
|
||||||
|
if( $dbl->execute("SELECT * FROM support_group WHERE Name = :name",array('name' => $name))->rowCount() ){
|
||||||
|
return "NAME_TAKEN";
|
||||||
|
}
|
||||||
|
else if( $dbl->execute("SELECT * FROM support_group WHERE Tag = :tag",array('tag' => $tag))->rowCount() ){
|
||||||
|
return "TAG_TAKEN";
|
||||||
|
}else{
|
||||||
|
return "SUCCESS";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//check if group exists
|
||||||
|
public static function supportGroup_Exists( $id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if supportgroup id exist
|
||||||
|
if( $dbl->execute("SELECT * FROM support_group WHERE SGroupId = :id",array('id' => $id ))->rowCount() ){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return constructed element based on SGroupId
|
||||||
|
public static function constr_SGroupId( $id) {
|
||||||
|
$instance = new self();
|
||||||
|
$instance->setSGroup($id);
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns list of all users that are enlisted to a support group
|
||||||
|
public static function getAllUsersOfSupportGroup($group_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM `in_support_group` INNER JOIN `ticket_user` ON ticket_user.TUserId = in_support_group.User WHERE in_support_group.Group=:id", array('id' => $group_id));
|
||||||
|
$rows = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($rows as $row){
|
||||||
|
$userInstance = new Ticket_User();
|
||||||
|
$userInstance->setTUserId($row['TUserId']);
|
||||||
|
$userInstance->setPermission($row['Permission']);
|
||||||
|
$userInstance->setExternId($row['ExternId']);
|
||||||
|
$result[] = $userInstance;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//wrapper for adding user to a support group
|
||||||
|
public static function deleteSupportGroup($group_id) {
|
||||||
|
|
||||||
|
//check if group id exists
|
||||||
|
if (self::supportGroup_Exists($group_id)){
|
||||||
|
$sGroup = new self();
|
||||||
|
$sGroup->setSGroupId($group_id);
|
||||||
|
$sGroup->delete();
|
||||||
|
}else{
|
||||||
|
//return that group doesn't exist
|
||||||
|
return "GROUP_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//wrapper for adding user to a support group
|
||||||
|
public static function deleteUserOfSupportGroup( $user_id, $group_id) {
|
||||||
|
|
||||||
|
//check if group id exists
|
||||||
|
if (self::supportGroup_Exists($group_id)){
|
||||||
|
|
||||||
|
//check if user is in supportgroup
|
||||||
|
//if so, delete entry and return SUCCESS
|
||||||
|
if(In_Support_Group::userExistsInSGroup($user_id, $group_id) ){
|
||||||
|
//delete entry
|
||||||
|
$inSGroup = new In_Support_Group();
|
||||||
|
$inSGroup->setUser($user_id);
|
||||||
|
$inSGroup->setGroup($group_id);
|
||||||
|
$inSGroup->delete();
|
||||||
|
return "SUCCESS";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//else return USER_NOT_IN_GROUP
|
||||||
|
return "USER_NOT_IN_GROUP";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//return that group doesn't exist
|
||||||
|
return "GROUP_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//wrapper for adding user to a support group
|
||||||
|
public static function addUserToSupportGroup( $user_id, $group_id) {
|
||||||
|
//check if group id exists
|
||||||
|
if (self::supportGroup_Exists($group_id)){
|
||||||
|
//check if user isn't in supportgroup yet
|
||||||
|
//if not, create entry and return SUCCESS
|
||||||
|
if(! In_Support_Group::userExistsInSGroup($user_id, $group_id) ){
|
||||||
|
//create entry
|
||||||
|
$inSGroup = new In_Support_Group();
|
||||||
|
$inSGroup->setUser($user_id);
|
||||||
|
$inSGroup->setGroup($group_id);
|
||||||
|
$inSGroup->create();
|
||||||
|
return "SUCCESS";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//else return ALREADY_ADDED
|
||||||
|
return "ALREADY_ADDED";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//return that group doesn't exist
|
||||||
|
return "GROUP_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns list of all category objects
|
||||||
|
public static function getAllSupportGroups() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT * FROM `support_group`");
|
||||||
|
$row = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($row as $group){
|
||||||
|
$instance = new self();
|
||||||
|
$instance->set($group);
|
||||||
|
$result[] = $instance;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
//set values
|
||||||
|
public function set($values) {
|
||||||
|
$this->setSGroupId($values['SGroupId']);
|
||||||
|
$this->setName($values['Name']);
|
||||||
|
$this->setTag($values['Tag']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "INSERT INTO support_group (Name, Tag) VALUES (:name, :tag)";
|
||||||
|
$values = Array('name' => $this->name, 'tag' => $this->tag);
|
||||||
|
$dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Load with sGroupId
|
||||||
|
public function load_With_SGroupId( $id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM `support_group` WHERE `SGroupId` = :id", array('id' => $id));
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$this->set($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update private data to DB.
|
||||||
|
public function update(){
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "UPDATE `support_group` SET `Name` = :name, `Tag` = :tag WHERE `SGroupId` = :id";
|
||||||
|
$values = Array('id' => $this->getSGroupId(), 'name' => $this->getName(), 'tag' => $this->getTag() );
|
||||||
|
$statement = $dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete entry
|
||||||
|
public function delete(){
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$query = "DELETE FROM `support_group` WHERE `SGroupId` = :id";
|
||||||
|
$values = Array('id' => $this->getSGroupId());
|
||||||
|
$statement = $dbl->execute($query, $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function getSGroupId(){
|
||||||
|
return $this->sGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(){
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTag(){
|
||||||
|
return $this->tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public function setSGroupId($id){
|
||||||
|
$this->sGroupId = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName($n){
|
||||||
|
$this->name = $n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTag($t){
|
||||||
|
$this->tag = $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -14,39 +14,35 @@ class Sync{
|
||||||
*/
|
*/
|
||||||
static public function syncdata () {
|
static public function syncdata () {
|
||||||
|
|
||||||
global $cfg;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dbl = new DBLayer($cfg['db']['lib']);
|
$dbl = new DBLayer("lib");
|
||||||
$statement = $dbl->executeWithoutParams("SELECT * FROM ams_querycache");
|
$statement = $dbl->executeWithoutParams("SELECT * FROM ams_querycache");
|
||||||
$rows = $statement->fetchAll();
|
$rows = $statement->fetchAll();
|
||||||
$dbs = new DBLayer($cfg['db']['shard']);
|
|
||||||
foreach ($rows as $record) {
|
foreach ($rows as $record) {
|
||||||
|
|
||||||
|
$db = new DBLayer($record['db']);
|
||||||
switch($record['type']) {
|
switch($record['type']) {
|
||||||
case 'createPermissions':
|
case 'createPermissions':
|
||||||
case 'change_pass':
|
case 'change_pass':
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
$values = array('user' => $decode[0], 'pass' => $decode[1]);
|
$values = array('user' => $decode[0], 'pass' => $decode[1]);
|
||||||
//make connection with and put into shard db & delete from the lib
|
//make connection with and put into shard db & delete from the lib
|
||||||
$dbs->execute("SET Password = :pass WHERE Login = :user",$values);
|
$db->execute("UPDATE user SET Password = :pass WHERE Login = :user",$values);
|
||||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
|
||||||
break;
|
break;
|
||||||
case 'change_mail':
|
case 'change_mail':
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
$values = array('user' => $decode[0], 'mail' => $decode[1]);
|
$values = array('user' => $decode[0], 'mail' => $decode[1]);
|
||||||
//make connection with and put into shard db & delete from the lib
|
//make connection with and put into shard db & delete from the lib
|
||||||
$dbs->execute("SET Email = :mail WHERE Login = :user",$values);
|
$db->execute("UPDATE user SET Email = :mail WHERE Login = :user",$values);
|
||||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
|
||||||
break;
|
break;
|
||||||
case 'createUser':
|
case 'createUser':
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
$values = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
|
$values = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
|
||||||
//make connection with and put into shard db & delete from the lib
|
//make connection with and put into shard db & delete from the lib
|
||||||
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$values);
|
$db->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$values);
|
||||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
||||||
}
|
}
|
||||||
print('Syncing completed');
|
print('Syncing completed');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,21 +8,65 @@ class Ticket{
|
||||||
private $queue;
|
private $queue;
|
||||||
private $ticket_category;
|
private $ticket_category;
|
||||||
private $author;
|
private $author;
|
||||||
private $db;
|
private $priority;
|
||||||
|
|
||||||
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*FUNCTION: getTicketTitlesOf()
|
/*FUNCTION: ticketExists
|
||||||
|
* returns true if ticket exists
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function ticketExists($id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
//check if ticket is already assigned
|
||||||
|
if( $dbl->execute(" SELECT * FROM `ticket` WHERE `TId` = :ticket_id", array('ticket_id' => $id) )->rowCount() ){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*FUNCTION: getStatusArray
|
||||||
|
* returns all possible statusses
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getStatusArray() {
|
||||||
|
return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*FUNCTION: getPriorityArray
|
||||||
|
* returns all possible statusses
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getPriorityArray() {
|
||||||
|
return Array("Low","Normal","High","Super Dupa High");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*FUNCTION: getEntireTicket
|
||||||
* return all ticket of the given author's id.
|
* return all ticket of the given author's id.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getTicketsOf($author, $db_data) {
|
public static function getEntireTicket($id,$view_as_admin) {
|
||||||
$dbl = new DBLayer($db_data);
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($id);
|
||||||
|
$reply_array = Ticket_Reply::getRepliesOfTicket($id, $view_as_admin);
|
||||||
|
return Array('ticket_obj' => $ticket,'reply_array' => $reply_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*FUNCTION: getTicketTitlesOf
|
||||||
|
* return all ticket of the given author's id.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getTicketsOf($author) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author));
|
$statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author));
|
||||||
$row = $statement->fetchAll();
|
$row = $statement->fetchAll();
|
||||||
$result = Array();
|
$result = Array();
|
||||||
foreach($row as $ticket){
|
foreach($row as $ticket){
|
||||||
$instance = new self($db_data);
|
$instance = new self();
|
||||||
|
$instance->setTId($ticket['TId']);
|
||||||
$instance->setTimestamp($ticket['Timestamp']);
|
$instance->setTimestamp($ticket['Timestamp']);
|
||||||
$instance->setTitle($ticket['Title']);
|
$instance->setTitle($ticket['Title']);
|
||||||
$instance->setStatus($ticket['Status']);
|
$instance->setStatus($ticket['Status']);
|
||||||
|
@ -39,52 +83,168 @@ class Ticket{
|
||||||
* creates a ticket + first initial reply and fills in the content of it!
|
* creates a ticket + first initial reply and fills in the content of it!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function create_Ticket( $title, $content, $category, $author, $db_data) {
|
public static function create_Ticket( $title, $content, $category, $author, $real_author) {
|
||||||
|
|
||||||
$ticket = new Ticket($db_data);
|
$ticket = new Ticket();
|
||||||
$ticket->set($title,0,0,$category,$author);
|
$values = array("Title" => $title, "Status"=> 1, "Queue"=> 0, "Ticket_Category" => $category, "Author" => $author, "Priority" => 0);
|
||||||
|
$ticket->set($values);
|
||||||
$ticket->create();
|
$ticket->create();
|
||||||
$ticket_id = $ticket->getTId();
|
$ticket_id = $ticket->getTId();
|
||||||
|
|
||||||
|
if ( $author == $real_author){
|
||||||
$ticket_content = new Ticket_Content($db_data);
|
Ticket_Log::createLogEntry( $ticket_id, $author, 1);
|
||||||
$ticket_content->setContent($content);
|
}else{
|
||||||
$ticket_content->create();
|
Ticket_Log::createLogEntry( $ticket_id, $real_author, 2, $author);
|
||||||
$content_id = $ticket_content->getTContentId();
|
}
|
||||||
|
Ticket_Reply::createReply($content, $author, $ticket_id, 0, $author);
|
||||||
|
Mail_Handler::send_ticketing_mail($ticket, $content, "NEW", $real_author);
|
||||||
$ticket_reply = new Ticket_Reply($db_data);
|
return $ticket_id;
|
||||||
$ticket_reply->set($ticket_id, $content_id, $author);
|
|
||||||
$ticket_reply->create();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*FUNCTION: updateTicketStatus()
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function updateTicketStatus( $ticket_id, $newStatus, $author) {
|
||||||
|
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($ticket_id);
|
||||||
|
if ($ticket->getStatus() != $newStatus){
|
||||||
|
$ticket->setStatus($newStatus);
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $author, 5, $newStatus);
|
||||||
|
}
|
||||||
|
$ticket->update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*FUNCTION: updateTicketStatusAndPriority()
|
||||||
|
* creates a ticket + first initial reply and fills in the content of it!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function updateTicketStatusAndPriority( $ticket_id, $newStatus, $newPriority, $author) {
|
||||||
|
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($ticket_id);
|
||||||
|
if ($ticket->getStatus() != $newStatus){
|
||||||
|
$ticket->setStatus($newStatus);
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $author, 5, $newStatus);
|
||||||
|
}
|
||||||
|
if ($ticket->getPriority() != $newPriority){
|
||||||
|
$ticket->setPriority($newPriority);
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $author, 6, $newPriority);
|
||||||
|
}
|
||||||
|
$ticket->update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//return the latest reply.
|
||||||
|
public static function getLatestReply( $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->execute("SELECT * FROM ticket_reply WHERE Ticket =:id ORDER BY TReplyId DESC LIMIT 1 ", array('id' => $ticket_id));
|
||||||
|
$reply = new Ticket_Reply();
|
||||||
|
$reply->set($statement->fetch());
|
||||||
|
return $reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function createReply($content, $author, $ticket_id, $hidden){
|
||||||
|
//if not empty
|
||||||
|
if(! ( Trim ( $content ) === '' )){
|
||||||
|
$content = filter_var($content, FILTER_SANITIZE_STRING);
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($ticket_id);
|
||||||
|
//if status is not closed
|
||||||
|
if($ticket->getStatus() != 3){
|
||||||
|
Ticket_Reply::createReply($content, $author, $ticket_id, $hidden, $ticket->getAuthor());
|
||||||
|
|
||||||
|
//notify ticket author that a new reply is added!
|
||||||
|
if($ticket->getAuthor() != $author){
|
||||||
|
Mail_Handler::send_ticketing_mail($ticket, $content, "REPLY", $author);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//TODO: Show error message that ticket is closed
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//TODO: Show error content is empty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns SUCCESS_ASSIGNED, TICKET_NOT_EXISTING or ALREADY_ASSIGNED
|
||||||
|
public static function assignTicket($user_id, $ticket_id){
|
||||||
|
if(self::ticketExists($ticket_id)){
|
||||||
|
$returnvalue = Assigned::assignTicket($user_id, $ticket_id);
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $user_id, 7);
|
||||||
|
return $returnvalue;
|
||||||
|
}else{
|
||||||
|
return "TICKET_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns SUCCESS_UNASSIGNED, TICKET_NOT_EXISTING or NOT_ASSIGNED
|
||||||
|
public static function unAssignTicket($user_id, $ticket_id){
|
||||||
|
if(self::ticketExists($ticket_id)){
|
||||||
|
$returnvalue = Assigned::unAssignTicket($user_id, $ticket_id);
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $user_id, 9);
|
||||||
|
return $returnvalue;
|
||||||
|
}else{
|
||||||
|
return "TICKET_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function forwardTicket($user_id, $ticket_id, $group_id){
|
||||||
|
if(self::ticketExists($ticket_id)){
|
||||||
|
if(isset($group_id) && $group_id != ""){
|
||||||
|
//unassign the ticket incase the ticket is assined to yourself
|
||||||
|
self::unAssignTicket($user_id, $ticket_id);
|
||||||
|
//forward the ticket
|
||||||
|
$returnvalue = Forwarded::forwardTicket($group_id, $ticket_id);
|
||||||
|
//make a log entry of this action
|
||||||
|
Ticket_Log::createLogEntry( $ticket_id, $user_id, 8, $group_id);
|
||||||
|
return $returnvalue;
|
||||||
|
}else{
|
||||||
|
return "INVALID_SGROUP";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return "TICKET_NOT_EXISTING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
public function __construct($db_data) {
|
public function __construct() {
|
||||||
$this->db = $db_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Set ticket object
|
//Set ticket object
|
||||||
public function set($t,$s,$q,$t_c,$a){
|
public function set($values){
|
||||||
$this->title = $t;
|
if(isset($values['TId'])){
|
||||||
$this->status = $s;
|
$this->tId = $values['TId'];
|
||||||
$this->queue = $q;
|
}
|
||||||
$this->ticket_category = $t_c;
|
$this->title = $values['Title'];
|
||||||
$this->author = $a;
|
$this->status = $values['Status'];
|
||||||
|
$this->queue = $values['Queue'];
|
||||||
|
$this->ticket_category = $values['Ticket_Category'];
|
||||||
|
$this->author = $values['Author'];
|
||||||
|
$this->priority = $values['Priority'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//create ticket by writing private data to DB.
|
//create ticket by writing private data to DB.
|
||||||
public function create(){
|
public function create(){
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer("lib");
|
||||||
$query = "INSERT INTO ticket (Timestamp, Title, Status, Queue, Ticket_Category, Author) VALUES (now(), :title, :status, :queue, :tcat, :author)";
|
$query = "INSERT INTO ticket (Timestamp, Title, Status, Queue, Ticket_Category, Author, Priority) VALUES (now(), :title, :status, :queue, :tcat, :author, :priority)";
|
||||||
$values = Array('title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author);
|
$values = Array('title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author, 'priority' => $this->priority);
|
||||||
$this->tId = $dbl->executeReturnId($query, $values); ;
|
$this->tId = $dbl->executeReturnId($query, $values); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return constructed element based on TId
|
//return constructed element based on TId
|
||||||
public function load_With_TId( $id) {
|
public function load_With_TId( $id) {
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer("lib");
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket WHERE TId=:id", array('id' => $id));
|
$statement = $dbl->execute("SELECT * FROM ticket WHERE TId=:id", array('id' => $id));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$this->tId = $row['TId'];
|
$this->tId = $row['TId'];
|
||||||
|
@ -94,18 +254,24 @@ class Ticket{
|
||||||
$this->queue = $row['Queue'];
|
$this->queue = $row['Queue'];
|
||||||
$this->ticket_category = $row['Ticket_Category'];
|
$this->ticket_category = $row['Ticket_Category'];
|
||||||
$this->author = $row['Author'];
|
$this->author = $row['Author'];
|
||||||
|
$this->priority = $row['Priority'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//update private data to DB.
|
//update private data to DB.
|
||||||
public function update(){
|
public function update(){
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer("lib");
|
||||||
$query = "UPDATE ticket SET Timestamp = :timestamp, Title = :title, Status = :status, Queue = :queue, Ticket_Category = :tcat, Author = :author WHERE TId=:id";
|
$query = "UPDATE ticket SET Timestamp = :timestamp, Title = :title, Status = :status, Queue = :queue, Ticket_Category = :tcat, Author = :author, Priority = :priority WHERE TId=:id";
|
||||||
$values = Array('id' => $this->tId, 'timestamp' => $this->timestamp, 'title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author);
|
$values = Array('id' => $this->tId, 'timestamp' => $this->timestamp, 'title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author, 'priority' => $this->priority);
|
||||||
$statement = $dbl->execute($query, $values);
|
$statement = $dbl->execute($query, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*FUNCTION: postreply
|
||||||
|
* returns all possible statusses
|
||||||
|
*
|
||||||
|
*
|
||||||
|
public function postReply() {
|
||||||
|
return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed");
|
||||||
|
}*/
|
||||||
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getTId(){
|
public function getTId(){
|
||||||
|
@ -113,7 +279,7 @@ class Ticket{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTimestamp(){
|
public function getTimestamp(){
|
||||||
return $this->timestamp;
|
return Helpers::outputTime($this->timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle(){
|
public function getTitle(){
|
||||||
|
@ -124,6 +290,16 @@ class Ticket{
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getStatusText(){
|
||||||
|
$statusArray = Ticket::getStatusArray();
|
||||||
|
return $statusArray[$this->getStatus()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCategoryName(){
|
||||||
|
$category = Ticket_Category::constr_TCategoryId($this->getTicket_Category());
|
||||||
|
return $category->getName();
|
||||||
|
}
|
||||||
|
|
||||||
public function getQueue(){
|
public function getQueue(){
|
||||||
return $this->queue;
|
return $this->queue;
|
||||||
}
|
}
|
||||||
|
@ -136,6 +312,41 @@ class Ticket{
|
||||||
return $this->author;
|
return $this->author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPriority(){
|
||||||
|
return $this->priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriorityText(){
|
||||||
|
$priorityArray = Ticket::getPriorityArray();
|
||||||
|
return $priorityArray[$this->getPriority()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAssigned(){
|
||||||
|
$user_id = Assigned::getUserAssignedToTicket($this->getTId());
|
||||||
|
if ($user_id == ""){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return $user_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getForwardedGroupName(){
|
||||||
|
$group_id = Forwarded::getSGroupOfTicket($this->getTId());
|
||||||
|
if ($group_id == ""){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return Support_Group::getGroup($group_id)->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getForwardedGroupId(){
|
||||||
|
$group_id = Forwarded::getSGroupOfTicket($this->getTId());
|
||||||
|
if ($group_id == ""){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return $group_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function setTId($id){
|
public function setTId($id){
|
||||||
|
@ -166,4 +377,8 @@ class Ticket{
|
||||||
$this->author = $a;
|
$this->author = $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setPriority($p){
|
||||||
|
$this->priority = $p;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue