Merged default

--HG--
branch : gsoc2012-gui-editor
hg/feature/sse2
dfighter1985 12 years ago
commit 307b60f44b

@ -58,6 +58,7 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
PATHS
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib

@ -19,9 +19,9 @@
extern "C"
{
#include <lua/lua.h>
#include <lua/lauxlib.h>
#include <lua/lualib.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
// load the lua dll, return 1 on success

@ -1,3 +1,8 @@
FIND_PACKAGE( Libwww REQUIRED )
FIND_PACKAGE( CURL REQUIRED )
FIND_PACKAGE( Lua51 REQUIRED )
FIND_PACKAGE( Luabind REQUIRED )
FILE(GLOB SRC *.cpp *.h)
FILE(GLOB HEADERS ../../include/nel/gui/*.h)
@ -7,8 +12,22 @@ SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI")
NL_ADD_RUNTIME_FLAGS(nelgui)
INCLUDE_DIRECTORIES( ${LUA_INCLUDE_DIR} )
NL_ADD_LIB_SUFFIX(nelgui)
#MESSAGE( "libww libs: ${LIBWWW_LIBRARIES}" )
TARGET_LINK_LIBRARIES( nelgui
nelmisc
nel3d
${LUA_LIBRARIES}
${LUABIND_LIBRARIES}
${LIBXML2_LIBRARIES}
${LIBWWW_LIBRARIES}
${CURL_LIBRARIES}
)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelgui LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

@ -146,7 +146,7 @@ namespace NLGUI
_ToolTipParent= TTCtrl;
if(prop)
{
_ToolTipParent = stringToToolTipParent( std::string( prop ) );
_ToolTipParent = stringToToolTipParent( std::string( (const char*)prop ) );
}
// Tooltip special parent

@ -282,7 +282,8 @@ namespace NLGUI
else
if( name == "onover" )
{
_AHOnOver = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnOver = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "onover", value );
return;
}
@ -295,7 +296,8 @@ namespace NLGUI
else
if( name == "onclick_l" )
{
_AHOnLeftClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnLeftClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "onclick_l", value );
return;
}
@ -308,7 +310,8 @@ namespace NLGUI
else
if( name == "ondblclick_l" )
{
_AHOnLeftDblClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnLeftDblClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "ondblclick_l", value );
return;
}
@ -321,7 +324,8 @@ namespace NLGUI
else
if( name == "onlongclick_l" )
{
_AHOnLeftLongClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnLeftLongClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "onlongclick_l", value );
return;
}
@ -334,7 +338,8 @@ namespace NLGUI
else
if( name == "onclick_r" )
{
_AHOnRightClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnRightClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "onclick_r", value );
return;
}
@ -347,7 +352,8 @@ namespace NLGUI
else
if( name == "onclock_tick" )
{
_AHOnClockTick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnClockTick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( "onclock_tick", value );
return;
}
@ -543,27 +549,27 @@ namespace NLGUI
{
prop = (char*) xmlGetProp( cur, BAD_CAST "onover" );
if( prop != NULL )
mapAHString( "onover", std::string( prop ) );
mapAHString( "onover", std::string( (const char*)prop ) );
prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_l" );
if( prop != NULL )
mapAHString( "onclick_l", std::string( prop ) );
mapAHString( "onclick_l", std::string( (const char*)prop ) );
prop = (char*) xmlGetProp( cur, BAD_CAST "ondblclick_l" );
if( prop != NULL )
mapAHString( "ondblclick_l", std::string( prop ) );
mapAHString( "ondblclick_l", std::string( (const char*)prop ) );
prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_r" );
if( prop != NULL )
mapAHString( "onclick_r", std::string( prop ) );
mapAHString( "onclick_r", std::string( (const char*)prop ) );
prop = (char*) xmlGetProp( cur, BAD_CAST "onlongclick_l" );
if( prop != NULL )
mapAHString( "onlongclick_l", std::string( prop ) );
mapAHString( "onlongclick_l", std::string( (const char*)prop ) );
prop = (char*) xmlGetProp( cur, BAD_CAST "onclock_tick" );
if( prop != NULL )
mapAHString( "onclock_tick", std::string( prop ) );
mapAHString( "onclock_tick", std::string( (const char*)prop ) );
}
// Context menu association

@ -231,7 +231,7 @@ namespace NLGUI
prop = (char*) xmlGetProp (cur, (xmlChar*)"align");
if (prop)
{
setAlignFromString( std::string( prop ) );
setAlignFromString( std::string( (const char*)prop ) );
}

@ -292,7 +292,8 @@ namespace NLGUI
{
_IsDBLink = true;
_DBLink.link( value.c_str() );
_DBLink.getNodePtr()->addObserver( this, ICDBNode::CTextId() );
ICDBNode::CTextId dummy;
_DBLink.getNodePtr()->addObserver( this, dummy );
}
return;
}

@ -1733,7 +1733,8 @@ namespace NLGUI
else
if( name == "on_open" )
{
_AHOnOpen = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnOpen = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1746,7 +1747,8 @@ namespace NLGUI
else
if( name == "on_close" )
{
_AHOnClose = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnClose = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1759,7 +1761,8 @@ namespace NLGUI
else
if( name == "on_close_button" )
{
_AHOnCloseButton = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnCloseButton = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1772,7 +1775,8 @@ namespace NLGUI
else
if( name == "on_move" )
{
_AHOnMove = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnMove = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1785,7 +1789,8 @@ namespace NLGUI
else
if( name == "on_deactive_check" )
{
_AHOnDeactiveCheck = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnDeactiveCheck = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1798,7 +1803,8 @@ namespace NLGUI
else
if( name == "on_resize" )
{
_AHOnResize = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnResize = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1811,7 +1817,8 @@ namespace NLGUI
else
if( name == "on_alpha_settings_changed" )
{
_AHOnAlphaSettingsChanged = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnAlphaSettingsChanged = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -1824,7 +1831,8 @@ namespace NLGUI
else
if( name == "on_begin_move" )
{
_AHOnBeginMove = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnBeginMove = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -2224,35 +2232,35 @@ namespace NLGUI
{
ptr = xmlGetProp( cur, BAD_CAST "on_open" );
if( ptr != NULL )
mapAHString( "on_open", std::string( ptr ) );
mapAHString( "on_open", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_close" );
if( ptr != NULL )
mapAHString( "on_close", std::string( ptr ) );
mapAHString( "on_close", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_close_button" );
if( ptr != NULL )
mapAHString( "on_close_button", std::string( ptr ) );
mapAHString( "on_close_button", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_move" );
if( ptr != NULL )
mapAHString( "on_move", std::string( ptr ) );
mapAHString( "on_move", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_deactive_check" );
if( ptr != NULL )
mapAHString( "on_deactive_check", std::string( ptr ) );
mapAHString( "on_deactive_check", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_resize" );
if( ptr != NULL )
mapAHString( "on_resize", std::string( ptr ) );
mapAHString( "on_resize", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_alpha_settings_changed" );
if( ptr != NULL )
mapAHString( "on_alpha_settings_changed", std::string( ptr ) );
mapAHString( "on_alpha_settings_changed", std::string( (const char*)ptr ) );
ptr = xmlGetProp( cur, BAD_CAST "on_begin_move" );
if( ptr != NULL )
mapAHString( "on_begin_move", std::string( ptr ) );
mapAHString( "on_begin_move", std::string( (const char*)ptr ) );
}
ptr = xmlGetProp (cur, (xmlChar*)"max_w");

@ -25,6 +25,7 @@
#include "nel/gui/widget_manager.h"
#include "nel/gui/view_renderer.h"
#include "nel/gui/db_manager.h"
#include <limits>
using namespace std;
using namespace NLMISC;
@ -538,7 +539,7 @@ namespace NLGUI
{
prop = (char*) xmlGetProp( cur, BAD_CAST "onenter" );
if( prop != NULL )
mapAHString( "onenter", std::string( prop ) );
mapAHString( "onenter", std::string( (const char*)prop ) );
}
prop = (char*) xmlGetProp( cur, (xmlChar*)"onchange" );

@ -139,7 +139,7 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
if (ptr)
{
_Options = std::string( ptr );
_Options = std::string( (const char*)ptr );
}
// The first type in display type struct is the default display type

@ -507,7 +507,7 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" );
if (ptr)
{
_HardText = std::string( ptr );
_HardText = std::string( (const char*)ptr );
const char *propPtr = ptr;
ucstring Text = ucstring(propPtr);
if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i'))

@ -2180,7 +2180,7 @@ namespace NLGUI
if (prop)
{
if( editorMode )
_Extends = std::string( prop );
_Extends = std::string( (const char*)prop );
CGroupMenu *gm = dynamic_cast<CGroupMenu *>(CWidgetManager::getInstance()->getElementFromId(prop));
if (!gm)

@ -462,7 +462,7 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" );
if (ptr)
{
_HardText = std::string( ptr );
_HardText = std::string( (const char*)ptr );
const char *propPtr = ptr;
ucstring Text = ucstring(propPtr);
if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i'))

@ -61,7 +61,8 @@ namespace NLGUI
{
if( name == "on_wheel_up" )
{
_AHWheelUp = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHWheelUp = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -74,7 +75,8 @@ namespace NLGUI
else
if( name == "on_wheel_down" )
{
_AHWheelDown = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHWheelDown = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -119,11 +121,11 @@ namespace NLGUI
{
CXMLAutoPtr ptr( (char*) xmlGetProp( cur, BAD_CAST "on_wheel_up" ) );
if( ptr != NULL )
mapAHString( "on_wheel_up", std::string( ptr ) );
mapAHString( "on_wheel_up", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "on_wheel_down" );
if( ptr != NULL )
mapAHString( "on_wheel_down", std::string( ptr ) );
mapAHString( "on_wheel_down", std::string( (const char*)ptr ) );
}

@ -362,13 +362,13 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"posparent" );
if (ptr)
{
setPosParent( std::string( ptr ) );
setPosParent( std::string( (const char*)ptr ) );
}
ptr = (char*) xmlGetProp( cur, (xmlChar*)"sizeparent" );
if (ptr)
{
setSizeParent( std::string( ptr ) );
setSizeParent( std::string( (const char*)ptr ) );
}
ptr = (char*) xmlGetProp (cur, (xmlChar*)"sizeref");

@ -348,27 +348,27 @@ namespace NLGUI
{
ptr = (char*) xmlGetProp( cur, BAD_CAST "on_active" );
if( ptr != NULL )
mapAHString( "on_active", std::string( ptr ) );
mapAHString( "on_active", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "on_deactive" );
if( ptr != NULL )
mapAHString( "on_deactive", std::string( ptr ) );
mapAHString( "on_deactive", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_r" );
if( ptr != NULL )
mapAHString( "group_onclick_r", std::string( ptr ) );
mapAHString( "group_onclick_r", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_l" );
if( ptr != NULL )
mapAHString( "group_onclick_l", std::string( ptr ) );
mapAHString( "group_onclick_l", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "on_enter" );
if( ptr != NULL )
mapAHString( "on_enter", std::string( ptr ) );
mapAHString( "on_enter", std::string( (const char*)ptr ) );
ptr = (char*) xmlGetProp( cur, BAD_CAST "on_escape" );
if( ptr != NULL )
mapAHString( "on_escape", std::string( ptr ) );
mapAHString( "on_escape", std::string( (const char*)ptr ) );
}
@ -562,7 +562,8 @@ namespace NLGUI
else
if( name == "on_active" )
{
_AHOnActive = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnActive = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -575,7 +576,8 @@ namespace NLGUI
else
if( name == "on_deactive" )
{
_AHOnDeactive = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnDeactive = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -623,7 +625,8 @@ namespace NLGUI
else
if( name == "group_onclick_r" )
{
_AHOnRightClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnRightClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -636,7 +639,8 @@ namespace NLGUI
else
if( name == "group_onclick_l" )
{
_AHOnLeftClick = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnLeftClick = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -649,7 +653,8 @@ namespace NLGUI
else
if( name == "on_enter" )
{
_AHOnEnter = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnEnter = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}
@ -678,7 +683,8 @@ namespace NLGUI
else
if( name == "on_escape" )
{
_AHOnEscape = CAHManager::getInstance()->getAH( value, std::string() );
std::string dummy;
_AHOnEscape = CAHManager::getInstance()->getAH( value, dummy );
mapAHString( name, value );
return;
}

@ -1000,7 +1000,7 @@ namespace NLGUI
std::string target;
if( ptr != NULL )
{
target = std::string( ptr );
target = std::string( (const char*)ptr );
if( !editorMode )
CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets);
}
@ -1134,17 +1134,17 @@ namespace NLGUI
ptr = xmlGetProp( cur, BAD_CAST "entry" );
if( ptr != NULL )
data.entry = std::string( ptr );
data.entry = std::string( (const char*)ptr );
data.type = type;
ptr = xmlGetProp( cur, BAD_CAST "value" );
if( ptr != NULL )
data.value = std::string( ptr );
data.value = std::string( (const char*)ptr );
ptr = xmlGetProp( cur, BAD_CAST "size" );
if( ptr != NULL )
fromString( std::string( ptr ), data.size );
fromString( std::string( (const char*)ptr ), data.size );
variableCache[ data.entry ] = data;
}

@ -26,6 +26,8 @@
#include "nel/gui/lua_ihm.h"
#include "nel/gui/view_pointer_base.h"
#include <limits>
using namespace std;
using namespace NLMISC;
using namespace NL3D;

@ -427,27 +427,36 @@ void CEntityManager::initialize(uint nbMaxEntity)
_EntityGroundFXHandle.resize(_NbMaxEntity);
}
ICDBNode::CTextId textId;
// Add an observer on the mission database
CInterfaceManager *pIM = CInterfaceManager::getInstance();
uint i,j;
for (i=0; i<MAX_NUM_MISSIONS; i++)
for (j=0; j<MAX_NUM_MISSION_TARGETS; j++)
{
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&MissionTargetObserver, ICDBNode::CTextId( "SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE" ) );
textId = ICDBNode::CTextId( "SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE" );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&MissionTargetObserver, textId );
}
// Add an Observer to the Team database
for (i=0; i<MaxNumPeopleInTeam; i++)
{
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamUIDObserver, ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:UID", i) ) );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamPresentObserver, ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:NAME", i) ));
textId = ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:UID", i) );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamUIDObserver, textId );
textId = ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:NAME", i) );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamPresentObserver, textId );
}
// Add an Observer to the Animal database
for (i=0; i<MAX_INVENTORY_ANIMAL; i++)
{
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalUIDObserver, ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:UID",i) ));
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalStatusObserver, ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS",i) ));
textId = ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:UID",i) );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalUIDObserver, textId );
textId = ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS",i) );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalStatusObserver, textId );
}
}// initialize //

@ -86,12 +86,14 @@ bool CGroupPhraseSkillFilter::parse (xmlNodePtr cur, CInterfaceGroup *parentGrou
// Add observer on each Brick Families because if some brick is learned, a new skill may be displayed
string sTmp;
ICDBNode::CTextId textId;
for (uint k = 0; k < BRICK_FAMILIES::NbFamilies; ++k)
{
_BrickFamilyObs[k].Owner= this;
_BrickFamilyObs[k].BrickFamily= (BRICK_FAMILIES::TBrickFamily)k;
sTmp = string(DB_BRICKS)+":"+NLMISC::toString((sint32)k)+":BRICKS";
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&(_BrickFamilyObs[k]), ICDBNode::CTextId( sTmp ));
textId = ICDBNode::CTextId( sTmp );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&(_BrickFamilyObs[k]), textId );
}
_MustRebuild = true;

@ -86,10 +86,13 @@ bool CGroupSkills::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
_SkillsObs.Owner = this;
string sTmp;
ICDBNode::CTextId textId;
for (uint k = 0; k < SKILLS::NUM_SKILLS; ++k)
{
sTmp = string(DB_SKILLS)+":"+NLMISC::toString((sint32)k)+":BaseSKILL";
NLGUI::CDBManager::getInstance()->getDB()->addObserver (&_SkillsObs, ICDBNode::CTextId( sTmp ));
textId = ICDBNode::CTextId( sTmp );
NLGUI::CDBManager::getInstance()->getDB()->addObserver (&_SkillsObs, textId );
}
_MustRebuild = true;
@ -280,10 +283,12 @@ CGroupSkills::~CGroupSkills()
CInterfaceManager *pIM= CInterfaceManager::getInstance();
string sTmp;
ICDBNode::CTextId textId;
for (uint k = 0; k < SKILLS::NUM_SKILLS; ++k)
{
sTmp = string(DB_SKILLS)+":"+NLMISC::toString((sint32)k)+":BaseSKILL";
NLGUI::CDBManager::getInstance()->getDB()->removeObserver(&_SkillsObs, ICDBNode::CTextId( sTmp ) );
textId = ICDBNode::CTextId( sTmp );
NLGUI::CDBManager::getInstance()->getDB()->removeObserver(&_SkillsObs, textId );
}
// first remove any nodes from the tree group

@ -3520,12 +3520,16 @@ void CInterfaceManager::CServerToLocalAutoCopy::init(const std::string &dbPath)
// if found
if(_ServerCounter)
{
ICDBNode::CTextId textId;
// **** Add Observers on all nodes
// add the observers when server node change
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&_ServerObserver, ICDBNode::CTextId( string("SERVER:") + dbPath ) );
textId = ICDBNode::CTextId( string("SERVER:") + dbPath );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&_ServerObserver, textId );
// add the observers when local node change
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&_LocalObserver, ICDBNode::CTextId( string("LOCAL:") + dbPath ) );
textId = ICDBNode::CTextId( string("LOCAL:") + dbPath );
NLGUI::CDBManager::getInstance()->getDB()->addObserver(&_LocalObserver, textId );
// **** Init the Nodes shortcut
// Parse all Local Nodes

@ -118,6 +118,8 @@ public:
char * end = ptr.getDatas() + strlen( ptr.getDatas() );
char * dataTok = strtok( ptr.getDatas()," ,");
NLMISC::ICDBNode::CTextId textId;
while(dataTok)
{
std::string data (dataTok);
@ -160,7 +162,8 @@ public:
return NULL;
}
}
if ( ! NLGUI::CDBManager::getInstance()->getDB()->addObserver(obs,NLMISC::ICDBNode::CTextId (data) ) )
textId = NLMISC::ICDBNode::CTextId( data );
if ( ! NLGUI::CDBManager::getInstance()->getDB()->addObserver(obs,textId ) )
{
return NULL;
}

@ -26,6 +26,10 @@
using namespace NLMISC;
#ifdef FINAL_VERSION
#include "../client_cfg.h"
#endif
CIF3DSceneParser::CIF3DSceneParser()
{
parsingStage |= ( Resolved | GroupChildren );

@ -1536,7 +1536,7 @@ uint32 CCharacter::tickUpdate()
nextUpdate = 8;
}
_AchievementsPlayer->tickUpdate();
//_AchievementsPlayer->tickUpdate();
return nextUpdate;
} // tickUpdate //

@ -41,10 +41,10 @@ using namespace CLFECOMMON;
* t| /
* a| /
* n| /
* c|45 /
* c|45 /
* e| /
* |/
*
* o
* Observer
*
* If Delta exceeds Distance/2, the priority shelf (bucket) is the highest one (H)

@ -25,7 +25,7 @@ namespace NLOLDGEORGES
{
// La classe CFormFile représente un fichier composé d'un ensemble de fiches représentés par des fiches CForm.
// CFormFile class represents a file with a set of CForm sheets.
class CFormFile
{
public:

@ -23,7 +23,7 @@
namespace NLOLDGEORGES
{
// La classe CFormHead comprend trois strings: le nom de l'utilisateur, la date de dernière modif et la version.
// CFormHead class provides three strings: user name, last modification date and version.
class CFormHead
{
protected:

@ -23,10 +23,10 @@
namespace NLOLDGEORGES
{
// La classe CFormLoader est le point d'entrée des classes CForm pour charger une fiche.
// Il y a deux fonctions load:
// Sans date: donne directement la dernière fiche historiquement parlant
// Avec date: donne une fiche composée de la dernière additionnés des historiques postérieurs ou égaux à la date.
// CFormLoader class is CForm entry point to load a sheet.
// There are two load functions:
// Without date: give directly the last sheet
// With date: give a sheet and all previous ones until this date
class CFormLoader
{
protected:

@ -28,10 +28,10 @@ CSString GroupTypContent;
CSString WKContent;
// Assigne une nouvelle MP à une creature
// Assign a new raw mat to a creature
void AssignerMP( const CSString& creatureName, const CSString& materialName )
{
// on regarde si la créature est dégénérée ou non
// we check if a creature is degenerated or not
if ( ( creatureName.c_str()[3] != 'c' ) && ( creatureName.c_str()[3] != 'd' )
&& ( creatureName.c_str()[3] != 'f' ) && ( creatureName.c_str()[3] != 'j' )
&& ( creatureName.c_str()[3] != 'l' ) && ( creatureName.c_str()[3] != 'p' ) )
@ -43,7 +43,7 @@ void AssignerMP( const CSString& creatureName, const CSString& materialName )
CSString fileName = toString( "%s//_%s_mp.creature", RAW_MATERIAL_ASSIGN.c_str(), creatureName.c_str() );
CSString data;
// création si le fichier n'existe pas
// create file if not exists
if(!CFile::fileExists(fileName))
{
CSString str;
@ -66,7 +66,7 @@ void AssignerMP( const CSString& creatureName, const CSString& materialName )
if ( !data.contains( materialName.c_str() ) )
{
// on recherche le premier numéro de MP non utilisé
// look for first number of unused raw mat
CSString str = data;
int nb= 0;
while ( str.contains( "Name=\"MP" ) )
@ -75,7 +75,7 @@ void AssignerMP( const CSString& creatureName, const CSString& materialName )
nb = str.firstWord().atoi();
}
// on insère la nouvelle MP
// insert new raw mat
str = " <STRUCT Name=\"MP";
str += toString( "%d\">\r\n <ATOM Name=\"AssociatedItem\"", nb+1 );
str += toString( " Value=\"%s\"/>\r\n </STRUCT>\r\n </STRUCT>\r\n </STRUCT>\r\n", materialName.c_str() );
@ -87,8 +87,7 @@ void AssignerMP( const CSString& creatureName, const CSString& materialName )
}
// enregistrement des differentes
// caractéristiques de chaque craft part
// save stats for each craft part
void LoadCraftParts()
{
CSString data, ligne, info;
@ -117,7 +116,7 @@ void LoadCraftParts()
{
ligne = data.splitTo( "\n", true );
// on recherche la ligne correspondant à notre craft part
// look for line concerning our craft part
info = ligne.splitTo( ";", true );
if ( !info.empty() )
{
@ -126,13 +125,12 @@ void LoadCraftParts()
for ( int i=0; i<6; i++ )
ligne.splitTo( ";", true );
// parcours des différentes caractèristiques
// browse each characteristics
for ( int i=0; i<NumMPStats; i++ )
{
info = ligne.splitTo( ";", true ).left(1);
// si la cellule n'est pas vide, cette caractèristique
// est générée par la craft part
// if the cell is not empty, this characteristic is generated by craft part
if ( ( info == "C" ) || ( info == "D" ) || ( info == "X" ) )
craftParts[index].Carac[i] = true;
else
@ -143,7 +141,7 @@ void LoadCraftParts()
}
// Enregistre les noms des différents fichiers de creature dans le bestiaire
// Save creatures filenames in bestiary
void LoadCreatureFiles()
{
printf( "-- REGISTERING CREATURE FILES --\n" );
@ -163,8 +161,7 @@ void LoadCreatureFiles()
}
// Enregistre pour chaque créature la liste des différents
// niveaux d'item à générer
// Save items levels list to generate for each creature
void InitCreatureMP()
{
CSString data, ligneN, ligneM;
@ -184,12 +181,12 @@ void InitCreatureMP()
ligneN = data.splitTo( "\n", true );
ligneM = data.splitTo( "\n", true );
// on vérifie que la ligne est valide
// check if line is valid
if ( !ligneN.splitTo( ";", true ).empty() )
{
ligneM.splitTo( ";", true );
// on se déplace jusqu'au données
// move until data
ligneN.splitTo( ";", true );
ligneM.splitTo( ";", true );
ligneN.splitTo( ";", true );
@ -211,8 +208,7 @@ void InitCreatureMP()
ligneN = "";
}
// pour chaque nouveau nom de créature trouvé,
// on enregistre les items à générer
// save items to generate for each new creature name found
for ( char eco='a'; eco<='z'; eco++ )
{
for ( int level=0; level<10; level++ )
@ -221,12 +217,12 @@ void InitCreatureMP()
{
CSString fileName = toString( "c%s%c%c%d", code.toLower().c_str(), eco,
'a' + level, creatureLevel );
// on recherche si une créature correspond à ces données
// look for corresponding creature
it = creatureFiles.find( fileName );
if ( it != creatureFiles.end() )
{
// si oui, on signale que cet item devra être généré
// if yes, this item should be generated
CreatureMPItem* creatureMP = new CreatureMPItem;
creatureMP->creatureLevel = creatureLevel;
creatureMP->eco = eco;
@ -246,7 +242,7 @@ void InitCreatureMP()
}
// Retourne la qualité maximum pour un level d'item
// Return quality maximum foran item level
int GetMaxQuality( int level )
{
if ( level == 0 )
@ -256,7 +252,7 @@ int GetMaxQuality( int level )
}
// Retourne l'énergie maximum pour un level d'item
// Return energy maximum for an item level
int GetStatEnergy( int level )
{
if ( level == 0 )
@ -266,7 +262,7 @@ int GetStatEnergy( int level )
}
// Retourne le nom de classe de l'item selon ses caractèristiques
// Return item class name depending on its characteristics
void GetItemClass( int level, bool mission, bool creature, CSString& outClassName )
{
static CSString missionClasses[] = { "Plain", "Average", "Prime", "Select",
@ -308,7 +304,7 @@ bool endsWith( const CSString& s, const CSString& substring )
}
// Génére les noms d'un item
// Generate item names
void GenerateItemNames( const CSString& nomMP, char eco, int level, bool mission, bool creature, CSString& outStr )
{
CSString itemClass, prefix, singularWithNoPrefix;
@ -411,7 +407,7 @@ void GenerateItemNames( const CSString& nomMP, char eco, int level, bool mission
}
// Retourne le numéro de la famille passée en paramètre
// Return number of specified family
int GetNumeroMP( const CSString& nomMP )
{
CSString result;
@ -420,27 +416,25 @@ int GetNumeroMP( const CSString& nomMP )
int res;
// *** Get the family number, and add it to faimly.typ if not already done
// on recherche si la MP est présente
// dans le fichier item_mp_family.typ
// look for raw mat existence in item_mp_family.typ file
sprintf( buffer, "%s\" Value=\"", nomMP.c_str() );
result = FamilyTypContent.splitFrom( buffer );
// si oui, on retourne son numéro de MP
// if yes, return raw mat number
if ( !result.empty() )
res = result.splitTo( "\"" ).atoi();
else
{
// sinon, on génère un nouveau numéro :
// on recupère le dernier numéro de MP (le max)
// else, generate a new number:
// get last raw mat number (the max)
result = FamilyTypContent.splitTo( "<LOG>" ).right(10);
result.splitTo( "\"", true );
result = result.splitTo( "\"" );
// on ajoute 1 pour avoir un numéro non utilisé
// increase by 1 to get the unused number
res = result.atoi() + 1;
// on ajoute la nouvelle MP :
// dans le fichier item_mp_family.typ
// add new raw mat in file item_mp_family.typ
sprintf( buffer, " <DEFINITION Label=\"%s\" Value=\"%d\"/>\n<LOG>", nomMP.c_str(), res );
FamilyTypContent= FamilyTypContent.replace( "<LOG>", buffer );
FamilyTypContent.writeToFile( ITEM_MP_FAMILY_TYP );
@ -463,7 +457,7 @@ int GetNumeroMP( const CSString& nomMP )
}
// Retourne le numéro du groupe passé en paramètre
// Return number from specified group
int GetNumeroGroupe( const CSString& groupe )
{
CSString result;
@ -472,27 +466,25 @@ int GetNumeroGroupe( const CSString& groupe )
int res;
// *** Get the group number, and add it to group.typ if not already done
// on recherche si le groupe est présent
// dans le fichier item_mp_group.typ
// look for group existence in item_mp_group.typ file
sprintf( buffer, "%s\" Value=\"", groupe.c_str() );
result = GroupTypContent.splitFrom( buffer );
// si oui, on retourne son numéro de groupe
// if yes, return its group number
if ( !result.empty() )
res = result.splitTo( "\"" ).atoi();
else
{
// sinon, on génère un nouveau numéro :
// on recupère le dernier numéro de groupe (le max)
// else, generate a new number :
// get the last group number (the max)
result = GroupTypContent.splitTo( "<LOG>" ).right(10);
result.splitTo( "\"", true );
result = result.splitTo( "\"" );
// on ajoute 1 pour avoir un numéro non utilisé
// increase by 1 to get the unused number
res = result.atoi() + 1;
// on ajoute la nouvelle MP :
// dans le fichier item_mp_group.typ
// add new raw mat in file item_mp_group.typ
sprintf( buffer, "<DEFINITION Label=\"%s\" Value=\"%d\"/>\n<LOG>", groupe.c_str(), res );
GroupTypContent= GroupTypContent.replace( "<LOG>", buffer );
GroupTypContent.writeToFile( ITEM_MP_GROUPE_TYP );
@ -516,7 +508,7 @@ int GetNumeroGroupe( const CSString& groupe )
}
// Génère l'item parent pour une MP
// Generate parent item for a raw mat
void CreateParentSItem( int numMP,
const CSString& nomMP,
const CSString& groupe,
@ -527,10 +519,10 @@ void CreateParentSItem( int numMP,
CSString output;
CSString outputFileName;
// nom du fichier de sortie
// output filename
outputFileName = toString( "%s_parent\\_m%04d.sitem", MP_DIRECTORY.c_str(), numMP );
// entete xml
// xml header
output = "<?xml version=\"1.0\"?>\n<FORM Version=\"0.0\" State=\"modified\">\n";
// basics
@ -538,15 +530,15 @@ void CreateParentSItem( int numMP,
output += " <ATOM Name=\"Drop or Sell\" Value=\"";
if ( !dropOrSell )
// il s'agit d'un item de mission, non vendable
// mission items can't be sold
output += "false\"/>\n";
else
// sinon, on peut le vendre
// the others, yes
output += "true\"/>\n";
output += " <ATOM Name=\"Bulk\" Value=\"0.5\"/>\n </STRUCT>\n";
// mp
// raw mat
output += " <STRUCT Name=\"mp\">\n";
output += " <ATOM Name=\"Family\" Value=\"";
output += nomMP;
@ -573,16 +565,16 @@ void CreateParentSItem( int numMP,
output += " </STRUCT>\n </STRUCT>\n";
// fin du fichier
// end of file
output += " <STRUCT/>\n <STRUCT/>\n <STRUCT/>\n <STRUCT/>\n</FORM>\n";
// écriture finale
// final write
output.writeToFile( outputFileName );
}
// Remplit les différents informations concernant le craft par un item
// Fill information related to craft with an item
void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
int worstStat1, int worstStat2, CSString& outStr )
{
@ -630,8 +622,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
currentDocItem.push( DtCraftSlotName, craftParts[index].Desc.splitFrom( "(" ).splitTo( ")" ) );
// enregistrements des stats de chaque
// caractèristique
// save stats for each characteristic
for ( int i=0; i<NumMPStats; i++ )
{
if ( craftParts[index].Carac[i] )
@ -641,7 +632,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
else
stat = mediumStatsByStatQuality[ level ];
// gestion des points forts/faibles de la MP
// manage weak/strong points of a raw mat
if ( i == bestStat )
{
if ( worstStat2 == -1 )
@ -651,8 +642,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
if ( stat > 100 )
{
// si une des stats dépasse 100, les autres
// stats sont augmentées
// if a stat exceeds 100, other are increased
remaining = stat - 100;
stat = 100;
}
@ -661,7 +651,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
{
stat -= 20;
// durabilité minimum
// minimum durability
if ( ( i == 0 ) && ( stat < 1 ) )
stat = 1;
}
@ -677,7 +667,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
if ( nbToRaise != 0 )
ajout = remaining/nbToRaise;
// ajout des informations pour chaque carac
// add information for each characteristic
for ( int i=0; i<NumMPStats; i++ )
{
if ( stats[i] != -1 )
@ -696,7 +686,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
}
}
// CraftCivSpec en fonction de l'écosystème
// CraftCivSpec depending on ecosystem
outStr += " <ATOM Name=\"CraftCivSpec\" Value=\"";
CSString craftCiv;
@ -739,7 +729,7 @@ void FillCraftData( char craft, int eco, int level, bool creature, int bestStat,
}
// Création d'une fiche d'item
// Create item sheets
void CreateSheet( int numMP, const CSString& nomMP,
const CSString& code, char eco,
int level, const MPCraftStats& craftStats,
@ -801,7 +791,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
else
currentDocItem.push( DtLevelZone, "-" );
// remplissage des informations de la fiche
// fill sheets information
output = "<?xml version=\"1.0\"?>\n<FORM Version=\"0.0\" State=\"modified\">\n";
output += " <PARENT Filename=\"_m";
output += eco;
@ -809,7 +799,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
output += chaineNum;
output += ".sitem\"/>\n";
// le code est celui d'une créature, on doit donc rajouter le parent
// if a creature code, add it its parent
if ( creature )
{
output += " <PARENT Filename=\"_m";
@ -824,7 +814,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
output += " <STRUCT Name=\"mp\">\n";
output += " <ATOM Name=\"MpColor\" Value=\"";
// materiaux de missions toujours Beige
// mission materials always Beige
if ( craftStats.Craft.empty() )
{
output += "Beige\"/>\n";
@ -833,14 +823,14 @@ void CreateSheet( int numMP, const CSString& nomMP,
}
else
{
// on récupère la couleur
// get the color
GetItemColor( craftStats.color, eco, level, color );
output += color;
output += "\"/>\n";
currentDocItem.push( DtColor, color );
// on ajoute les données de craft
// add craft data
output += " <STRUCT Name=\"MpParam\">\n";
for ( uint i=0; i<craftStats.Craft.size(); i++ )
{
@ -906,7 +896,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
output.writeToFile( toString( "%s%s\\%s", MP_DIRECTORY.c_str(), directory.c_str(), outputFileName.c_str() ) );
// Génération des noms
// Generate names
if ( !specialItem )
{
outputFileName = toString( "m%04d%s%c%c%02d", numMP, code.c_str(), eco, 'a' + level, variation );
@ -934,7 +924,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
}
// Pour une MP se trouvant dans des déposits, génération de ses items
// Generate deposits items for harvested raw mats
void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats& craftStats, const CSString& loc )
{
CSString code;
@ -959,11 +949,11 @@ void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats&
}
else
{
// 2 items dans common
// 2 items in common
CreateSheet( numMP, nomMP, code, 'c', 1, craftStats );
CreateSheet( numMP, nomMP, code, 'c', 2, craftStats );
// 3 items par zone
// 3 items per zone
for ( int i=0; i<3; i++ )
{
CreateSheet( numMP, nomMP, code, 'd', 3+i, craftStats );
@ -976,24 +966,24 @@ void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats&
}
// Pour une MP se trouvant sur un créature, génération de ses items
// Generate creatures items for a looted raw mat
void GenerateCreatureItems( int numMP, CSString& nomMP, const MPCraftStats& craftStats )
{
map<CSString, ListeCreatureMP>::const_iterator itLCMP;
int quality;
static int statQuality[] = { 0, 1, 0, 1, 3, 6, 4, 2 };
// On obtient la liste des niveau d'item à generer pour la créature
// Get items levels to generate for the creature
itLCMP = itemsAGenerer.find( nomMP.firstWord() );
if ( itLCMP != itemsAGenerer.end() )
{
ListeCreatureMP::const_iterator itMP = (*itLCMP).second.begin();
// pour chaque niveau d'item à générer
// for each level of an item to generate
while ( itMP != (*itLCMP).second.end() )
{
// on enregistre ses caractéristiques
// save its stats
char eco = (*itMP)->eco;
int creatureLevel = (*itMP)->creatureLevel;
int itemLevel = (*itMP)->itemLevel;
@ -1043,7 +1033,7 @@ void GenerateCreatureItems( int numMP, CSString& nomMP, const MPCraftStats& craf
}
// Génération d'un item spécial
// Generate special item
void GenerateSpecialItem( int numMP, const CSString& nomMP, const MPCraftStats& craftStats,
const CSString& loc,CSString& itemData, int variation )
{
@ -1060,15 +1050,15 @@ void GenerateSpecialItem( int numMP, const CSString& nomMP, const MPCraftStats&
CreateSheet( numMP, nomMP, code, info.c_str()[0], info.c_str()[1]-'a', craftStats, true, variation );
name = toString( "m%04d%s%s%02d\t", numMP, code.c_str(), info.c_str(), variation );
name += itemData.splitTo( "/", true ); // singulier
name += itemData.splitTo( "/", true ); // singular
name += "\t";
name += itemData.splitTo( "/", true ); // article indéfini
name += itemData.splitTo( "/", true ); // undefined article
name += "\t";
name += itemData.splitTo( "/", true ); // article défini
name += itemData.splitTo( "/", true ); // defined article
name += "\t";
name += itemData.splitTo( "/", true ); // pluriel
name += itemData.splitTo( "/", true ); // plural
name += "\t\t";
name += itemData.splitTo( "/", true ); // article pluriel
name += itemData.splitTo( "/", true ); // plural article
itemNames.insert( name );
}
@ -1095,7 +1085,7 @@ void parseSpecialAttributes(const CSString &specialAttributes, MPCraftStats &cra
}
// Nouvelle MP à traiter
// New raw mat to process
void NewMP( CSString& ligne )
{
CSString nomMP, groupe, loc, icon, overlay, special, stat, specialAttributes;
@ -1113,7 +1103,7 @@ void NewMP( CSString& ligne )
return;
}
// récupération des infos
// get information
groupe = ligne.splitTo( ";", true );
craftStats.Craft = ligne.splitTo( ";", true );
specialAttributes= ligne.splitTo( ";" , true );
@ -1189,7 +1179,7 @@ void NewMP( CSString& ligne )
currentDocItem.push( DtRMFamily, nomMP );
currentDocItem.push( DtGroup, groupe );
// récupréation du numéro de MP
// get raw mat number
numMP = GetNumeroMP( nomMP );
printf( " Processing Family %d : %s\n", numMP, nomMP.c_str() );
@ -1203,12 +1193,12 @@ void NewMP( CSString& ligne )
MPFamilies[numMP].Icon= icon;
// MP trouvées dans les déposits ou dans la goo
// raw mats found in deposits or goo
if ( loc.left(1) != "C" )
{
if ( !specialOnly )
{
// Génération des items
// Generate items
GenerateDepositItems( numMP, nomMP, craftStats, loc );
}
@ -1221,14 +1211,14 @@ void NewMP( CSString& ligne )
overlay = nomMP.firstWord().toUpper().left(6);
}
// MP trouvées sur les creature
// looted raw mats
else
{
GenerateCreatureItems( numMP, nomMP, craftStats );
}
// items spéciaux
// special items
CSString codeSpecial, nouveauCode;
int variation = 1;
CSortedStringSet::const_iterator it = specialNames.begin();
@ -1250,7 +1240,7 @@ void NewMP( CSString& ligne )
}
// Création de la fiche parente pour la MP
// Create parent sheet for raw mat
CreateParentSItem( numMP, nomMP, groupe, extraInfo.DropOrSell, icon, overlay );
currentDocItem.reset( DtRMFamily );
@ -1260,7 +1250,7 @@ void NewMP( CSString& ligne )
}
// Génération du Primitive Necklace (objet particulier)
// Generate Primitive Necklace (special object)
void CreatePrimitiveNecklace()
{
CSString output;
@ -1282,7 +1272,7 @@ void CreatePrimitiveNecklace()
}
// Enregistre les différents noms
// Save names
void ItemNamesSave()
{
printf( "-- SAVING ITEM NAMES --\n");
@ -1325,8 +1315,7 @@ void ItemNamesSave()
}
// Charge les différentes Customized Properties
// définies dans raw_material_generation.cfg
// Load Customized Properties defined in raw_material_generation.cfg
void LoadCustomizedProperties()
{
CSString data, name, prop, val;
@ -1356,7 +1345,7 @@ void LoadCustomizedProperties()
CSString fileName, str, output;
fileName = CPath::lookup( name, false, false, true );
// on vérifie que le fichier concerné existe
// check if file exists
if ( !fileName.empty() )
{
CSString zone = prop.splitTo( ".", true );
@ -1368,7 +1357,7 @@ void LoadCustomizedProperties()
output += toString( "%s\">\n <ATOM Name=\"", zone.c_str() );
output += toString( "%s\" Value=\"%s\"/>\n </STRUCT>", prop.c_str(), val.c_str() );
// on vérifie que la propriétés n'a pas déjà été insérée
// check if property is not already inserted
if ( !str.contains( output.c_str() ) )
{
str = str.replace( "<STRUCT>", output.c_str() );
@ -1381,7 +1370,7 @@ void LoadCustomizedProperties()
output += toString( " <ATOM Name=\"" );
output += toString( "%s\" Value=\"%s\"/>\n", prop.c_str(), val.c_str() );
// on vérifie que la propriétés n'a pas déjà été insérée
// check if property is not already inserted
if ( !str.contains( toString( "%s\" Value=\"%s\"/>\n", prop.c_str(), val.c_str() ).c_str() ) )
{
str = str.replace( toString( " <STRUCT Name=\"%s\">\n", zone.c_str() ).c_str(), output.c_str() );
@ -1422,7 +1411,7 @@ void SaveFamiliesForageSource()
}
// Génère la documentation
// Generate documentation
void GenerateDoc()
{
CProducedDocHtml MainDoc;
@ -1470,7 +1459,7 @@ void GenerateDoc()
}
// Initialise les repertoires à partir de raw_material_generation.cfg
// Initialize directories from raw_material_generation.cfg
void SetupDirectories()
{
CSString data;
@ -1503,8 +1492,7 @@ void SetupDirectories()
}
// Parcours les différentes familles de MP pour effectuer
// les traitements nécessaires
// Browse all raw mats families to do all related processes
void LoadFamillesMP()
{
printf( "-- LOADING RAW MATERIAL FAMILIES --\n" );
@ -1530,14 +1518,13 @@ void LoadFamillesMP()
ligne = fileData.splitTo( "\n", true );
while ( ligne != "" )
while ( !ligne.empty() )
{
NewMP( ligne );
ligne = fileData.splitTo( "\n", true );
}
// le Primitive Necklace n'étant pas spécifié dans la liste des MP
// on le rajoute à la main
// we manually add Primitive Necklace because it's not specified in raw mats list
CreatePrimitiveNecklace();
}

@ -105,20 +105,19 @@ public:
};
//////////////////////////////////
// VARIABLES GLOBALES //
// GLOBAL VARIABLES //
//////////////////////////////////
// Liste des différentes Craft parts
// Craft parts list
CraftPart craftParts[NumMPCraftParts];
// Liste des fichiers .creature
// .creature files list
map<string, string> creatureFiles;
// noms générés pour chaque item
// generated names for each item
CSortedStringSet itemNames;
// Liste des items à generer
// pour chaque code de créature
// Items list to generate for each creature code
map<CSString, ListeCreatureMP> itemsAGenerer;
// MP Family list
@ -133,7 +132,7 @@ public:
std::vector<CMPFamily> MPFamilies;
// chemin des différents repertoires
// directories pathes
CSString LEVEL_DESIGN_PATH;
CSString TRANSLATION_PATH;

@ -155,7 +155,4 @@ function callAction($action) {
return $c;
}
?>

@ -28,11 +28,14 @@ function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='', $w
$is_auth_ingame = false;
// we have to set the $user['lang'] even for anonymous user or we cannot display the test in the right langage
if($lang == '') {
if (!isset($_SESSION['lang'])) {
$l = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])?substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2):'en';
if ($l=='fr'||$l=='en'||$l=='de'||$l=='ru'||$l=='es')
$lang = $l;
else
$lang = 'en';
} else
$lang = $_SESSION['lang'];
}
if ($lang!='fr'&&$lang!='en'&&$lang!='de'&&$lang!='ru'&&$lang!='es')
$lang = 'en';
@ -107,13 +110,15 @@ function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='', $w
$_SESSION['lang'] = $lang;
define('RYZOM_IG', $user['ig']);
// get user information
// get user informations
$ig = $user['ig'];
$user = ryzom_user_get_info($cid, $webprivs);
$user = ryzom_user_get_info($cid, $webprivs, RYAPI_USE_PLAYER_STATS);
if (isset($user['creation_date']))
$user['id'] = ryzom_get_user_id($cid, $user['char_name'], $user['creation_date'], $user);
$user['gender'] = ryzom_get_user_gender($user['id']);
$user['ig'] = $ig;
$user['lang'] = $_SESSION['lang'];
if (!isset($user['groups']))
@ -133,11 +138,13 @@ function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='', $w
$user['translation_mode'] = $_SESSION['translater_mode'];
// $user['after_merge'] = $user['uid'] >= 671686;
ryzom_unset_url_param('translate_this');
if (isset($user['last_played_date']))
$_SESSION['last_played_date'] = $user['last_played_date'];
// don't send this information to external apps
// don't send this informations to external apps
unset($user['last_played_date']);
unset($user['creation_date']);
return true;

@ -804,6 +804,13 @@ class bbCode extends bbCodeParser {
return $txt;
}
static function bb_lang($attr, $txt) {
if (_user()->lang == $attr)
return $txt;
else
return '';
}
static function bb_time($options, $txt) {
$time = strtotime($txt);
@ -959,6 +966,9 @@ class bbCode extends bbCodeParser {
case 'date' :
$result = self::bb_date($attr, $text);
break;
case 'lang' :
$result = self::bb_lang($attr, $text);
break;
default :
$result = $open . $text . $close;
break;

@ -17,7 +17,8 @@
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
define('RYAPI_MODE', 'client');
define('RYAPI_MODE', 'client');
define('RYAPI_USE_PLAYER_STATS', false);
// Url where the api is
define('RYAPI_URL', 'http://');

@ -18,7 +18,7 @@
// init database table used by webig
$db = ryDB::getInstance('webig');
$db->setDbDefs('players', array('id' => SQL_DEF_INT, 'cid' => SQL_DEF_INT, 'name' => SQL_DEF_TEXT, 'creation_date' => SQL_DEF_DATE, 'deleted' => SQL_DEF_BOOLEAN, 'last_login' => SQL_DEF_TEXT));
$db->setDbDefs('players', array('id' => SQL_DEF_INT, 'cid' => SQL_DEF_INT, 'name' => SQL_DEF_TEXT, 'gender' => SQL_DEF_INT, 'creation_date' => SQL_DEF_DATE, 'deleted' => SQL_DEF_BOOLEAN, 'last_login' => SQL_DEF_TEXT, 'dev_shard' => SQL_DEF_BOOLEAN));
$db->setDbDefs('accounts', array('uid' => SQL_DEF_INT, 'web_privs' => SQL_DEF_TEXT));
?>

@ -149,8 +149,10 @@ class ryDB {
if ($check)
{
$result = $this->db->query('SHOW FIELDS FROM '.$table);
if (!$result)
die("Table $table not found in database");
if (!$result) {
die("Table [$table] not found in database [$this->db_name]");
}
$fields = array_keys($defs);
while ($row = $this->db->fetch_row($result)) {

@ -17,7 +17,7 @@
* along with ryzom_api. If not, see <http://www.gnu.org/licenses/>.
*/
function ryzom_app_render($title, $content, $style='', $javascript=array(), $homeLink=false) {
function ryzom_app_render($title, $content, $style='', $files=array(), $homeLink=false) {
$c = '';
// get Lua code
@ -51,12 +51,17 @@ function ryzom_app_render($title, $content, $style='', $javascript=array(), $hom
if (!RYZOM_IG) {
// Javascript
$js_code = '';
if (is_string($javascript))
$javascript = array($javascript);
foreach ($javascript as $js)
$js_code .= ' <script type="text/javascript" src="'.$js.'"></script>'."\n";
$c .= $js_code;
$extra_code = '';
if (is_string($files))
$files = array($files);
foreach ($files as $file) {
$sfile = explode('.', $file);
if ($sfile[count($sfile)-1] == 'js')
$extra_code .= ' <script type="text/javascript" src="'.$file.'"></script>'."\n";
else if ($sfile[count($sfile)-1] == 'css')
$extra_code .= ' <link rel="stylesheet" type="text/css" media="all" href="'.$file.'" />'."\n";
}
$c .= $extra_code;
}
$c .= ' </head>'."\n";
@ -167,7 +172,7 @@ function ryzom_render_window_begin($title, $homeLink=false) {
function ryzom_render_window_end() {
global $user;
return '</div>
<div>'.(isset( $user['groups'])?implode(':', $user['groups']):'').'</div>
<div>P_'.(isset($user['id'])?$user['id']:'GUEST').':'.(isset( $user['groups'])?implode(':', $user['groups']):'').'</div>
<div style="background-color: #000000">'.ryLogger::getInstance()->getLogs().'</div></div></div></div>
<div class="ryzom-ui-bl"><div class="ryzom-ui-br"><div class="ryzom-ui-b"></div></div></div><p class="ryzom-ui-notice">powered by <a class="ryzom-ui-notice" href="http://dev.ryzom.com/projects/ryzom-api/wiki">ryzom-api</a></p>
</div>
@ -200,6 +205,7 @@ function ryzom_render_www_begin($url='') {
<a href="'.$url.'&lang=en"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/en.png" alt="English" /></a>
<a href="'.$url.'&lang=fr"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/fr.png" alt="French" /></a>
<a href="'.$url.'&lang=de"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/de.png" alt="German" /></a>
<a href="'.$url.'&lang=es"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/es.png" alt="Spanish" /></a>
<a href="'.$url.'&lang=ru"><img hspace="5" border="0" src="'.RYAPI_URL.'data/img/lang/ru.png" alt="Russian" /></a>
<div style="'.$style2.'">
<a href="http://www.ryzom.com/"><img border="0" src="'.RYAPI_URL.'data/img/logo.gif" alt=""/></a>
@ -300,10 +306,10 @@ $ryzom_render_styles = array();
$ryzom_render_tmpls = array();
$ryzom_render_styles['main title'] = array('#222222'.$transparency, '#FFFFFF');
$ryzom_render_tmpls['main title'] = '<table width="100%" cellpadding="0" cellspacing="0"><tr bgcolor="${p[\'color1\']}"><td height="42px" valign="middle"><h1><font '.($ig?'color="${p[\'color2\']}" size="14"':'style="color:${p[\'color2\']};font-size:16pt; font-weight: bold"').'>&nbsp;${p[0]}</font></h1></td></tr></table>'."\n";
$ryzom_render_tmpls['main title'] = '<table width="100%" cellpadding="0" cellspacing="0"><tr bgcolor="${p[\'color1\']}"><td height="42px" valign="middle"><font '.($ig?'color="${p[\'color2\']}" size="14"':'style="color:${p[\'color2\']};font-size:16pt; font-weight: bold"').'>&nbsp;${p[0]}</font></td></tr></table>'."\n";
$ryzom_render_styles['section'] = array('#555555'.$transparency, '#FFFFFF');
$ryzom_render_tmpls['section'] = '<table width="100%" cellpadding="0" cellspacing="0"><tr bgcolor="${p[\'color1\']}"><td height="30px" align="left" valign="middle"><font '.($ig?'color="${p[\'color2\']}" size="12"':'style="color:${p[\'color2\']}; font-size:10pt; font-weight: bold"').'>&nbsp;${p[0]}</font></td></tr></table>'."\n";
$ryzom_render_tmpls['section'] = '<table width="100%" cellpadding="0" cellspacing="0"><tr bgcolor="${p[\'color1\']}"><td height="40px" align="left" valign="middle"><font '.($ig?'color="${p[\'color2\']}" size="12"':'style="color:${p[\'color2\']}; font-size:10pt; font-weight: bold"').'>&nbsp;${p[0]}</font></td></tr></table>'."\n";
$ryzom_render_styles['color'] = array('', '');
$ryzom_render_tmpls['color'] = ($ig?'<font color="${p[0]}">':'<font style="color:${p[0]}">').'${p[0]}</font>';
@ -347,8 +353,8 @@ $ryzom_render_tmpls['t element'] = '<font color="${p[\'color1\']}">${p[0]}</font
$ryzom_render_styles['log'] = array('#001100'.$transparency, '');
$ryzom_render_tmpls['log'] = '<div style="background-color: ${p[\'color1\']}"><pre style="width: auto">${p[0]}</pre></div>'."\n";
$ryzom_render_styles['message'] = array('#445566'.$transparency, '');
$ryzom_render_tmpls['message'] = '<table width="100%"><tr bgcolor="${p[\'color1\']}"><td align="center" valign="middle"><h3>&nbsp;${p[0]}</h3></td></tr></table>'."\n";
$ryzom_render_styles['message'] = array('#445566'.$transparency, '#FFDDAA');
$ryzom_render_tmpls['message'] = '<table width="100%" cellspacing="0" cellpadding="0"><tr bgcolor="${p[\'color1\']}"><td height="5px"></td></tr><tr bgcolor="${p[\'color1\']}"><td align="center" valign="middle"><font '.($ig?'color="${p[\'color2\']}" size="16"':'style="color:${p[\'color2\']};font-size:12pt; font-weight: bold"').'>${p[0]}</font></td></tr><tr bgcolor="${p[\'color1\']}"><td height="5px"></td></tr></table>'."\n";
$ryzom_render_styles['message warning'] = array('#AA3300'.$transparency, '');
$ryzom_render_tmpls['message warning'] = '<table width="100%"><tr bgcolor="${p[\'color1\']}"><td align="center" valign="middle"><h3>&nbsp;${p[0]}</h3></td></tr></table>'."\n";
@ -358,7 +364,7 @@ $ryzom_render_tmpls['message window'] = '<table width="100%" cellspacing="0" cel
'<tr bgcolor="${p[\'color1\']}"><td bgcolor="${p[\'color2\']}" width="3px"></td><td height="3px" bgcolor="${p[\'color2\']}"></td><td bgcolor="${p[\'color2\']}" width="3px"></td><td bgcolor="${p[\'color2\']}"></td></tr></table>'."\n";
$ryzom_render_styles['message ask'] = array('#333333'.$transparency, '');
$ryzom_render_tmpls['message ask'] = '<table width="100%"><tr bgcolor="${p[\'color1\']}"><td height="35px" align="center" valign="middle">'.($ig?'<font color="#DDAA33" size="11">':'<font style="color:#DDAA33; font-size:11pt">').'${p[0]}</font></td></tr></table>'."\n";
$ryzom_render_tmpls['message ask'] = '<table width="100%"><tr bgcolor="${p[\'color1\']}"><td valign="middle">'.($ig?'<font color="#DDAA33" size="11">':'<font style="color:#DDAA33; font-size:11pt">').'${p[0]}</font></td></tr></table>'."\n";
$ryzom_render_styles['message error'] = array('#AA2222'.$transparency, '');
$ryzom_render_tmpls['message error'] = '<table width="100%"><tr bgcolor="${p[\'color1\']}"><td height="30px" align="center" valign="middle"><h3>&nbsp;${p[0]}</h3></td></tr></table>'."\n";

@ -310,7 +310,10 @@ class ryForm {
if (count($savedRyform) == 0 || $def->type != DEF_TYPE_RYFORM) {
if (is_string($def->params))
$infos = _l(_i('16/add', _t('add')), $url_params, array('new_ryform' => $def->params, 'ryform_name' => $parent_ryform_name.$deffullname.':0', 'ryform_action' => 'add'));
else if (count($def->params) == 1)
$infos = _l(_i('16/add', _t('add')), $url_params, array('new_ryform' => $def->params[0], 'ryform_name' => $parent_ryform_name.$deffullname.':0', 'ryform_action' => 'add'));
else
$infos = _l(_i('16/add', _t('add')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':0', 'ryform_action' => 'list'));
if ($type == DEF_TYPE_RYFORMS_ARRAY)
@ -674,5 +677,4 @@ class ryForm {
}*/
}
?>

@ -37,6 +37,8 @@ define('DEF_TYPE_COMBO', 16);
define('DEF_TYPE_OPTION_FUNCTION', 17);
define('DEF_TYPE_NAMEID', 18);
define('DEF_TYPE_COMBO_FUNCTION', 19);
define('DEF_TYPE_DATE', 20);
define('DEF_TYPE_ICON_UNKNOWN', 0);
define('DEF_TYPE_ICON_SHARED', 1);
@ -91,6 +93,90 @@ function getTrad($value) {
return substr($trad, 1);
}
function setRyformSource($object, $src, $indent=0, $protecteds=array()) {
$c = '';
$src = str_replace("\r", '', $src);
$ssrc = explode("\n", $src);
$mode = 'var';
$cache = '';
$current_ryform = NULL;
foreach ($ssrc as $line) {
if (!$line)
continue;
if ($mode != 'ryform')
$c .= str_repeat("\t", $indent);
switch ($mode) {
case 'ryform':
if ($line[0] == "\t") {
$cache .= substr($line, 1)."\n";
break;
} else {
$mode = 'array';
}
case 'array':
if ($line == ')' || $line == '}') {
if ($cache && $current_ryform) {
$c .= $current_ryform->setSource($cache, $indent+1);
$c .= 'SET SOURCE ';
if ($line == ')')
$array[] = $current_ryform;
else
$array = $current_ryform;
}
if (array_key_exists($var_name, $protecteds))
call_user_func(array($object, $protecteds[$var_name]), $array);
else
$object->$var_name = $array;
$mode = 'var';
$cache = '';
continue;
} else if ($line[0] == '[') {
if ($cache && $current_ryform) {
$c .= $current_ryform->setSource($cache, $indent+1);
$array[] = $current_ryform;
$c .= 'SET SOURCE ';
}
$ryform_name = substr($line, 1, strlen($line)-2);
$c .= 'New Ryform: '.$ryform_name."\n";
$cache = '';
$current_ryform = new $ryform_name();
$mode = 'ryform';
continue;
}
break;
default:
$sep = strpos($line, '=');
if ($sep) {
$var_name = substr($line, 0, $sep-1);
$value = substr($line, $sep+2);
if ($value == '(' || $value == '{') {
$c .= $var_name.' is ARRAY'."\n";
$mode = 'array';
$array = array();
} else {
$c .= $var_name .' = '.$value."\n";
if ($value[0] == '\'' && $value[strlen($value)-1] == '\'')
$object->$var_name = str_replace('\n', "\n", substr($value, 1, -1));
else {
if (is_numeric($value))
$object->$var_name = eval('return '.$value.';');
else if ($value == 'false')
$object->$var_name = false;
else if ($value == 'true')
$object->$var_name = true;
else if ($value == 'NULL')
$object->$var_name = NULL;
}
}
}
break;
}
}
return $c;
}
interface iRyForm {
function getForm($url_params);
function setFormParams($params);
@ -132,11 +218,11 @@ class basicRyForm implements iRyForm {
public $formName = ''; // Used by Form
public $id = 0;
function __construct($name, $title) {
function __construct($name='', $title='') {
}
function getForm($url_params) {
$form = new ryForm($this->formName, $this->tools);
$form = new ryForm($this->formName);
$form_defs = $this->getFormDefs();
foreach ($form_defs as $def)
$form->addDefine($def);
@ -162,8 +248,20 @@ class basicRyForm implements iRyForm {
return array();
}
function preSerialization() {
/*function preSerialization() {
unset($this->tools);
}*/
function preSerialization() {
$all_defs = array('class_name');
$this->author = _user()->id;
foreach ($this->getFormDefs() as $def)
$all_defs[] = $def->name;
foreach (get_object_vars($this) as $name => $value) {
if (!in_array($name, $all_defs))
unset($this->$name);
}
}
function postSerialization($vars=array()) {
@ -172,6 +270,35 @@ class basicRyForm implements iRyForm {
function getTemplate() {
return '';
}
function getSource($indent=0) {
$attrs = $this->getFormDefs();
$c = str_repeat("\t", $indent-1).'['.get_class($this).']'."\n";
foreach ($attrs as $attr) {
$c .= str_repeat("\t", $indent).$attr->name.' ';
$var = $this->{$attr->name};
if (is_object($var)) {
$c .= "= {\n".substr($var->getSource($indent+1), 0, -1)."\n".str_repeat("\t", $indent).'}';
} else if (is_array($var)) {
$c .= '= ('."\n";
foreach ($var as $element) {
if (is_object($element))
$c .= $element->getSource($indent+1);
else if ($element)
$c .= '#'.str_replace("\r", '', str_replace("\n", '\\\\n', var_export($element, true)));
}
$c .= str_repeat("\t", $indent).")";
} else
$c .= '= '.str_replace("\r", '', str_replace("\n", '\\\\n', var_export($var, true)));
$c .= "\n";
}
return $c;
}
function setSource($src, $indent=0) {
$this->preSerialization();
return setRyformSource($this, $src, $indent);
}
}
?>

@ -38,8 +38,16 @@ class ryUser {
function inGroup($groups) {
$groups = explode(':', $groups);
foreach ($groups as $group) {
if ($group != '') {
if (in_array($group, $this->groups))
return true;
if ('P_'.$this->id == $group)
return true;
if ('G_'.$this->guild_id == $group)
return true;
if ($group == '*')
return true;
}
}
return false;
}

@ -22,6 +22,15 @@ include_once('dfm.php');
define('SERVER', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
if (ini_get('magic_quotes_gpc') == 1) {
$_POST = stripslashes_deep($_POST);
$_GET = stripslashes_deep($_GET);
@ -306,14 +315,18 @@ function file_get_contents_cached($fn, $cache_time=300) {
return $content;
}
function ryzom_redirect($url, $group='webig', $extra_lua='') {
function ryzom_redirect($url, $group='', $extra_lua='') {
global $user;
$lua = $extra_lua."\n";
if ($user['ig']) {
if (!$group)
$lua .= 'getUI(__CURRENT_WINDOW__):browse("'.str_replace('&', '&amp;', $url).'")';
else {
if (substr($group, 0, 3) == 'ui:')
$lua .= 'getUI("'.$group.'"):browse("'.str_replace('&', '&amp;', $url).'")';
else
$lua .= 'getUI("ui:interface:'.$group.':content:html"):browse("'.str_replace('&', '&amp;', $url).'")';
}
echo '<lua>'.$lua.'</lua>';
exit();
} else {
@ -409,6 +422,10 @@ function p($var, $value=pNULL, $color='#FFFF00', $level=0) {
return $ret;
}
static function text($text) {
return str_replace('"', '\"', $text);
}
static function url($base_params=null, $add_params=array()) {
return str_replace('&', '&amp;', _url($base_params, $add_params));
}
@ -446,8 +463,4 @@ END;
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 B

@ -0,0 +1,37 @@
if(window.addEventListener)
window.addEventListener("load", tabulation, false);
else
window.attachEvent("onload", tabulation);
function tabulation(){
var textareas = document.getElementsByTagName("textarea");
for(var i = 0, t = textareas.length; i < t; i++){
textareas[i].onkeydown = function(e){
var tab = (e || window.event).keyCode == 9;
if(tab){
var tabString = String.fromCharCode(9);
var scroll = this.scrollTop;
if(window.ActiveXObject){
var textR = document.selection.createRange();
var selection = textR.text;
textR.text = tabString + selection;
textR.moveStart("character",-selection.length);
textR.moveEnd("character", 0);
textR.select();
}
else {
var beforeSelection = this.value.substring(0, this.selectionStart);
var selection = this.value.substring(this.selectionStart, this.selectionEnd);
var afterSelection = this.value.substring(this.selectionEnd);
this.value = beforeSelection + tabString + selection + afterSelection;
this.setSelectionRange(beforeSelection.length + tabString.length, beforeSelection.length + tabString.length + selection.length);
}
this.focus();
this.scrollTop = scroll;
return false;
}
};
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -68,5 +68,4 @@ require_once("common/db_lib.php");
require_once("common/db_defs.php");
require_once("common/render.php");
?>

@ -40,6 +40,13 @@ function ryzom_authenticate_ingame($shardid, $cid, $name, $authkey) {
function ryzom_authenticate_with_char_and_password($character, $password, &$cid) {
$db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING);
$char = $db->escape_string($character);
$schar = explode('@', $char);
$_SESSION['dev_shard'] = 0;
if (count($schar) == 2 && $schar[1] == RYAPI_DEV_SHARD) {
$_SESSION['dev_shard'] = 1;
$char = $schar[0];
$db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING_DEV);
}
$sql = "SELECT char_id, char_name, user_id, home_mainland_session_id FROM characters WHERE char_name = '$char'";
$row = $db->query_single_row($sql);
$character = $row['char_name'];
@ -59,6 +66,7 @@ function ryzom_authenticate_with_session(&$name, &$cid, &$error_message) {
if ($action == 'logout') {
unset($_SESSION['name']);
unset($_SESSION['cid']);
unset($_SESSION['dev_shard']);
}
if (isset($_SESSION['name']) && ($name == '' || $_SESSION['name'] == $name)) {
@ -85,46 +93,6 @@ function ryzom_authenticate_with_session(&$name, &$cid, &$error_message) {
return false;
}
function ryzom_get_user_id($cid, $name, $creation_date) {
$name = strtolower($name);
$db = ryDB::getInstance('webig');
$charsWithSameName = $db->query('players', array('name' => $name, 'deleted' => 0));
foreach ($charsWithSameName as $charWithSameName) {
// Another char with same name => delete it
if (intval($cid) != intval($charWithSameName['cid'])) {
$db->update('players', array('deleted' => 1), array('id' => $charWithSameName['id']));
}
}
$charProps = $db->querySingle('players', array('cid' => intval($cid), 'deleted' => 0));
// new char => create record
if (!$charProps) {
$charProps = array('name' => $name, 'cid' => $cid, 'creation_date' => $creation_date, 'deleted' => 0);
$charProps['id'] = $db->insert('players', $charProps);
if (!$charProps['id'])
die('ryDb New Char Error');
} else {
// char deleted and recreated => change to deleted
if ($charProps['creation_date'] != $creation_date) {
if (!$db->update('players', array('deleted' => 1), array('id' => $charProps['id'])))
die('ryDb Delete char Error: '.$db->getErrors());
$charProps = array('name' => $name, 'cid' => $cid, 'creation_date' => $creation_date, 'deleted' => 0);
if (!$charProps['id'] = $db->insert('players', $charProps))
die('ryDb New Char in Slot Error');
} else {
// char renamed => update record
if ($charProps['name'] != $name)
if (!$db->update('players', array('name' => $name), array('id' => $charProps['id'])))
die('ryDb Rename Char Error');
}
}
return $charProps['id'];
}
?>

@ -17,6 +17,8 @@
*/
define('RYAPI_SHARDID', '101');
define('RYAPI_DEV_SHARDID', '301');
define('RYAPI_DEV_SHARD', 'yubo');
define('RYAPI_WEBDB_HOST', 'localhost');
define('RYAPI_WEBDB_LOGIN', 'localhost');
define('RYAPI_WEBDB_PASS', 'localhost');
@ -24,12 +26,17 @@ define('RYAPI_WEBDB_PASS', 'localhost');
define('RYAPI_NELDB_HOST', 'localhost');
define('RYAPI_NELDB_LOGIN', 'shard');
define('RYAPI_NELDB_PASS', 'localhost');
define('RYAPI_NELDB_RING', 'ring_open');
if ($_GET['shardid'] == RYAPI_DEV_SHARDID || (isset($_SESSION['dev_shard']) && $_SESSION['dev_shard']))
define('RYAPI_NELDB_RING', 'ring_dev');
else
define('RYAPI_NELDB_RING', 'ring_open');
define('RYAPI_NELDB_RING_DEV', 'ring_dev');
define('RYAPI_NELDB_NEL', 'nel');
define('RYAPI_AUTH_SCRIPT', '');
define('RYAPI_COOKIE_KEY', '');
define('RYAPI_EGS_SALT', 'RyZoM'); // need be exactly same salt than egs
define('RYAPI_HMAGIC_DEBUG', false); // only :DEV: can use debug hmagic commands
?>

@ -40,6 +40,7 @@ function ryzom_guild_icon($icon, $size) {
$filename = RYAPI_PATH."data/cache/guild_icons/${icon}_$size.png";
if($size != 'b' && $size != 's') die('Bad size parameter');
if($icon == '') die('icon parameter cannot be empty');
if(!file_exists($filename)) {
$command = RYAPI_PATH."server/scripts/generate_guild_icon.sh $icon $size 2>&1";

@ -44,8 +44,9 @@ class ryHmagic {
$this->dfm = new ryDataFileManager(_user()->id);
}
function getWebCommand($web_app_url, $command, $is_next=false, $need_callback=false, $old_sep=false) {
function getWebCommand($web_app_url, $command, $is_next=false, $need_callback=false, $old_sep=false, $replace_space=true) {
$command = str_replace('#player', ryzom_get_param('player_eid'), $command);
if ($replace_space)
$command = str_replace(' ', chr(160), $command);
$last_connected_date = strtotime($_SESSION['last_played_date']);
@ -72,11 +73,8 @@ class ryHmagic {
$eid = ryzom_get_param('datasetid');
$checksum = $web_app_url.'&'.$tid . $last_connected_date . $index_infos['index'] . $command . $eid;
$hmac = strtoupper(hash_hmac('sha1', $checksum, RYAPI_EGS_SALT));
return '
local command = \''.str_replace("'", '\\\'',str_replace('&', '&amp;', $command)).'\'
runCommand("a","webExecCommand","'.str_replace('&', '&amp;', $web_app_url).'&amp;'.$tid.'","'.$index_infos['index'].'",command,"'.$hmac.'","'.($old_sep?'1':'3').'","'.($is_next?'1':'0').'","'.($need_callback?'1':'0').'")
--runCommand("a","webExecCommand","debug", "1", command, "hmac", "2")
';
return ' local command = \''.str_replace("'", '\\\'',str_replace('&', '&amp;', $command)).'\''."\n\t".
(RYAPI_HMAGIC_DEBUG?'runCommand("a","webExecCommand","debug", "1", command, "hmac", "2","'.($is_next?'1':'0').'","'.($need_callback?'1':'0').'")':'runCommand("a","webExecCommand","'.str_replace('&', '&amp;', $web_app_url).'&amp;'.$tid.'","'.$index_infos['index'].'",command,"'.$hmac.'","'.($old_sep?'1':'3').'","'.($is_next?'1':'0').'","'.($need_callback?'1':'0').'")');
}
function validateCallback() {

@ -18,18 +18,22 @@
require_once("include/functions_inc.php");
require_once("class/Entity_abstract.php");
$logto = "std";
if(!$_REQUEST['file']) {
$_REQUEST['file'] = $argv[1];
$logto = $argv[2];
}
if($CONF['logging'] == true) {
require_once("class/Logfile_class.php");
$log = new Logfile($CONF['logfile']);
$log = new Logfile($CONF['logfile'],$logto);
}
$log->logf("File: '".$_REQUEST['file']."'");
$log->logf("Starting up... ",false);
#$log->logf("Starting up... ",false);
if(!$_REQUEST['file']) {
$log->logf("ERROR: no file given! EXITING!");
@ -53,6 +57,8 @@
require_once("class/XMLfile_class.php");
require_once("class/Stats_class.php");
$atom_insert = array();
$_CACHE = new ValueCache();
//new generator for API xml files.
@ -72,7 +78,7 @@
$tmp = explode("/",$_REQUEST['file']);
$tmp2 = explode("_",$tmp[(sizeof($tmp)-1)]);
$DBc->database($CONF['char_mysql_database']);
$DBc->database($CONF['webig_mysql_database']);
$res = $DBc->sendSQL("SELECT id FROM players WHERE cid='".$DBc->mre($tmp2[1]*16+$tmp2[2])."' AND deleted='0'","ARRAY");
#$res[0]['id'] = 1;
@ -83,52 +89,66 @@
}
$cdata = array("cid"=>$res[0]['id'],"aid"=>$tmp2[1],"sid"=>$tmp2[2]);
$DBc_char = new mySQL($CONF['mysql_error']);
$DBc_char->connect($CONF['char_mysql_server'],$CONF['char_mysql_user'],$CONF['char_mysql_pass'],$CONF['char_mysql_database']);
$res = $DBc_char->sendSQL("SELECT race,civilisation,cult FROM characters WHERE char_id='".$DBc_char->mre($tmp2[1]*16+$tmp2[2])."'","ARRAY");
$cdata['race'] = $res[0]['race'];
$cdata['civ'] = $res[0]['civilisation'];
$cdata['cult'] = $res[0]['cult'];
#$cdata = array("cid"=>1,"aid"=>1,"sid"=>1);
$DBc->database($CONF['mysql_database']);
#echo var_export($cdata);
$log->logf(" done!");
#$log->logf(" done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
#foreach($chars as $cid) {
#STEP 1: load and register atoms
$log->logf("Processing char '".$cdata['cid']."' ...");
$log->logf("Processing char '".$cdata['cid']."' (".$cdata['race'].",".$cdata['cult'].",".$cdata['civ'].") ... ");
$log->logi("Loading and registering Atoms... ",false);
#$log->logi("Loading and registering Atoms... ",false);
$atom_list = array();
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_player='".$cdata['cid']."' AND apt_task=at_id) AND at_dev='0'","ARRAY");
foreach($res as $task) {
$tmps = 0;
#$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_player='".$cdata['cid']."' AND apt_task=at_id) AND at_dev='0' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."'))","ARRAY");
#foreach($res as $task) {
//get unfinished atoms belonging to unfinished objectives
$res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective WHERE ao_task='".$task['at_id']."' AND ao_id=atom_objective AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cdata['cid']."' AND apo_objective=ao_id)","ARRAY");
$res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective,ach_task WHERE ao_task=at_id AND ao_id=atom_objective AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cdata['cid']."' AND apo_objective=ao_id) AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_player='".$cdata['cid']."' AND apt_task=at_id) AND at_dev='0' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."'))","ARRAY");
foreach($res2 as $atom) {
$a = new Atom($atom,$cdata);
$atom_list[] = $a;
$atom_list[] = $a;
$a->register();
}
}
$tmps += sizeof($res2);
#}
$log->logf("loaded atoms: ".$tmps);
$statsdb = new Stats();
$statsdb->register();
$log->logf("done!");
#$log->logf("done!");
$log->logf("Memory load: ".memory_get_usage()." bytes");
#$log->logf("Memory load: ".memory_get_usage()." bytes");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
$log->logi("Driving data... ",false);
#$log->logi("Driving data... ",false);
#STEP 2: drive data
$_CACHE->setChar($cdata);
@ -140,8 +160,21 @@
$_DISPATCHER->dispatchValue("sid",$cdata['sid']);
$_DATASOURCE->drive($cdata);
$statsdb->writeData();
if(sizeof($atom_insert) > 0) {
$qry = "INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state,apa_value) VALUES ".implode(',',$atom_insert);
$DBc->sendSQL($qry,"NONE");
}
$log->logf("Inserting atom data: ".sizeof($atom_insert));
#$log->logf("done!");
#$log->logf("Daily stats check/save... ",false);
//save daily stats
$res = $DBc->sendSQL("SELECT COUNT(*) as anz FROM stat_daily WHERE sdm_day='".date("Y-m-d",time())."'","ARRAY");
$res = $DBc->sendSQL("SELECT COUNT(*) as anz FROM stat_daily WHERE sd_day='".date("Y-m-d",time())."'","ARRAY");
if($res[0]['anz'] == 0) {
$res = $DBc->sendSQL("SELECT SUM(sp_money) as all_money, AVG(sp_money) as avg_money, COUNT(*) as playercount FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege=''","ARRAY");
@ -149,45 +182,48 @@
$res3 = $DBc->sendSQL("SELECT SUM(sp_yubototal) as all_yubo, AVG(sp_yubototal) as avg_yubo FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege=''","ARRAY");
$res4 = $DBc->sendSQL("SELECT sp_yubototal FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_money ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res4 = $DBc->sendSQL("SELECT sp_yubototal FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_yubototal ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res5 = $DBc->sendSQL("SELECT SUM(sp_mekcount) as all_mek, AVG(sp_mekcount) as avg_mek FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege=''","ARRAY");
$res6 = $DBc->sendSQL("SELECT sp_mekcount FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_money ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res6 = $DBc->sendSQL("SELECT sp_mekcount FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_mekcount ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res7 = $DBc->sendSQL("SELECT SUM(sp_maxlevel) as all_lvl, AVG(sp_maxlevel) as avg_lvl FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege=''","ARRAY");
$res8 = $DBc->sendSQL("SELECT sp_maxlevel FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_money ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res8 = $DBc->sendSQL("SELECT sp_maxlevel FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_maxlevel ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res9 = $DBc->sendSQL("SELECT SUM(sp_itemcount) as all_item, AVG(sp_itemcount) as avg_item FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege=''","ARRAY");
$res10 = $DBc->sendSQL("SELECT sp_itemcount FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_money ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$res10 = $DBc->sendSQL("SELECT sp_itemcount FROM app_achievements.stat_players as s, webig.players as p, ring_live.characters as c, nel.user as n WHERE s.sp_char = p.id AND p.cid = c.char_id AND c.user_id = n.uid AND n.privilege='' ORDER by sp_itemcount ASC LIMIT ".floor($res[0]['playercount']/2).",1","ARRAY");
$DBc->sendSQL("INSERT IGNORE INTO stat_daily (sd_day,sd_players,sd_money_avg,sd_money_total,sd_money_mean,sd_mek_total,sd_mek_avg,sd_mek_mean,sd_yubo_total,sd_yubo_avg,sd_yubo_mean,sd_lvl_total,sd_lvl_avg,sd_lvl_mean,sd_item_total,sd_item_avg,sd_item_mean) VALUES ('".date("Y-m-d",time())."','".$res[0]['playercount']."','".$res[0]['avg_money']."','".$res[0]['all_money']."','".$res2[0]['sp_money']."','".$res5[0]['all_mek']."','".$res5[0]['avg_mek']."','".$res6[0]['sp_mekcount']."','".$res3[0]['all_yubo']."','".$res3[0]['avg_yubo']."','".$res4[0]['sp_yubototal']."','".$res7[0]['all_lvl']."','".$res7[0]['avg_lvl']."','".$res8[0]['sp_maxlevel']."','".$res9[0]['all_item']."','".$res9[0]['avg_item']."','".$res102[0]['sp_itemcounty']."')","NONE");
$DBc->sendSQL("INSERT IGNORE INTO stat_daily (sd_day,sd_players,sd_money_avg,sd_money_total,sd_money_mean,sd_mek_total,sd_mek_avg,sd_mek_mean,sd_yubo_total,sd_yubo_avg,sd_yubo_mean,sd_lvl_total,sd_lvl_avg,sd_lvl_mean,sd_item_total,sd_item_avg,sd_item_mean) VALUES ('".date("Y-m-d",time())."','".$res[0]['playercount']."','".$res[0]['avg_money']."','".$res[0]['all_money']."','".$res2[0]['sp_money']."','".$res5[0]['all_mek']."','".$res5[0]['avg_mek']."','".$res6[0]['sp_mekcount']."','".$res3[0]['all_yubo']."','".$res3[0]['avg_yubo']."','".$res4[0]['sp_yubototal']."','".$res7[0]['all_lvl']."','".$res7[0]['avg_lvl']."','".$res8[0]['sp_maxlevel']."','".$res9[0]['all_item']."','".$res9[0]['avg_item']."','".$res10[0]['sp_itemcount']."')","NONE");
}
$log->logf("done!");
#$log->logf("done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
$log->logf("xml-gen took: ".$tmp_log_xmlgen_time);
$log->logf("Memory load: ".memory_get_usage()." bytes");
#$log->logf("Memory load: ".memory_get_usage()." bytes");
$log->logi("Writing XML export... ",false);
#$log->logi("Writing XML export... ",false);
$XMLgenerator->generate();
$log->logf("done!");
#$log->logf("done!");
$log->logf("Memory load: ".memory_get_usage()." bytes");
#$log->logf("Memory load: ".memory_get_usage()." bytes");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
for($dtrun=0;$dtrun<2;$dtrun++) {
#STEP 3: detect obj/task progression
$log->logi("Detecting Objectives... ",false);
#$log->logi("Detecting Objectives [PASS ".$dtrun."]... ",false);
#$log->logf("1... ",false);
//obj
$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."') AND NOT EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id AND NOT EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id)","ARRAY");
@ -196,7 +232,7 @@
$DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("1... ",false);
#$log->logf("2... ",false);
$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."') AND ao_value<=(SELECT sum(apa_value) FROM ach_atom,ach_player_atom WHERE atom_objective=ao_id AND apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$cdata['cid']."') AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id)","ARRAY");
$sz = sizeof($res);
@ -204,7 +240,7 @@
$DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("2... ",false);
#$log->logf("3... ",false);
$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."') AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id AND EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id)","ARRAY");
$sz = sizeof($res);
@ -212,64 +248,63 @@
$DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("3... ",false);
#$log->logf("4... ",false);
//meta
#$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective,ach_task as t1,ach_achievement WHERE ao_display='meta' AND ao_task=t1.at_id AND t1.at_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_task as t2 WHERE t2.at_achievement=ao_metalink AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=t2.at_id AND apt_player='".$cdata['cid']."'))","ARRAY");
$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_display='meta' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."') AND NOT EXISTS (SELECT * FROM ach_task WHERE ao_metalink=at_achievement AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."'))","ARRAY");
$res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_display='meta' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."') AND NOT EXISTS (SELECT * FROM ach_task WHERE ao_metalink=at_achievement AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND (EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."') OR NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id)))","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("4... ",false);
$log->logf("done!");
#$log->logf("done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
$log->logi("Clearing atom data... ",false);
#$log->logi("Clearing atom data [PASS ".$dtrun."]... ",false);
//clear atom state for completed objectives
#$DBc->sendSQL("DELETE FROM ach_player_atom WHERE EXISTS (SELECT * FROM ach_player_objective,ach_atom WHERE atom_id=apa_atom AND apa_player='".$cdata['cid']."' AND atom_objective=apo_objective)");
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_player='".$cdata['cid']."' AND EXISTS (SELECT * FROM ach_player_objective,ach_atom WHERE atom_id=apa_atom AND apo_player='".$cdata['cid']."' AND atom_objective=apo_objective)");
$log->logf("done!");
#$log->logf("done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
#$log->logf("Expired time: ".($stop_time - $start_time));
//task
$log->logi("Detecting Tasks... ",false);
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0'","ARRAY");
#$log->logi("Detecting Tasks [PASS ".$dtrun."]... ",false);
#$log->logf("1... ",false);
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."'))","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['at_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("1... ",false);
#$log->logf("2... ",false);
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND at_value<=(SELECT count(*) FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0'","ARRAY");
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND at_value<=(SELECT count(*) FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."'))","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['at_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("2... ",false);
#$log->logf("3... ",false);
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0'","ARRAY");
$res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cdata['cid']."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cdata['cid']."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$cdata['cult'].'|'.$cdata['civ']."'))","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['at_id']."','".$cdata['cid']."','".time()."')","NONE");
}
$log->logf("3... ",false);
/*if($CONF['facebook'] == true) {
require_once("../fb/facebook.php");
@ -305,15 +340,25 @@ $log->logf("3... ",false);
}
}*/
$log->logf("done!");
#}
#$log->logf("done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
#$log->logf("Expired time: ".($stop_time - $start_time));
}
//clear objective data for completed tasks
$DBc->sendSQL("DELETE FROM ach_player_objective WHERE apo_player='".$cdata['cid']."' AND EXISTS (SELECT * FROM ach_player_task,ach_objective WHERE ao_task=apt_task AND apt_player='".$cdata['cid']."' AND ao_id=apo_objective)");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Total time: ".($stop_time - $start_time));
$log->logf("SQL time: ".$DBc->sqltime." / ".$DBc->sqltime_post." / ".$DBc->DBstats['query']);
if(sizeof($DBc->longQuery) > 0) {
$log->logf("Longer queries: ".var_export($DBc->longQuery,true));
}
$log->logf("Run complete; exiting...");
#$log->logf("Run complete; exiting...");
$log->close();
exit(0);
?>

@ -0,0 +1,386 @@
<?php
/*
class.Diff.php
A class containing a diff implementation
Created by Stephen Morley - http://stephenmorley.org/ - and released under the
terms of the CC0 1.0 Universal legal code:
http://creativecommons.org/publicdomain/zero/1.0/legalcode
*/
// A class containing functions for computing diffs and formatting the output.
class Diff{
// define the constants
const UNMODIFIED = 0;
const DELETED = 1;
const INSERTED = 2;
/* Returns the diff for two strings. The return value is an array, each of
* whose values is an array containing two values: a line (or character, if
* $compareCharacters is true), and one of the constants DIFF::UNMODIFIED (the
* line or character is in both strings), DIFF::DELETED (the line or character
* is only in the first string), and DIFF::INSERTED (the line or character is
* only in the second string). The parameters are:
*
* $string1 - the first string
* $string2 - the second string
* $compareCharacters - true to compare characters, and false to compare
* lines; this optional parameter defaults to false
*/
public static function compare(
$string1, $string2, $compareCharacters = false){
// initialise the sequences and comparison start and end positions
$start = 0;
if ($compareCharacters){
$sequence1 = $string1;
$sequence2 = $string2;
$end1 = strlen($string1) - 1;
$end2 = strlen($string2) - 1;
}else{
$sequence1 = preg_split('/\R/', $string1);
$sequence2 = preg_split('/\R/', $string2);
$end1 = count($sequence1) - 1;
$end2 = count($sequence2) - 1;
}
// skip any common prefix
while ($start <= $end1 && $start <= $end2
&& $sequence1[$start] == $sequence2[$start]){
$start ++;
}
// skip any common suffix
while ($end1 >= $start && $end2 >= $start
&& $sequence1[$end1] == $sequence2[$end2]){
$end1 --;
$end2 --;
}
// compute the table of longest common subsequence lengths
$table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2);
// generate the partial diff
$partialDiff =
self::generatePartialDiff($table, $sequence1, $sequence2, $start);
// generate the full diff
$diff = array();
for ($index = 0; $index < $start; $index ++){
$diff[] = array($sequence1[$index], self::UNMODIFIED);
}
while (count($partialDiff) > 0) $diff[] = array_pop($partialDiff);
for ($index = $end1 + 1;
$index < ($compareCharacters ? strlen($sequence1) : count($sequence1));
$index ++){
$diff[] = array($sequence1[$index], self::UNMODIFIED);
}
// return the diff
return $diff;
}
/* Returns the diff for two files. The parameters are:
*
* $file1 - the path to the first file
* $file2 - the path to the second file
* $compareCharacters - true to compare characters, and false to compare
* lines; this optional parameter defaults to false
*/
public static function compareFiles(
$file1, $file2, $compareCharacters = false){
// return the diff of the files
return self::compare(
file_get_contents($file1),
file_get_contents($file2),
$compareCharacters);
}
/* Returns the table of longest common subsequence lengths for the specified
* sequences. The parameters are:
*
* $sequence1 - the first sequence
* $sequence2 - the second sequence
* $start - the starting index
* $end1 - the ending index for the first sequence
* $end2 - the ending index for the second sequence
*/
private static function computeTable(
$sequence1, $sequence2, $start, $end1, $end2){
// determine the lengths to be compared
$length1 = $end1 - $start + 1;
$length2 = $end2 - $start + 1;
// initialise the table
$table = array(array_fill(0, $length2 + 1, 0));
// loop over the rows
for ($index1 = 1; $index1 <= $length1; $index1 ++){
// create the new row
$table[$index1] = array(0);
// loop over the columns
for ($index2 = 1; $index2 <= $length2; $index2 ++){
// store the longest common subsequence length
if ($sequence1[$index1 + $start - 1]
== $sequence2[$index2 + $start - 1]){
$table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1;
}else{
$table[$index1][$index2] =
max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]);
}
}
}
// return the table
return $table;
}
/* Returns the partial diff for the specificed sequences, in reverse order.
* The parameters are:
*
* $table - the table returned by the computeTable function
* $sequence1 - the first sequence
* $sequence2 - the second sequence
* $start - the starting index
*/
private static function generatePartialDiff(
$table, $sequence1, $sequence2, $start){
// initialise the diff
$diff = array();
// initialise the indices
$index1 = count($table) - 1;
$index2 = count($table[0]) - 1;
// loop until there are no items remaining in either sequence
while ($index1 > 0 || $index2 > 0){
// check what has happened to the items at these indices
if ($index1 > 0 && $index2 > 0
&& $sequence1[$index1 + $start - 1]
== $sequence2[$index2 + $start - 1]){
// update the diff and the indices
$diff[] = array($sequence1[$index1 + $start - 1], self::UNMODIFIED);
$index1 --;
$index2 --;
}elseif ($index2 > 0
&& $table[$index1][$index2] == $table[$index1][$index2 - 1]){
// update the diff and the indices
$diff[] = array($sequence2[$index2 + $start - 1], self::INSERTED);
$index2 --;
}else{
// update the diff and the indices
$diff[] = array($sequence1[$index1 + $start - 1], self::DELETED);
$index1 --;
}
}
// return the diff
return $diff;
}
/* Returns a diff as a string, where unmodified lines are prefixed by ' ',
* deletions are prefixed by '- ', and insertions are prefixed by '+ '. The
* parameters are:
*
* $diff - the diff array
* $separator - the separator between lines; this optional parameter defaults
* to "\n"
*/
public static function toString($diff, $separator = "\n"){
// initialise the string
$string = '';
// loop over the lines in the diff
foreach ($diff as $line){
// extend the string with the line
switch ($line[1]){
#case self::UNMODIFIED : $string .= ' ' . $line[0];break;
#case self::DELETED : $string .= '- ' . $line[0];break;
case self::INSERTED : $string .= '' . $line[0];break;
}
// extend the string with the separator
$string .= $separator;
}
// return the string
return $string;
}
/* Returns a diff as an HTML string, where unmodified lines are contained
* within 'span' elements, deletions are contained within 'del' elements, and
* insertions are contained within 'ins' elements. The parameters are:
*
* $diff - the diff array
* $separator - the separator between lines; this optional parameter defaults
* to '<br>'
*/
public static function toHTML($diff, $separator = '<br>'){
// initialise the HTML
$html = '';
// loop over the lines in the diff
foreach ($diff as $line){
// extend the HTML with the line
switch ($line[1]){
case self::UNMODIFIED : $element = 'span'; break;
case self::DELETED : $element = 'del'; break;
case self::INSERTED : $element = 'ins'; break;
}
$html .=
'<' . $element . '>'
. htmlspecialchars($line[0])
. '</' . $element . '>';
// extend the HTML with the separator
$html .= $separator;
}
// return the HTML
return $html;
}
/* Returns a diff as an HTML table. The parameters are:
*
* $diff - the diff array
* $indentation - indentation to add to every line of the generated HTML; this
* optional parameter defaults to ''
* $separator - the separator between lines; this optional parameter
* defaults to '<br>'
*/
public static function toTable($diff, $indentation = '', $separator = '<br>'){
// initialise the HTML
$html = $indentation . "<table class=\"diff\">\n";
// loop over the lines in the diff
$index = 0;
while ($index < count($diff)){
// determine the line type
switch ($diff[$index][1]){
// display the content on the left and right
case self::UNMODIFIED:
$leftCell =
self::getCellContent(
$diff, $indentation, $separator, $index, self::UNMODIFIED);
$rightCell = $leftCell;
break;
// display the deleted on the left and inserted content on the right
case self::DELETED:
$leftCell =
self::getCellContent(
$diff, $indentation, $separator, $index, self::DELETED);
$rightCell =
self::getCellContent(
$diff, $indentation, $separator, $index, self::INSERTED);
break;
// display the inserted content on the right
case self::INSERTED:
$leftCell = '';
$rightCell =
self::getCellContent(
$diff, $indentation, $separator, $index, self::INSERTED);
break;
}
// extend the HTML with the new row
$html .=
$indentation
. " <tr>\n"
. $indentation
. ' <td class="diff'
. ($leftCell == $rightCell
? 'Unmodified'
: ($leftCell == '' ? 'Blank' : 'Deleted'))
. '">'
. $leftCell
. "</td>\n"
. $indentation
. ' <td class="diff'
. ($leftCell == $rightCell
? 'Unmodified'
: ($rightCell == '' ? 'Blank' : 'Inserted'))
. '">'
. $rightCell
. "</td>\n"
. $indentation
. " </tr>\n";
}
// return the HTML
return $html . $indentation . "</table>\n";
}
/* Returns the content of the cell, for use in the toTable function. The
* parameters are:
*
* $diff - the diff array
* $indentation - indentation to add to every line of the generated HTML
* $separator - the separator between lines
* $index - the current index, passes by reference
* $type - the type of line
*/
private static function getCellContent(
$diff, $indentation, $separator, &$index, $type){
// initialise the HTML
$html = '';
// loop over the matching lines, adding them to the HTML
while ($index < count($diff) && $diff[$index][1] == $type){
$html .=
'<span>'
. htmlspecialchars($diff[$index][0])
. '</span>'
. $separator;
$index ++;
}
// return the HTML
return $html;
}
}
?>

@ -0,0 +1,15 @@
<?php
require_once("diff_class.php");
$microstart = explode(' ',microtime());
$start_time = $microstart[0] + $microstart[1];
echo Diff::toString(Diff::compareFiles('old_char_346.xml', 'char_346.xml', false));
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
echo "Expired time: ".($stop_time - $start_time)."<br>";
echo "Memory load: ".memory_get_usage()." bytes";
?>

@ -59,9 +59,11 @@
}
function grant($count = 1) { // grant an atom
global $DBc;
global $DBc,$atom_insert;
#$DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state,apa_value) VALUES ('".$this->id."','".$this->user['cid']."','".time()."',null,'GRANT','".$count."')","NONE");
$DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state,apa_value) VALUES ('".$this->id."','".$this->user['cid']."','".time()."',null,'GRANT','".$count."')","NONE");
$atom_insert[] = "('".$this->id."','".$this->user['cid']."','".time()."',null,'GRANT','".$count."')";
}
function deny() { // deny an atom
@ -73,6 +75,8 @@
function reset_() { // reset progress for this atom
global $DBc;
#$res = $DBc->sendSQL("SELECT * FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user['cid']."'","ARRAY");
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user['cid']."'","NONE");
}

@ -0,0 +1,59 @@
<?php
/*
* Logging, logging, logging....
*/
class Logfile {
private $logfile;
function Logfile($f = false,$logto = "std") {
global $CONF,$MY_PATH;
$this->logfile = false;
if($f != false) {
$ldir = $MY_PATH.$CONF['logfile'].date("Y-m-d",time());
#$tmp = fopen($MY_PATH."/testlog.txt",'a+');
#fwrite($tmp, $ldir.'/'.date("H",time()).".txt\n");
#fclose($tmp);
if(!is_dir($ldir)) {
mkdir($ldir,0777,true);
}
$this->logfile = fopen($ldir.'/'.date("H",time()).'_'.$logto.'.txt','a+');
#echo "kk";
}
}
function logf($t,$nl = true) {
$this->write("[".date("H:i:s")."] ".$t);
if($nl == true) {
$this->write("\n");
}
}
function logi($t,$nl = true) {
#echo $t;
$this->write("[".date("H:i:s")."] > ".$t);
if($nl == true) {
$this->write("\n");
}
}
function write($txt) {
#echo $txt;
if($this->logfile != false) {
fwrite($this->logfile,$txt);
}
}
function close() {
if($this->logfile != false) {
fclose($this->logfile);
}
#echo "ii";
}
}
?>

@ -1,9 +1,27 @@
<?php
class Stats {
#private $user;
private $data;
function Stats() {
global $cdata,$DBc;
#$this->user = $user;
$DBc->sendSQL("INSERT IGNORE INTO stat_players (sp_char) VALUES ('".$cdata['cid']."')","NONE");
$this->data = array();
}
function setValue($k,$v) {
global $DBc;
$this->data[] = $k."='".$DBc->mre($v)."'";
}
function writeData() {
global $DBc,$cdata;
$DBc->sendSQL("UPDATE stat_players SET ".implode(',',$this->data)." WHERE sp_char='".$cdata['cid']."'","NONE");
}
function register() { // register the stats code

@ -17,7 +17,15 @@
function writeData($key,$val) { // write to cache
global $DBc;
$DBc->sendSQL("INSERT INTO ach_player_valuecache (apv_name,apv_player,apv_value,apv_date) VALUES ('".$DBc->mre($key)."','".$this->char."','".$DBc->mre($val)."','".time()."') ON DUPLICATE KEY UPDATE apv_value='".$DBc->mre($val)."', apv_date='".time()."'","NONE");
$res = $DBc->sendSQL("SELECT count(*) as anz FROM ach_player_valuecache WHERE apv_name='".$DBc->mre($key)."' AND apv_player='".$this->char."'","ARRAY");
if($res[0]['anz'] == 0) {
$DBc->sendSQL("INSERT DELAYED INTO ach_player_valuecache (apv_name,apv_player,apv_value,apv_date) VALUES ('".$DBc->mre($key)."','".$this->char."','".$DBc->mre($val)."','".time()."')","NONE");
}
else {
$DBc->sendSQL("UPDATE ach_player_valuecache SET apv_value='".$DBc->mre($val)."', apv_date='".time()."' WHERE apv_name='".$DBc->mre($key)."' AND apv_player='".$this->char."'","NONE");
}
}
function getData($key) { // read from cache

@ -82,24 +82,30 @@
$xml .= "<xml>\n";
$xml .= " <cached>".time()."</cached>\n";
$xml .= " <uniqueid>".$cdata['cid']."</uniqueid>\n";
$xml .= " <accountid>".$cdata['aid']."</accountid>\n";
$xml .= " <charslotid>".$cdata['sid']."</charslotid>\n";
#$xml .= " <accountid>".$cdata['aid']."</accountid>\n";
#$xml .= " <charslotid>".$cdata['sid']."</charslotid>\n";
$xml .= $elem->generate(' ');
$xml .= "</xml>";
$cid = ($cdata['aid']*16+$cdata['sid']);
//store
$pth = $CONF['export_xml_path'].$elem->getIdent()."/".($cdata['cid']%10);
$pth = $CONF['export_xml_path'].$elem->getIdent()."/".($cid%10);
if(!is_dir($pth)) {
mkdir($pth,0777,true);
}
$f = fopen($pth."/".$cdata['cid'].".xml","w");
$f = fopen($pth."/".$cid.".xml","w");
fwrite($f,$xml);
fclose($f);
$old = umask();
chmod($pth."/".$cid.".xml", 0777);
umask($old);
}
}
}

@ -7,8 +7,13 @@
private $parent = null;
function XMLNode($n = null,$v = null,$p = null) {
if(is_numeric($n)) {
$this->name = "_".$n;
}
else {
$this->name = $n;
$this->value = $v;
}
$this->value = htmlspecialchars($v);
$this->parent = $p;
}
@ -21,11 +26,16 @@
}
function setName($n) {
if(is_numeric($n)) {
$this->name = "_".$n;
}
else {
$this->name = $n;
}
}
function setValue($v) {
$this->value = $v;
$this->value = htmlspecialchars($v);
}
function addArg($k,$v) {

@ -6,6 +6,9 @@
var $DBc;
var $DBstats;
var $cached;
var $sqltime;
var $sqltime_post;
var $longQuery;
function mre($in) { // shorter than "mysql_real_escape_string"
if(is_array($in)) {
@ -31,6 +34,9 @@
}
$this->resetStats(); // reset stats counter
$this->cached = false;
$this->sqltime = 0;
$this->sqltime_post = 0;
$this->longQuery = array();
}
function connect($ip,$user,$pass,$db=false) { // connect
@ -62,6 +68,9 @@
return false;
}
$microstart = explode(' ',microtime());
$start_time = $microstart[0] + $microstart[1];
if($buffer === false && $handling !== "PLAIN") {
$res = mysql_unbuffered_query($query,$this->DBc) or $this->error(mysql_error(),$query);
}
@ -71,6 +80,15 @@
$this->DBstats['query']++;
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
if(($stop_time - $start_time) > 0.5) {
$this->longQuery[] = array(($stop_time - $start_time),$query);
}
$this->sqltime += ($stop_time - $start_time);
if($res) {
if($handling === "INSERT") {
$tmp = mysql_insert_id($this->DBc) or $this->error(mysql_error());;
@ -83,7 +101,16 @@
return $tmp;
}
elseif($handling === "ARRAY") {
$microstart = explode(' ',microtime());
$start_time = $microstart[0] + $microstart[1];
$tmp = $this->parseSql($res);
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$this->sqltime_post += ($stop_time - $start_time);
$this->unlinkSql($res);
return $tmp;
}

@ -7,7 +7,7 @@
$CONF = array();
$CONF['logging'] = true;
$CONF['logfile'] = "/log/AchWebParser.log";
$CONF['logfile'] = "/log/";
$CONF['mysql_error'] = "LOG";
$CONF['mysql_server'] = RYAPI_WEBDB_HOST;
@ -15,13 +15,15 @@
$CONF['mysql_pass'] = RYAPI_WEBDB_PASS;
$CONF['mysql_database'] = "app_achievements";
#$CONF['char_mysql_server'] = RYAPI_NELDB_HOST;
#$CONF['char_mysql_user'] = RYAPI_NELDB_LOGIN;
#$CONF['char_mysql_pass'] = RYAPI_NELDB_PASS;
$CONF['char_mysql_database'] = "webig";
$CONF['webig_mysql_database'] = "webig";
$CONF['export_xml_path'] = RYAPI_PATH."data/cache/players/";
#$CONF['export_xml_path'] = "testxml/";
$CONF['char_mysql_server'] = RYAPI_NELDB_HOST;
$CONF['char_mysql_user'] = RYAPI_NELDB_LOGIN;
$CONF['char_mysql_pass'] = RYAPI_NELDB_PASS;
$CONF['char_mysql_database'] = RYAPI_NELDB_RING;
$CONF['export_xml_path'] = "../../../data/cache/players/";
#$CONF['export_xml_path'] = "cache/players/";
$CONF['data_source'] = array("PDRtoXMLdriver");

@ -0,0 +1,5 @@
#!/bin/sh -
cd /home/api/public_html/server/scripts/achievement_script
sudo -u api nohup ./parse_new_xml.sh &

@ -0,0 +1,22 @@
#!/bin/sh
cd /home/api/public_html/server/scripts/achievement_script
SRC=/home/api/public_html/server/scripts/achievement_script/new_xml
DST=/home/api/public_html/server/scripts/achievement_script/parse_xml
while true; do
FN=`inotifywait -r -e close_write --format '%w%f' $SRC`
for f in $SRC/*; do
NAME="$DST/"`basename $f`
mv -f $f $DST
echo "Processing $NAME"
php AchWebParser.php $NAME
rm -f $NAME
done
done
#cd -

@ -0,0 +1,22 @@
<?php
$region = array();
$region['aeden'] = array("13780 -31556 ","13780 -33532 ","14364 -34876 ","19636 -34860 ","19996 -30660 ","19988 -29724 ","18676 -29452 ","14372 -29444 ","13780 -31556"); // Aeden Aqueous
$region['desert'] = array("15848 -23868 ","15944 -26572 ","17208 -27026 ","20280 -27020 ","20296 -26364 ","20312 -23868 ","18832 -23840 ","15848 -23868"); // Burning Desert
$region['verdant'] = array("3432 -4828 ","2920 -6076 ","2904 -7644 ","6048 -7836 ","6232 -6276 ","6176 -5436 ","5256 -3532 ","6240 -804 ","-249456 -348 ","3944 -340 ","376 -324 ","-254400 -1068 ","616 -2668 ","2744 -3100 ","3432 -4828"); // Verdant Heights
$region['witherings'] = array("6924 -968 ","6892 -2096 ","7028 -4632 ","8180 -4120 ","9628 -5176 ","12084 -5904 ","12420 -5552 ","12300 -2784 ","12460 -1464 ","11444 -984 ","9516 -1400 ","8220 -976 ","6924 -968"); // The Witherings
$region['nexus'] = array("7852 -6836 ","7860 -7156 ","8604 -8292 ","9140 -8300 ","2712 -6788 ","9724 -6564 ","9556 -6108 ","9012 -6116 ","7852 -6836"); // Nexus
$region['ichor'] = array("536 -10336 ","488 -11168 ","680 -11320 ","1592 -11320 ","2080 -3708 ","696 -9792 ","536 -10336"); // Abyss of Ichor
$region['spring'] = array("3484 -9776 ","2572 -10224 ","2620 -11008 ","3260 -11344 ","3804 -10912 ","3836 -10240 ","3484 -9776"); // Under Spring
$region['wastelands'] = array("204 -14072 ","748 -15336 ","2140 -15816 ","2988 -15704 ","2956 -13144 ","732 -13128 ","172 -13736 ","204 -14072"); // Wastelands
$region['umbra'] = array("5456 -9788 ","5440 -16936 ","7200 -16952 ","7344 -12472 ","6304 -9624 ","5456 -9788"); // Lands of Umbra
?>

@ -0,0 +1,89 @@
<?php
$this->registerValue("_money","_statsdb_money");
function _statsdb_money($money,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "_money";
#$DBc->sendSQL("UPDATE stat_players SET sp_money='".$money."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_money',$money);
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("_race","_statsdb_race");
function _statsdb_race($race,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "_race";
$race = "r_".strtolower($race);
#$DBc->sendSQL("UPDATE stat_players SET sp_race='".$race."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_race',$race);
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("yubopoints","_statsdb_yubototal");
function _statsdb_yubototal($yubo,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "yubopoints";
#$DBc->sendSQL("UPDATE stat_players SET sp_yubototal='".$yubo."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_yubototal',$yubo);
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("petcount","_statsdb_mekcount");
function _statsdb_mekcount($count,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "petcount";
#$DBc->sendSQL("UPDATE stat_players SET sp_mekcount='".$count."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_mekcount',$count);
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerEntity("skilllist","_statsdb_maxlevel");
function _statsdb_maxlevel($skills,$_P,$_CB) {
global $cdata,$DBc,$log,$statsdb;
$_IDENT = "skilllist";
#$log->logf("rcv skilllist: ".var_export($skills,true));
$lvl = 0;
foreach($skills->skills as $elem) {
if($elem->current > $lvl) {
$lvl = $elem->current;
}
}
#$DBc->sendSQL("UPDATE stat_players SET sp_maxlevel='".$lvl."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_maxlevel',$lvl);
$_P->unregisterEntity($_IDENT,$_CB);
}
$this->registerValue("_guildid","_statsdb_guildid");
function _statsdb_guildid($id,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "_guildid";
#$DBc->sendSQL("UPDATE stat_players SET sp_guildid='".$id."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_guildid',$id);
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("itemcount","_statsdb_itemcount");
function _statsdb_itemcount($count,$_P,$_CB) {
global $cdata,$DBc,$statsdb;
$_IDENT = "itemcount";
#$DBc->sendSQL("UPDATE stat_players SET sp_itemcount='".$count."' WHERE sp_char='".$cdata['cid']."'","NONE");
$statsdb->setValue('sp_itemcount',$count);
$_P->unregisterValue($_IDENT,$_CB);
}
?>

@ -0,0 +1,29 @@
<?php
class BillingSummary extends SourceDriver {
function drive($cdata) {
/*
global $DBc_char,$_DISPATCHER;
$res = $DBc_char->sendSQL("SELECT SUM(amount) as anz, currency FROM coupons_billing WHERE iduser='".$cdata['aid']."' AND status='captured' GROUP by 'currency'","ARRAY");
$billed = 0;
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
if($res[$i]['currency'] == "USD") {
$res[$i]['anz'] = $res[$i]['anz']*0.7950;
}
if($res[$i]['currency'] == "GBP") {
$res[$i]['anz'] = $res[$i]['anz']*1.2623;
}
$billed += $res[$i]['anz'];
}
$_DISPATCHER->dispatchValue("user_billed_sum",$billed);*/
}
}
?>

@ -26,6 +26,8 @@
require_once($BASE_PATH."/entity/FriendOf_entity.php");
require_once($BASE_PATH."/entity/Title_entity.php");
require_once($BASE_PATH."/entity/RespawnPoints_entity.php");
require_once($BASE_PATH."/entity/DeathPenalty_entity.php");
require_once($BASE_PATH."/entity/TPlist_entity.php");
class PDRtoXMLdriver extends SourceDriver {
private $ignore;
@ -40,12 +42,23 @@
private $petcount;
private $friendlist;
private $itemcount;
private $tplist;
private $hasChoice;
private $hasExcellent;
private $hasSupreme;
private $itemignore;
private $tracked_items;
private $tracked_items_new;
private $tool_list;
private $respawn_outer = 0; // needed to fetch respawn points due to nested tags with same name...
private $pathid = array();
function PDRtoXMLdriver() {
global $DBc,$cdata;
$this->lock = 0;
$this->open = null;
@ -60,6 +73,23 @@
$this->skills = new SkillList();
$this->mission = new MissionList();
$this->friendlist = new Friendlist();
$this->tplist = new TPlist();
$this->hasChoice = false;
$this->hasExcellent = false;
$this->hasSupreme = false;
$this->tool_list = array('itrtje.sitem','icokamtjewel_1.sitem','icokamtjewel_2.sitem','icokartjewel_1.sitem','icokartjewel_2.sitem','itjewel.sitem','itmwea.sitem','itrtmw.sitem','icokamtmwea_1.sitem','icokamtmwea_2.sitem','icokartmwea_1.sitem','icokartmwea_2.sitem','itrtfo.sitem','itforage.sitem','itforagekam_ep2_1.sitem','itforagekam_ep2_2.sitem','itforagekam_ep2_3.sitem','itforagekar_ep2_1.sitem','itforagekar_ep2_2.sitem','itforagekar_ep2_3.sitem','icokamtforage_1.sitem','icokamtforage_2.sitem','icokartforage_1.sitem','icokartforage_2.sitem','itrwea.sitem','itrtrw.sitem','icokamtrwea_1.sitem','icokamtrwea_2.sitem','icokartrwea_1.sitem','icokartrwea_2.sitem','itammo.sitem','itrtam.sitem','icokamtammo_1.sitem','icokamtammo_2.sitem','icokartammo_1.sitem','icokartammo_2.sitem','itarmor.sitem','itrtar.sitem','icokamtarmor_1.sitem','icokamtarmor_2.sitem','icokartarmor_1.sitem','icokartarmor_2.sitem');
$this->itemignore = false;
$this->tracked_items = array();
$res = $DBc->sendSQL("SELECT api_item FROM ach_player_item WHERE api_player='".$cdata['cid']."'","ARRAY");
foreach($res as $elem) {
$this->tracked_items[] = $elem['api_item'];
}
$this->tracked_items_new = array();
//these nodes are ignored, but children are processed
$this->ignore = array();
@ -84,7 +114,6 @@
$this->ignore_block[] = "_CONSUMABLEOVERDOSEENDDATES";
$this->ignore_block[] = "_MODIFIERSINDB";
$this->ignore_block[] = "_MISSIONS";
$this->ignore_block[] = "_ITEMSINSHOPSTORE";
$this->ignore_block[] = "RINGREWARDPOINTS";
$this->ignore_block[] = "_PACT";
$this->ignore_block[] = "_KNOWNPHRASES";
@ -96,12 +125,13 @@
$this->ignore_block[] = "_KNOWNBRICKS";
$this->ignore_block[] = "_BOUGHTPHRASES";
$this->ignore_block[] = "SKILLPOINTS";
$this->ignore_block[] = "SPENTSKILLPOINTS";
#$this->ignore_block[] = "SPENTSKILLPOINTS";
$this->ignore_block[] = "_LASTLOGSTATS";
$this->ignore_block[] = "FACTIONPOINTS";
}
function drive($cdata) {
global $_DISPATCHER,$MY_PATH,$log;
global $_DISPATCHER,$MY_PATH,$log,$DBc;
#$file = $this->conf['xml_dir']."account_".$uid."_".$slot."_pdr.xml";
$file = $_REQUEST['file'];
@ -129,9 +159,23 @@
#echo var_export($this->gear,true);
$_DISPATCHER->dispatchEntity($this->skills->getName(),$this->skills);
$_DISPATCHER->dispatchEntity($this->friendlist->getName(),$this->friendlist);
#$_DISPATCHER->dispatchEntity($this->skills->mission(),$this->mission);
$_DISPATCHER->dispatchEntity($this->tplist->getName(),$this->tplist);
$_DISPATCHER->dispatchValue('petcount',$this->petcount);
$_DISPATCHER->dispatchValue('itemcount',$this->itemcount);
$_DISPATCHER->dispatchValue('has_choice',$this->hasChoice);
$_DISPATCHER->dispatchValue('has_excellent',$this->hasExcellent);
$_DISPATCHER->dispatchValue('has_supreme',$this->hasSupreme);
$qry = array();
foreach($this->tracked_items_new as $elem) {
$qry[] = "('".$DBc->mre($elem)."','".$cdata['cid']."','".time()."')";
}
if(sizeof($qry) > 0) {
$DBc->sendSQL("INSERT DELAYED INTO ach_player_item (api_item,api_player,api_date) VALUES ".implode(',',$qry),"NONE");
}
$DBc->sendSQL("DELETE FROM ach_player_item WHERE api_date<'".(time()-605800)."'","NONE");
}
function startElement($parser, $name, $attrs) {
@ -154,8 +198,40 @@
return null;
}
/* has shop item */
if($name == '_ITEMSFORSALE') {
$this->lock = 1;
$this->ignore_block[] = "_ITEMSINSHOPSTORE";
$_DISPATCHER->dispatchValue('has_store',true);
}
/* death penalty */
if($name == "_DEATHPENALTIES") {
$this->open = "_DEATHPENALTIES";
$this->entity = new DeathPenalty();
return null;
}
if($this->open == "_DEATHPENALTIES") {
if($name == "_NBDEATH") {
$this->entity->NbDeath = $attrs['VALUE'];
}
if($name == "_CURRENTDEATHXP") {
$this->entity->CurrentDeathXP = $attrs['VALUE'];
}
if($name == "_DEATHXPTOGAIN") {
$this->entity->DeathXPToGain = $attrs['VALUE'];
}
if($name == "_BONUSUPDATETIME") {
$this->entity->BonusUpdateTime = $attrs['VALUE'];
}
}
/* spawn points */
if($name == "RESPAWNPOINTS" && !$attrs["VALUE"]) {
if($name == "RESPAWNPOINTS" && !$attrs['VALUE']) {
$this->open = "RESPAWNPOINTS";
$this->entity = new RespawnPoints();
return null;
@ -164,7 +240,7 @@
if($this->open == "RESPAWNPOINTS") {
if($name == "RESPAWNPOINTS") {
$this->respawn_outer = 0;
$this->entity->spawns[] = $attrs["VALUE"];
$this->entity->spawns[] = $attrs['VALUE'];
}
}
@ -177,12 +253,12 @@
if($this->open == "FACTIONPOINTS") {
if($name == "__KEY__") {
$this->entity = new FactionPoints();
$this->entity->faction = $attrs["VALUE"];
$this->entity->faction = $attrs['VALUE'];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$this->entity->value = $attrs['VALUE'];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -200,20 +276,20 @@
if($this->open == "_FAME") {
if($name == "__KEY__") {
$this->entity = new Fame();
$this->entity->faction = $attrs["VALUE"];
$this->entity->faction = $attrs['VALUE'];
return null;
}
if($name == "FAME") {
$this->entity->fame = $attrs["VALUE"];
$this->entity->fame = $attrs['VALUE'];
return null;
}
if($name == "FAMEMEMORY") {
$this->entity->famememory = $attrs["VALUE"];
$this->entity->famememory = $attrs['VALUE'];
return null;
}
if($name == "LASTFAMECHANGETREND") {
$this->entity->lastfamechangetrend = $attrs["VALUE"];
$this->entity->lastfamechangetrend = $attrs['VALUE'];
return null;
}
@ -229,15 +305,15 @@
if($this->open == "_LASTLOGSTATS") {
if($name == "LOGINTIME") {
$this->entity->logintime = $attrs["VALUE"];
$this->entity->logintime = $attrs['VALUE'];
return null;
}
if($name == "DURATION") {
$this->entity->duration = $attrs["VALUE"];
$this->entity->duration = $attrs['VALUE'];
return null;
}
if($name == "LOGOFFTIME") {
$this->entity->logofftime = $attrs["VALUE"];
$this->entity->logofftime = $attrs['VALUE'];
return null;
}
@ -253,16 +329,16 @@
if($this->open == "_MISSIONHISTORIES") {
if($name == "__KEY__") {
$this->entity = new Mission();
$this->entity->mission = $attrs["VALUE"];
$this->entity->mission = $attrs['VALUE'];
return null;
}
if($name == "SUCCESSFULL") {
$this->entity->successfull = $attrs["VALUE"];
$this->entity->successfull = $attrs['VALUE'];
return null;
}
if($name == "UTC_LASTSUCCESSDATE") {
$this->entity->utc_lastsuccessdate = $attrs["VALUE"];
$this->entity->utc_lastsuccessdate = $attrs['VALUE'];
return null;
}
@ -271,14 +347,14 @@
if($name == "_FRIENDSLIST") {
$this->entity = new Friend();
$this->entity->id = $attrs["VALUE"];
$this->entity->id = $attrs['VALUE'];
$this->friendlist->friends[] = $this->entity;
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
}
if($name == "_ISFRIENDOF") {
$this->entity = new FriendOf();
$this->entity->id = $attrs["VALUE"];
$this->entity->id = $attrs['VALUE'];
$this->friendlist->friendof[] = $this->entity;
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
}
@ -292,12 +368,12 @@
if($this->open == "SCOREPERMANENTMODIFIERS") {
if($name == "__KEY__") {
$this->entity = new PermanentMod();
$this->entity->score = $attrs["VALUE"];
$this->entity->score = $attrs['VALUE'];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$this->entity->value = $attrs['VALUE'];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -315,65 +391,65 @@
if($this->open == "_PLAYERPETS") {
if($name == "__KEY__") {
$this->entity = new Pet();
$this->entity->pet = $attrs["VALUE"];
$this->entity->pet = $attrs['VALUE'];
return null;
}
if($name == "TICKETPETSHEETID") {
$this->entity->ticketpetsheetid = $attrs["VALUE"];
$this->entity->ticketpetsheetid = $attrs['VALUE'];
return null;
}
if($name == "PETSHEETID") {
$this->entity->petsheetid = $attrs["VALUE"];
$this->entity->petsheetid = $attrs['VALUE'];
$this->petcount++;
return null;
}
if($name == "PRICE") {
$this->entity->price = $attrs["VALUE"];
$this->entity->price = $attrs['VALUE'];
return null;
}
if($name == "OWNERID") {
$this->entity->ownerid = $attrs["VALUE"];
$this->entity->ownerid = $attrs['VALUE'];
return null;
}
if($name == "STABLEALIAS") {
$this->entity->stablealias = $attrs["VALUE"];
$this->entity->stablealias = $attrs['VALUE'];
return null;
}
if($name == "LANDSCAPE_X") {
$this->entity->landscape_x = $attrs["VALUE"];
$this->entity->landscape_x = $attrs['VALUE'];
return null;
}
if($name == "LANDSCAPE_Y") {
$this->entity->landscape_y = $attrs["VALUE"];
$this->entity->landscape_y = $attrs['VALUE'];
return null;
}
if($name == "LANDSCAPE_Z") {
$this->entity->landscape_z = $attrs["VALUE"];
$this->entity->landscape_z = $attrs['VALUE'];
return null;
}
if($name == "UTC_DEATHTICK") {
$this->entity->utc_deathtick = $attrs["VALUE"];
$this->entity->utc_deathtick = $attrs['VALUE'];
return null;
}
if($name == "PETSTATUS") {
$this->entity->petstatus = $attrs["VALUE"];
$this->entity->petstatus = $attrs['VALUE'];
return null;
}
if($name == "SLOT") {
$this->entity->slot = $attrs["VALUE"];
$this->entity->slot = $attrs['VALUE'];
return null;
}
if($name == "ISTPALLOWED") {
$this->entity->istpallowed = $attrs["VALUE"];
$this->entity->istpallowed = $attrs['VALUE'];
return null;
}
if($name == "SATIETY") {
$this->entity->satiety = $attrs["VALUE"];
$this->entity->satiety = $attrs['VALUE'];
return null;
}
if($name == "CUSTOMNAME") {
$this->entity->customname = $attrs["VALUE"];
$this->entity->customname = $attrs['VALUE'];
return null;
}
@ -389,12 +465,12 @@
if($this->open == "_PHYSICALCHARACTERISTICS") {
if($name == "__KEY__") {
$this->entity = new PhysCharacs();
$this->entity->charac = $attrs["VALUE"];
$this->entity->charac = $attrs['VALUE'];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$this->entity->value = $attrs['VALUE'];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -412,32 +488,32 @@
if($this->open == "PHYSICALSCORES") {
if($name == "__KEY__") {
$this->entity = new PhysScores();
$this->entity->score = $attrs["VALUE"];
$this->entity->score = $attrs['VALUE'];
return null;
}
if($name == "CURRENT") {
$this->entity->current = $attrs["VALUE"];
$this->entity->current = $attrs['VALUE'];
return null;
}
if($name == "BASE") {
$this->entity->base = $attrs["VALUE"];
$this->entity->base = $attrs['VALUE'];
return null;
}
if($name == "MAX") {
$this->entity->max = $attrs["VALUE"];
$this->entity->max = $attrs['VALUE'];
return null;
}
if($name == "BASEREGENERATEREPOS") {
$this->entity->baseregeneraterepos = $attrs["VALUE"];
$this->entity->baseregeneraterepos = $attrs['VALUE'];
return null;
}
if($name == "BASEREGENERATEACTION") {
$this->entity->baseregenerateaction = $attrs["VALUE"];
$this->entity->baseregenerateaction = $attrs['VALUE'];
return null;
}
if($name == "CURRENTREGENERATE") {
$this->entity->currentregenerate = $attrs["VALUE"];
$this->entity->currentregenerate = $attrs['VALUE'];
return null;
}
@ -453,12 +529,12 @@
if($this->open == "SKILLPOINTS") {
if($name == "__KEY__") {
$this->entity = new SkillPoints();
$this->entity->skill = $attrs["VALUE"];
$this->entity->skill = $attrs['VALUE'];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$this->entity->value = $attrs['VALUE'];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -476,12 +552,12 @@
if($this->open == "SPENTSKILLPOINTS") {
if($name == "__KEY__") {
$this->entity = new SpentSkillPoints();
$this->entity->skill = $attrs["VALUE"];
$this->entity->skill = $attrs['VALUE'];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$this->entity->value = $attrs['VALUE'];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -499,28 +575,28 @@
if($this->open == "SKILLS") {
if($name == "__KEY__") {
$this->entity = new Skill();
$this->entity->skill = $attrs["VALUE"];
$this->entity->skill = $attrs['VALUE'];
return null;
}
if($name == "BASE") {
$this->entity->base = $attrs["VALUE"];
$this->entity->base = $attrs['VALUE'];
return null;
}
if($name == "CURRENT") {
$this->entity->current = $attrs["VALUE"];
$this->entity->current = $attrs['VALUE'];
return null;
}
if($name == "MAXLVLREACHED") {
$this->entity->maxlvlreached = $attrs["VALUE"];
$this->entity->maxlvlreached = $attrs['VALUE'];
return null;
}
if($name == "XP") {
$this->entity->xp = $attrs["VALUE"];
$this->entity->xp = $attrs['VALUE'];
return null;
}
if($name == "XPNEXTLVL") {
$this->entity->xpnextlvl = $attrs["VALUE"];
$this->entity->xpnextlvl = $attrs['VALUE'];
return null;
}
@ -536,19 +612,19 @@
if($this->open == "POSSTATE") {
if($name == "X") {
$this->entity->x = $attrs["VALUE"];
$this->entity->x = $attrs['VALUE'];
return null;
}
if($name == "Y") {
$this->entity->y = $attrs["VALUE"];
$this->entity->y = $attrs['VALUE'];
return null;
}
if($name == "Z") {
$this->entity->z = $attrs["VALUE"];
$this->entity->z = $attrs['VALUE'];
return null;
}
if($name == "HEADING") {
$this->entity->heading = $attrs["VALUE"];
$this->entity->heading = $attrs['VALUE'];
return null;
}
@ -569,99 +645,138 @@
if($this->iblock == true) {
if($name == "__KEY__") {
$this->inv = $attrs["VALUE"];
$this->inv = $attrs['VALUE'];
}
if($name == "__VAL__") {
return null;
}
}
if($name == "_ITEMS" || $name == "_ITEM") {
if($name == '_ITEMS' || $name == '_ITEM') {
#echo "i<br>";
$this->open = "_ITEM";
$this->open = '_ITEM';
$this->entity = new Item();
$this->entity->inventory = $this->inv;
$this->itemcount++;
return null;
}
if($this->open == "_ITEM") {
if($name == "_CRAFTPARAMETERS") {
if($this->open == '_ITEM') {
if($this->itemignore == true) {
return null;
}
if($name == '_CRAFTPARAMETERS') {
$this->icraft = true;
return null;
}
if($this->icraft == true) {
$this->entity->_craftparameters[strtolower($name)] = $attrs["VALUE"];
if($name == 'HPBUFF' || $name == 'SAPBUFF' || $name == 'FOCUSBUFF' || $name == 'STABUFF') {
$this->entity->_craftparameters[strtolower($name)] = $attrs['VALUE'];
}
return null;
}
if($name == "_ITEMID") {
$this->entity->_itemid = $attrs["VALUE"];
if($name == '_ITEMID') {
$this->entity->_itemid = $attrs['VALUE'];
return null;
}
if($name == "_SHEETID") {
if($attrs["VALUE"]{0} == "#") {
$tmp = str_replace("#","",$attrs["VALUE"]);
if($name == '_SHEETID') {
if($attrs['VALUE']{0} == '#') {
$tmp = str_replace("#","",$attrs['VALUE']);
$res = $DBc->sendSQL("SELECT * FROM ryzom_nimetu_sheets WHERE nsh_numid='".$tmp."'","ARRAY");
$attrs["VALUE"] = $res[0]['nsh_name']."".$res[0]['nsh_suffix'];
$attrs['VALUE'] = $res[0]['nsh_name']."".$res[0]['nsh_suffix'];
}
if(substr($attrs['VALUE'],0,3) == 'tp_') {
$this->tplist->tps[] = $attrs['VALUE'];
$this->itemignore = true;
return null;
}
if(substr($attrs['VALUE'],0,1) == 'm') {
$this->itemignore = true;
if($this->hasChoice == false || $this->hasExcellent == false || $this->hasSupreme == false) {
switch(substr($attrs['VALUE'],-9,-8)) {
case 'f':
$this->hasSupreme = true;
break;
case 'e':
$this->hasExcellent = true;
break;
case 'd':
$this->hasChoice = true;
break;
}
}
return null;
}
$this->entity->_sheetid = $attrs['VALUE'];
if($this->entity->inventory != 'bag' && in_array($this->entity->_itemid,$this->tracked_items) && !in_array($this->entity->_sheetid,$this->tool_list)) {
$this->itemignore = true;
}
$this->entity->_sheetid = $attrs["VALUE"];
$this->tracked_items_new[] = $this->entity->_itemid;
return null;
}
if($name == "_LOCSLOT") {
$this->entity->_locslot = $attrs["VALUE"];
if($name == '_LOCSLOT') {
$this->entity->_locslot = $attrs['VALUE'];
return null;
}
if($name == "_HP") {
$this->entity->_hp = $attrs["VALUE"];
if($name == '_HP') {
$this->entity->_hp = $attrs['VALUE'];
return null;
}
if($name == "_RECOMMENDED") {
$this->entity->_recommended = $attrs["VALUE"];
if($name == '_RECOMMENDED') {
$this->entity->_recommended = $attrs['VALUE'];
return null;
}
if($name == "_CREATORID") {
$this->entity->_creatorid = $attrs["VALUE"];
if($name == '_CREATORID') {
$this->entity->_creatorid = $attrs['VALUE'];
return null;
}
if($name == "_PHRASEID") {
$this->entity->_phraseid = $attrs["VALUE"];
if($name == '_PHRASEID') {
$this->entity->_phraseid = $attrs['VALUE'];
return null;
}
if($name == "_REFINVENTORYSLOT") {
$this->entity->_refinventoryslot = $attrs["VALUE"];
if($name == '_REFINVENTORYSLOT') {
$this->entity->_refinventoryslot = $attrs['VALUE'];
#if($this->entity->refinventoryid != null) {
$this->gear->items[] = $this->entity;
#}
return null;
}
if($name == "REFINVENTORYID") {
$this->entity->refinventoryid = $attrs["VALUE"];
if($name == 'REFINVENTORYID') {
$this->entity->refinventoryid = $attrs['VALUE'];
return null;
}
if($name == "_USENEWSYSTEMREQUIREMENT") {
$this->entity->_usenewsystemrequirement = $attrs["VALUE"];
if($name == '_USENEWSYSTEMREQUIREMENT') {
$this->entity->_usenewsystemrequirement = $attrs['VALUE'];
return null;
}
if($name == "_REQUIREDSKILLLEVEL") {
$this->entity->_requiredskilllevel = $attrs["VALUE"];
if($name == '_REQUIREDSKILLLEVEL') {
$this->entity->_requiredskilllevel = $attrs['VALUE'];
return null;
}
if($name == "_CUSTOMTEXT") {
$this->entity->_customtext = $attrs["VALUE"];
if($name == '_CUSTOMTEXT') {
$this->entity->_customtext = $attrs['VALUE'];
return null;
}
if($name == "_LOCKEDBYOWNER") {
$this->entity->_lockedbyowner = $attrs["VALUE"];
if($name == '_LOCKEDBYOWNER') {
$this->entity->_lockedbyowner = $attrs['VALUE'];
return null;
}
if($name == "_DROPABLE") {
$this->entity->_dropable = $attrs["VALUE"];
if($name == '_DROPABLE') {
$this->entity->_dropable = $attrs['VALUE'];
return null;
}
if($name == "STACKSIZE") {
$this->entity->stacksize = $attrs["VALUE"];
if($name == 'STACKSIZE') {
$this->entity->stacksize = $attrs['VALUE'];
return null;
}
}
@ -670,8 +785,8 @@
if($attrs["VALUE"] != "") {
$_DISPATCHER->dispatchValue(strtolower($name),$attrs["VALUE"]);
if($attrs['VALUE'] != '') {
$_DISPATCHER->dispatchValue(strtolower($name),$attrs['VALUE']);
}
}
@ -690,6 +805,15 @@
return null;
}
/* death penalty */
if($name == "_DEATHPENALTIES") {
$this->open = null;
$this->entity->DeathXPToGain = $this->entity->DeathXPToGain*min(10,$this->entity->NbDeath);
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
/* respawn points */
if($name == "RESPAWNPOINTS") {
$this->respawn_outer++; // increment to track double close at end of block
@ -709,7 +833,7 @@
}
/* fame */
if($name == "__VAL__" && $this->open == "FAME") {
if($name == "__VAL__" && $this->open == "_FAME") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
@ -811,23 +935,26 @@
}
/* items */
if($name == "_ITEMS" || $name == "_ITEM") {
if($name == '_ITEMS' || $name == '_ITEM') {
#echo "c<br>";
if($this->open == "_ITEM") {
if($this->open == '_ITEM') {
#echo var_export($this->entity,true);
if($this->itemignore == false) {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
}
$this->itemignore = false;
$this->entity = null;
}
$this->open = null;
return null;
}
if($name == "INVENTORY") {
if($name == 'INVENTORY') {
$this->iblock = false;
return null;
}
if($name == "_CRAFTPARAMETERS") {
if($name == '_CRAFTPARAMETERS') {
$this->icraft = false;
return null;
}

@ -0,0 +1,13 @@
<?php
class DeathPenalty extends Entity {
public $NbDeath;
public $CurrentDeathXP;
public $DeathXPToGain;
public $BonusUpdateTime;
function DeathPenalty() {
$this->setName("death_penalty");
}
}
?>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save