merge from default

This commit is contained in:
mattraykowski 2013-02-12 10:24:22 -06:00
commit 47098b3a63
177 changed files with 63758 additions and 1 deletions

View file

@ -147,6 +147,8 @@
#include "server_share/log_character_gen.h" #include "server_share/log_character_gen.h"
#include "server_share/log_item_gen.h" #include "server_share/log_item_gen.h"
#include "player_manager/character_achievements.h"
/////////// ///////////
// USING // // USING //
/////////// ///////////
@ -602,6 +604,7 @@ CCharacter::CCharacter(): CEntityBase(false),
_CurrentParrySkill = BarehandCombatSkill; _CurrentParrySkill = BarehandCombatSkill;
_EncycloChar = new CCharacterEncyclopedia(*this); _EncycloChar = new CCharacterEncyclopedia(*this);
_AchievementsChar = new CCharacterAchievements(*this);
_GameEvent = new CCharacterGameEvent(*this); _GameEvent = new CCharacterGameEvent(*this);
_RespawnPoints = new CCharacterRespawnPoints(*this); _RespawnPoints = new CCharacterRespawnPoints(*this);
_PlayerRoom = new CPlayerRoomInterface; _PlayerRoom = new CPlayerRoomInterface;
@ -1533,6 +1536,8 @@ uint32 CCharacter::tickUpdate()
nextUpdate = 8; nextUpdate = 8;
} }
_AchievementsPlayer->tickUpdate();
return nextUpdate; return nextUpdate;
} // tickUpdate // } // tickUpdate //
@ -2792,6 +2797,7 @@ CCharacter::~CCharacter()
_BarUpdateTimer.reset(); _BarUpdateTimer.reset();
delete _EncycloChar; delete _EncycloChar;
delete _AchievementsChar;
delete _GameEvent; delete _GameEvent;
delete _RespawnPoints; delete _RespawnPoints;
delete _PlayerRoom; delete _PlayerRoom;
@ -2808,6 +2814,12 @@ CCharacter::~CCharacter()
// NLMEMORY::StatisticsReport( "egs_memory_report.csv", false ); // NLMEMORY::StatisticsReport( "egs_memory_report.csv", false );
} // destructor // } // destructor //
void CCharacter::mobKill(TDataSetRow creatureRowId)
{
_AchievementsChar->mobKill(creatureRowId);
}
//--------------------------------------------------- //---------------------------------------------------
// prepareToLoad: method called before applying a pdr save record // prepareToLoad: method called before applying a pdr save record
// //
@ -13124,7 +13136,10 @@ void CCharacter::setPlaces(const std::vector<const CPlace*> & places)
const uint size = (uint)places.size(); const uint size = (uint)places.size();
_Places.resize(places.size()); _Places.resize(places.size());
for ( uint i = 0; i < size; i++ ) for ( uint i = 0; i < size; i++ )
{
_Places[i] = places[i]->getId(); _Places[i] = places[i]->getId();
_AchievementsChar->inPlace(places[i]);
}
} }
//----------------------------------------------- //-----------------------------------------------
@ -14185,6 +14200,11 @@ void CCharacter::sendCloseTempInventoryImpulsion()
//----------------------------------------------- //-----------------------------------------------
void CCharacter::setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint32 fameMax, uint16 fameTrend) void CCharacter::setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint32 fameMax, uint16 fameTrend)
{ {
if (playerFame != NO_FAME)
{
_AchievementsChar->fameValue(factionIndex, playerFame);
}
uint32 firstTribeFameIndex = CStaticFames::getInstance().getFirstTribeFameIndex(); uint32 firstTribeFameIndex = CStaticFames::getInstance().getFirstTribeFameIndex();
uint32 firstTribeDbIndex = CStaticFames::getInstance().getDatabaseIndex( firstTribeFameIndex ); uint32 firstTribeDbIndex = CStaticFames::getInstance().getDatabaseIndex( firstTribeFameIndex );
uint32 fameIndexInDatabase = CStaticFames::getInstance().getDatabaseIndex( factionIndex ); uint32 fameIndexInDatabase = CStaticFames::getInstance().getDatabaseIndex( factionIndex );

View file

@ -115,6 +115,7 @@ class CMissionEvent;
class CMissionSolo; class CMissionSolo;
class CCharacterVersionAdapter; class CCharacterVersionAdapter;
class CCharacterEncyclopedia; class CCharacterEncyclopedia;
class CCharacterAchievements;
class CCharacterGameEvent; class CCharacterGameEvent;
class CCharacterRespawnPoints; class CCharacterRespawnPoints;
class CCharacterShoppingList; class CCharacterShoppingList;
@ -444,6 +445,8 @@ private:
NL_INSTANCE_COUNTER_DECL(CCharacter); NL_INSTANCE_COUNTER_DECL(CCharacter);
public: public:
void mobKill(TDataSetRow creatureRowId);
// Start by declaring methods for persistent load/ save operations // Start by declaring methods for persistent load/ save operations
// The following macro is defined in persistent_data.h // The following macro is defined in persistent_data.h
// At time of writing it evaluated to: // At time of writing it evaluated to:
@ -3502,6 +3505,8 @@ private:
CCharacterEncyclopedia *_EncycloChar; CCharacterEncyclopedia *_EncycloChar;
CCharacterAchievements *_AchievementsChar;
CCharacterGameEvent *_GameEvent; CCharacterGameEvent *_GameEvent;
CCharacterRespawnPoints *_RespawnPoints; CCharacterRespawnPoints *_RespawnPoints;

View file

@ -0,0 +1,90 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------
// includes
//-----------------------------------------------------------------------------
#include "stdpch.h"
//#include "egs_sheets/egs_sheets.h"
//#include "egs_sheets/egs_static_encyclo.h"
//#include "game_share/msg_encyclopedia.h"
//#include "game_share/string_manager_sender.h"
//#include "player_manager/player_manager.h"
//#include "player_manager/player.h"
//#include "mission_manager/mission_manager.h"
#include "player_manager/character_achievements.h"
#include "player_manager/character.h"
#include "phrase_manager/phrase_utilities_functions.h"
//-----------------------------------------------------------------------------
// namespaces
//-----------------------------------------------------------------------------
using namespace std;
using namespace NLMISC;
NL_INSTANCE_COUNTER_IMPL(CCharacterAchievements);
//-----------------------------------------------------------------------------
// methods CCharacterEncyclopedia
//-----------------------------------------------------------------------------
CCharacterAchievements::CCharacterAchievements(CCharacter &c) : _Char(c)
{
init();
}
//-----------------------------------------------------------------------------
void CCharacterAchievements::init()
{
nlinfo("hello achievements");
//load atoms
}
//-----------------------------------------------------------------------------
void CCharacterAchievements::clear()
{
//clear atoms
}
//-----------------------------------------------------------------------------
void CCharacterAchievements::mobKill(TDataSetRow creatureRowId)
{
const CCreature *creature = CreatureManager.getCreature(creatureRowId);
if (creature)
{
nlinfo("player has killed a mob: %s!",creature->getType().toString().c_str());
}
}
void CCharacterAchievements::inPlace(const CPlace *region)
{
nlinfo("player in region %u",region->getId());
}
void CCharacterAchievements::fameValue(uint32 factionIndex, sint32 playerFame)
{
nlinfo("fame: f(%u)=>v(%u)",factionIndex,playerFame);
}
void CCharacterAchievements::tickUpdate()
{
//evaluate atoms
}

View file

@ -0,0 +1,78 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef EGS_CHARACTER_ACHIEVEMENTS_H
#define EGS_CHARACTER_ACHIEVEMENTS_H
//-----------------------------------------------------------------------------
// includes
//-----------------------------------------------------------------------------
// game share
//#include "game_share/persistent_data.h"
#include "zone_manager.h"
#include "creature_manager/creature.h"
#include "creature_manager/creature_manager.h"
//-----------------------------------------------------------------------------
class CCharacter;
/**
* Dynamic part of the encyclopedia stored in a character
* This structure is optimized for size because its stored directly in the player persistant data stuff
* We use CEncyMsgXXX for sending info to the player
* \author Matthieu 'Trap' Besson
* \author Nevrax France
* \date November 2004
*/
class CCharacterAchievements
{
NL_INSTANCE_COUNTER_DECL(CCharacterAchievements);
public:
CCharacterAchievements(CCharacter &c);
// Construct the encyclopedia album structure from the static sheet that defines encyclopedia
// This method ensure that we have at least the same number of album and the same number of thema by album
// as in the sheets defines the encyclopedia
void init();
// remove all
void clear();
void mobKill(TDataSetRow creatureRowId);
void inPlace(const CPlace *region);
void fameValue(uint32 factionIndex, sint32 playerFame);
void tickUpdate();
private:
private:
// The parent class
CCharacter &_Char;
};
#endif // EGS_CHARACTER_ACHIEVEMENTS_H

View file

@ -1980,6 +1980,8 @@ bool CCharacterActions::dispatchXpGain( TDataSetRow actor, TDataSetRow creatureR
// compute xp gain on creature, cap xp gain per player to MaxXPGainPerPlayer // compute xp gain on creature, cap xp gain per player to MaxXPGainPerPlayer
const float xpGainPerOpponent = min( MaxXPGainPerPlayer.get(), float(xpFactor * maxXPGain / equivalentXpMembers) ); const float xpGainPerOpponent = min( MaxXPGainPerPlayer.get(), float(xpFactor * maxXPGain / equivalentXpMembers) );
c->mobKill(creatureRowId);
TSkillProgressPerOpponentContainer::iterator it = _SkillProgressPerOpponent.find( creatureRowId ); TSkillProgressPerOpponentContainer::iterator it = _SkillProgressPerOpponent.find( creatureRowId );
if( it != _SkillProgressPerOpponent.end() ) if( it != _SkillProgressPerOpponent.end() )
{ {

View file

@ -1530,7 +1530,7 @@ void LoadFamillesMP()
ligne = fileData.splitTo( "\n", true ); ligne = fileData.splitTo( "\n", true );
while ( !ligne.empty() ) while ( ligne != "" )
{ {
NewMP( ligne ); NewMP( ligne );
ligne = fileData.splitTo( "\n", true ); ligne = fileData.splitTo( "\n", true );

View file

@ -0,0 +1,41 @@
<?php
header('Content-type: text/xml');
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors","1");
require_once("class/mySQL_class.php");
require_once("conf.php");
//create database connection
$DBc = new mySQL($_CONF['mysql_error']);
$DBc->connect($_CONF['mysql_server'],$_CONF['mysql_user'],$_CONF['mysql_pass'],$_CONF['mysql_database']);
echo '<?xml version="1.0" ?><ryzom_progress>';
echo "<character id='".$_REQUEST['cid']."' />";
echo "<tasks>";
$res = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY");
foreach($res as $elem) {
echo "<task id='".$elem['apt_task']."' date='".$elem['apt_date']."' />";
}
echo "</tasks>";
echo "<objectives>";
echo "<done>";
$res = $DBc->sendSQL("SELECT * FROM ach_player_objective WHERE apo_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY");
foreach($res as $elem) {
echo "<objective id='".$elem['apo_objective']."' date='".$elem['apo_date']."' />";
}
echo "</done><open>";
$res = $DBc->sendSQL("SELECT ao_id,(SELECT count(*) FROM ach_player_atom,ach_atom WHERE apa_player='".$DBc->mre($_REQUEST['cid'])."' AND atom_id=apa_atom AND atom_objective=ao_id) as anz FROM ach_objective WHERE ao_display='value' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$DBc->mre($_REQUEST['cid'])."' AND apo_objective='ao_id') AND EXISTS (SELECT * FROM ach_player_atom,ach_atom WHERE apa_player='".$DBc->mre($_REQUEST['cid'])."' AND atom_id=apa_atom AND atom_objective=ao_id)","ARRAY");
foreach($res as $elem) {
echo "<objective id='".$elem['ao_id']."' value='".$elem['anz']."' />";
}
echo "</open>";
echo "</objectives>";
echo "</ryzom_progress>";
exit(0);
?>

View file

@ -0,0 +1,113 @@
<?php
header('Content-type: text/xml');
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors","1");
require_once("class/mySQL_class.php");
require_once("conf.php");
require_once($_CONF['app_achievements_path']."class/Parentum_abstract.php");
require_once($_CONF['app_achievements_path']."class/AchList_abstract.php");
require_once($_CONF['app_achievements_path']."class/Tieable_inter.php");
require_once($_CONF['app_achievements_path']."class/NodeIterator_class.php");
#require_once($_CONF['app_achievements_path']."class/Node_trait.php");
#require_once($_CONF['app_achievements_path']."class/InDev_trait.php");
require_once($_CONF['app_achievements_path']."class/AchMenu_class.php");
require_once($_CONF['app_achievements_path']."class/AchMenuNode_class.php");
require_once($_CONF['app_achievements_path']."class/AchSummary_class.php");
require_once($_CONF['app_achievements_path']."class/AchCategory_class.php");
require_once($_CONF['app_achievements_path']."class/AchAchievement_class.php");
require_once($_CONF['app_achievements_path']."class/AchTask_class.php");
require_once($_CONF['app_achievements_path']."class/AchObjective_class.php");
class RUser {
function RUser() { }
function getLang() {
return $_REQUEST['lang'];
}
function getID() {
return 0;
}
function getCult() {
return "%";
}
function getCiv() {
return "%";
}
function getRace() {
return "%";
}
}
$_USER = new RUser();
//create database connection
$DBc = new mySQL($_CONF['mysql_error']);
$DBc->connect($_CONF['mysql_server'],$_CONF['mysql_user'],$_CONF['mysql_pass'],$_CONF['mysql_database']);
echo '<?xml version="1.0" ?><ryzom_achievements>';
function print_cat(&$iter3) {
while($iter3->hasNext()) {
$curr3 = $iter3->getNext();
echo "<achievement id='".$curr3->getID()."' parent='".$curr3->getParentID()."' image='".$_CONF['image_url']."pic/icon/".$curr3->getImage()."'><name><![CDATA[".$curr3->getName()."]]></name><ties>";
if($curr3->getTieRace() != null) {
echo "<tie type='race'>".$curr3->getTieRace()."</tie>";
}
if($curr3->getTieCult() != null) {
echo "<tie type='cult'>".$curr3->getTieCult()."</tie>";
}
if($curr3->getTieCiv() != null) {
echo "<tie type='civilization'>".$curr3->getTieCiv()."</tie>";
}
echo "</ties>";
$iter4 = $curr3->getIterator();
while($iter4->hasNext()) {
$curr4 = $iter4->getNext();
echo "<task id='".$curr4->getID()."' parent='".$curr4->getParentID()."' value='".$curr4->getValue()."'><name><![CDATA[".$curr4->getDisplayName()."]]></name>";
$iter5 = $curr4->getIterator();
while($iter5->hasNext()) {
$curr5 = $iter5->getNext();
echo "<objective id='".$curr5->getID()."' type='".$curr5->getDisplay()."' value='".$curr5->getValue()."' meta='".$_CONF['image_url']."pic/icon/".$curr5->getMetaImage()."'><name><![CDATA[".$curr5->getDisplayName()."]]></name></objective>";
}
echo "</task>";
}
echo "</achievement>";
}
}
$menu = new AchMenu(0);
$menu->removeChild(0);
$iter = $menu->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
echo "<category id='".$curr->getID()."' order='".$curr->getOrder()."' image='".$_CONF['image_url']."pic/menu/".$curr->getImage()."'><name><![CDATA[".$curr->getName()."]]></name>";
$iter2 = $curr->getIterator();
while($iter2->hasNext()) {
$curr2 = $iter2->getNext();
echo "<category id='".$curr2->getID()."' order='".$curr2->getOrder()."' image='".$_CONF['image_url']."pic/menu/".$curr2->getImage()."'><name><![CDATA[".$curr2->getName()."]]></name>";
$cat = new AchCategory($curr2->getID(),null,null);
$iter3 = $cat->getIterator();
print_cat($iter3);
echo "</category>";
}
$cat = new AchCategory($curr->getID(),null,null);
$iter3 = $cat->getIterator();
print_cat($iter3);
echo "</category>";
}
echo "</ryzom_achievements>";
exit(0);
?>

View file

@ -0,0 +1,166 @@
<?php
class mySQL {
var $DBc;
var $DBstats;
var $cached;
function mre($in) {
if(is_array($in)) {
foreach($in as $key=>$elem) {
$in[$key] = mysql_real_escape_string(stripslashes($elem));
}
}
else {
$in = mysql_real_escape_string(stripslashes($in));
}
return $in;
}
function mySQL($err=false) {
$this->DBstats = array();
$this->DBc = false;
if($err === "DIE" || $err === "PRINT" || $err === "ALERT" || $err === "HIDE" || $err === "LOG") {
$this->DBerror = $err;
}
else {
$this->DBerror = "HIDE";
}
$this->resetStats();
$this->cached = false;
}
function connect($ip,$user,$pass,$db=false) {
$this->DBc = mysql_pconnect($ip,$user,$pass) or $this->error(mysql_error());
if($this->DBc && $db) {
$this->database($db);
}
$this->resetStats();
}
function database($db) {
if(!$this->DBc) {
return false;
}
mysql_select_db($db,$this->DBc) or $this->error(mysql_error());
return true;
}
function resetStats() {
$this->DBstats['query'] = 0;
$this->DBstats['error'] = 0;
}
function getStats() {
return $this->DBstats;
}
function sqlQuery($query) {
return $this->sendSQL($query,"ARRAY");
}
function sendSQL($query,$handling="PLAIN",$buffer=false) { // can be INSERT, DELETE, UPDATE, ARRAY, NONE, PLAIN
#if($this->cached !== false) {
#$this->unlinkSql($this->cached);
#}
if(!$this->DBc) {
return false;
}
if($buffer === false && $handling !== "PLAIN") {
$res = mysql_unbuffered_query($query,$this->DBc) or $this->error(mysql_error(),$query);
}
else {
$res = mysql_query($query,$this->DBc) or $this->error(mysql_error(),$query);
}
#$this->cached = $res;
$this->DBstats['query']++;
if($res) {
if($handling === "INSERT") {
$tmp = mysql_insert_id($this->DBc) or $this->error(mysql_error());;
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "DELETE" || $handling === "UPDATE") {
$tmp = mysql_affected_rows($this->DBc) or $this->error(mysql_error());
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "ARRAY") {
$tmp = $this->parseSql($res);
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "NONE") {
$this->unlinkSql($res);
return true;
}
else {
return $res;
}
//mysql_free_result($res);
}
else {
return false;
}
}
function unlinkSql($res) {
@mysql_free_result($res);
}
private function parseSql($res) {
$data = array();
$k = 0;
while($tmp = mysql_fetch_array($res,MYSQL_ASSOC)) {
$data[$k] = $tmp;
$k++;
}
return $data;
}
function getNext($res) {
if($res) {
if($tmp = mysql_fetch_array($res,MYSQL_ASSOC)) {
return $tmp;
}
else {
return false;
}
}
else {
return false;
}
}
private function error($error,$query = false) {
$this->DBstats['error']++;
if($query != false) {
$error .= " -->|".$query."|<--";
}
switch($this->DBerror) {
case 'DIE':
die($error);
break;
case 'PRINT':
echo "<br><b>".$error."</b><br>";
break;
case 'ALERT':
echo "<script language='javascript'>\n<!--\nalert(\"database error:\\n".mysql_real_escape_string($error)."\");\n// -->\n</script>";
break;
case 'LOG':
logf("MySQL ERROR: ".$error);
break;
default:
flush();
break;
}
}
}
?>

View file

@ -0,0 +1,12 @@
<?php
$_CONF = array();
$_CONF['app_achievements_path'] = "../";
$_CONF['image_url'] = "http://www.3025-game.de/special/app_achievements/";
$_CONF['mysql_error'] = "DIE";
$_CONF['mysql_server'] = "localhost";
$_CONF['mysql_user'] = "root";
$_CONF['mysql_pass'] = "";
$_CONF['mysql_database'] = "app_achievements";
?>

View file

@ -0,0 +1,319 @@
<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors","1");
$tmp_log_xmlgen_time = 0;
$microstart = explode(' ',microtime());
$start_time = $microstart[0] + $microstart[1];
$MY_PATH = dirname(__FILE__);
if(file_exists("parser.stop")) {
exit(0);
}
require_once("class/mySQL_class.php");
require_once("conf.php");
require_once("include/functions_inc.php");
require_once("class/Entity_abstract.php");
if(!$_REQUEST['file']) {
$_REQUEST['file'] = $argv[1];
}
if($CONF['logging'] == true) {
require_once("class/Logfile_class.php");
$log = new Logfile($CONF['logfile']);
}
$log->logf("File: '".$_REQUEST['file']."'");
$log->logf("Starting up... ",false);
if(!$_REQUEST['file']) {
$log->logf("ERROR: no file given! EXITING!");
$log->close();
die();
}
//create database connection
$DBc = new mySQL($CONF['mysql_error']);
$DBc->connect($CONF['mysql_server'],$CONF['mysql_user'],$CONF['mysql_pass'],$CONF['mysql_database']);
require_once("class/DataDispatcher_class.php");
require_once("class/DataSourceHandler_class.php");
require_once("class/SourceDriver_abstract.php");
require_once("class/Callback_class.php");
require_once("class/ValueCache_class.php");
require_once("class/Atom_class.php");
require_once("class/XMLgenerator_class.php");
require_once("class/XMLnode_class.php");
require_once("class/XMLfile_class.php");
require_once("class/Stats_class.php");
$_CACHE = new ValueCache();
//new generator for API xml files.
$XMLgenerator = new XMLgenerator();
//create datasource handler
$_DISPATCHER = new DataDispatcher();
$_DATASOURCE = new DataSourceHandler();
foreach($CONF['data_source'] as $elem) { //populate
require_once("source/".$elem."/".$elem."_class.php");
eval('$tmp = new '.$elem.'();');
$_DATASOURCE->addSource($tmp);
}
#REPLACE WITH REGEX!!!
$tmp = explode("/",$_REQUEST['file']);
$tmp2 = explode("_",$tmp[(sizeof($tmp)-1)]);
$DBc->database($CONF['char_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;
if(($res[0]['id'] > 0) == false) {
$log->logf("ERROR: no character found!");
$log->close();
die();
}
$cdata = array("cid"=>$res[0]['id'],"aid"=>$tmp2[1],"sid"=>$tmp2[2]);
#$cdata = array("cid"=>1,"aid"=>1,"sid"=>1);
$DBc->database($CONF['mysql_database']);
#echo var_export($cdata);
$log->logf(" done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$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->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) {
//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");
foreach($res2 as $atom) {
$a = new Atom($atom,$cdata);
$atom_list[] = $a;
$atom_list[] = $a;
$a->register();
}
}
$statsdb = new Stats();
$statsdb->register();
$log->logf("done!");
$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->logi("Driving data... ",false);
#STEP 2: drive data
$_CACHE->setChar($cdata);
$res = $DBc->sendSQL("SELECT sum(at_value) as anz FROM ach_task,ach_player_task WHERE at_id=apt_task AND apt_player='".$cdata['cid']."'","ARRAY");
$_DISPATCHER->dispatchValue("yubopoints",$res[0]['anz']);
$_DISPATCHER->dispatchValue("aid",$cdata['aid']);
$_DISPATCHER->dispatchValue("cid",$cdata['cid']);
$_DISPATCHER->dispatchValue("sid",$cdata['sid']);
$_DATASOURCE->drive($cdata);
//save daily stats
$res = $DBc->sendSQL("SELECT COUNT(*) as anz FROM stat_daily WHERE sdm_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");
$res2 = $DBc->sendSQL("SELECT sp_money 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");
$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");
$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");
$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");
$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");
$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");
}
$log->logf("done!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$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->logi("Writing XML export... ",false);
$XMLgenerator->generate();
$log->logf("done!");
$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));
#STEP 3: detect obj/task progression
$log->logi("Detecting Objectives... ",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");
$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("1... ",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);
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("2... ",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);
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("3... ",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");
$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!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Expired time: ".($stop_time - $start_time));
$log->logi("Clearing atom data... ",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!");
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$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");
$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);
$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");
$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);
$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");
$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");
$facebook = new Facebook(array(appId=>$CONF['fb_id'], secret=>$CONF['fb_secret']));
$res = $DBc->sendSQL("SELECT * FROM ach_fb_token WHERE aft_player='".$cdata['cid']."'","ARRAY");
$access_token = $res[0]['aft_token'];
if($res[0]['aft_allow'] == 1) {
$res2 = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='".$cdata['cid']."' AND apt_fb='0'","ARRAY");
$sz = sizeof($res2);
for($i=0;$i<$sz;$i++) {
//this has to be adapted!
#$result = $facebook->api(
# '/me/feed/',
# array('access_token' => $$access_token, 'message' => 'Playing around with FB Graph..')
#);
}
$DBc->sendSQL("UPDATE ach_player_task SET apt_fb='1' WHERE apt_player='".$cdata['cid']."'","NONE");
}
}*/
$log->logf("done!");
#}
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$log->logf("Total time: ".($stop_time - $start_time));
$log->logf("Run complete; exiting...");
$log->close();
exit(0);
?>

View file

@ -0,0 +1,113 @@
<?php
/*
* Class for Atoms.
* It's used to run the code from the ruleset and register listening to data.
* Also we have the functions to manipulate progress here.
*/
class Atom {
private $ruleset;
private $id;
private $objective;
private $user;
function Atom(&$data,$user) {
$this->ruleset = $data['atom_ruleset_parsed'];
$this->id = $data['atom_id'];
$this->objective = $data['atom_objective'];
$this->user = $user;
}
function register() { // register the atom's ruleset code
try {
return eval($this->ruleset);
}
catch(Exception $e) {
echo $e->getMessage();
}
return null;
}
function registerValue($name,$func) { // register to listen for a value
global $_DISPATCHER;
$tmp = new Callback($this,$func);
$_DISPATCHER->registerValue($name,$tmp);
}
function unregisterValue($name,$callback) { // unregister listening
global $_DISPATCHER;
$_DISPATCHER->unregisterValue($name,$callback);
}
function registerEntity($name,$func) { // register to listen for an entity
global $_DISPATCHER;
$tmp = new Callback($this,$func);
$_DISPATCHER->registerEntity($name,$tmp);
}
function unregisterEntity($name,$callback) { // unregister
global $_DISPATCHER;
$_DISPATCHER->unregisterEntity($name,$callback);
}
function grant($count = 1) { // grant an atom
global $DBc;
$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");
}
function deny() { // deny an atom
global $DBc;
$DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$this->user['cid']."','".time()."',null,'DENY','1')","NONE");
}
function reset_() { // reset progress for this atom
global $DBc;
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user['cid']."'","NONE");
}
function reset_all() { // reset progress for all atoms of the same objective
global $DBc;
$res = $DBc->sendSQL("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->objective."'","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$res[$i]['atom_id']."' AND apa_player='".$this->user['cid']."'","NONE");
}
}
function unlock() { // unlock atom
global $DBc;
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user['cid']."' AND apa_state='DENY'","NONE");
}
function unlock_all() { // unlock all atoms of the same objective
global $DBc;
$res = $DBc->sendSQL("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->objective."'","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$res[$i]['atom_id']."' AND apa_player='".$this->user['cid']."' AND apa_state='DENY'","NONE");
}
}
function getID() {
return $this->id;
}
function getObjective() {
return $this->objective;
}
}
?>

View file

@ -0,0 +1,18 @@
<?php
/*
* Callback container that handles doing the actual callback
*/
class Callback {
private $who;
private $func;
function Callback($who,$func) {
$this->who = $who;
$this->func = $func;
}
function call($what) { // now call it
eval(''.$this->func.'($what,$this->who,$this);');
}
}
?>

View file

@ -0,0 +1,90 @@
<?php
/*
* The DataDispatcher is used to route data to atoms that requested it.
* At first atoms will be registered. Later, when data comes in, it will be passed on to them.
*/
class DataDispatcher {
private $value;
private $entity;
private $event;
function DataDispatcher() {
$this->value = array();
$this->entity = array();
$this->event = array();
}
//registering atoms
function registerValue($name,$callback) {
if(!is_array($this->value[$name])) {
$this->value[$name] = array();
}
$this->value[$name][] = $callback;
}
function registerEntity($name,$callback) {
if(!is_array($this->entity[$name])) {
$this->entity[$name] = array();
}
$this->entity[$name][] = $callback;
}
function registerEvent($name,$callback) {
if(!is_array($this->event[$name])) {
$this->event[$name] = array();
}
$this->event[$name][] = $callback;
}
//unregistering atoms
function unregisterValue($name,$callback) {
$res = array_search($callback,$this->value[$name],true);
if($res !== false) {
unset($this->value[$name][$res]);
}
}
function unregisterEntity($name,$callback) {
$res = array_search($callback,$this->entity[$name],true);
if($res !== false) {
unset($this->entity[$name][$res]);
}
}
function unregisterEvent($name,$callback) {
$res = array_search($callback,$this->event[$name],true);
if($res !== false) {
unset($this->event[$name][$res]);
}
}
//dispatching data
function dispatchValue($key,$val) {
if(is_array($this->value[$key])) {
foreach($this->value[$key] as $callback) {
$callback->call($val);
}
}
}
function dispatchEntity($key,$val) {
if(is_array($this->entity[$key])) {
foreach($this->entity[$key] as $callback) {
$callback->call($val);
}
}
}
function dispatchEvent($key,$val) {
if(is_array($this->event[$key])) {
foreach($this->event[$key] as $callback) {
$callback->call($val);
}
}
}
}
?>

View file

@ -0,0 +1,23 @@
<?php
/*
* This class is the wrapper for all loaded datasources. It will store them and pass the "drive" command on to them.
*/
class DataSourceHandler {
private $source;
function DataSourceHandler() {
$this->source = array();
}
function addSource($src) {
$this->source[] = $src;
}
function drive($cdata) { // tell the datasources to start reading data
foreach($this->source as $elem) {
$elem->drive($cdata);
}
}
}
?>

View file

@ -0,0 +1,25 @@
<?php
/*
* Unlike normal values, entities may contain several values. This is their wrapper.
*/
abstract class Entity {
private $name;
private $_dataset = array();
function getName() {
return $this->name;
}
function setName($n) {
$this->name = $n;
}
function setData($key,$data) {
$this->_dataset[$key] = $data;
}
function getData($key) {
return $this->_dataset[$key];
}
}
?>

View file

@ -0,0 +1,44 @@
<?php
/*
* Logging, logging, logging....
*/
class Logfile {
private $logfile;
function Logfile($f = false) {
global $CONF,$MY_PATH;
$this->logfile = false;
if($f != false) {
$this->logfile = fopen($MY_PATH.$CONF['logfile'].'.'.date("Ymd",time()).'.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;
fwrite($this->logfile,$txt);
}
function close() {
fclose($this->logfile);
#echo "ii";
}
}
?>

View file

@ -0,0 +1,9 @@
<?php
/*
* Just to make sure every datasource has a drive() function...
*/
abstract class SourceDriver {
abstract function drive($cdata);
}
?>

View file

@ -0,0 +1,42 @@
<?php
class Stats {
#private $user;
function Stats() {
#$this->user = $user;
}
function register() { // register the stats code
include_once("script/statsdb.php");
return null;
}
function registerValue($name,$func) { // register to listen for a value
global $_DISPATCHER;
$tmp = new Callback($this,$func);
$_DISPATCHER->registerValue($name,$tmp);
}
function unregisterValue($name,$callback) { // unregister listening
global $_DISPATCHER;
$_DISPATCHER->unregisterValue($name,$callback);
}
function registerEntity($name,$func) { // register to listen for an entity
global $_DISPATCHER;
$tmp = new Callback($this,$func);
$_DISPATCHER->registerEntity($name,$tmp);
}
function unregisterEntity($name,$callback) { // unregister
global $_DISPATCHER;
$_DISPATCHER->unregisterEntity($name,$callback);
}
}
?>

View file

@ -0,0 +1,31 @@
<?php
/*
* The ValueCache allows to store data that persists outside from actual atom evaluation. One might want to check
* if a value changes by xx since the last time parsing it, just as an example.
*/
class ValueCache {
private $char;
function ValueCache() {
$this->char = false;
}
function setChar($cdata) { // select the character
$this->char = $cdata['cid'];
}
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");
}
function getData($key) { // read from cache
global $DBc;
$res = $DBc->sendSQL("SELECT apv_value as value, apv_date as date FROM ach_player_valuecache WHERE apv_name='".$DBc->mre($key)."' AND apv_player='".$this->char."'","ARRAY");
return $res[0];
}
}
?>

View file

@ -0,0 +1,74 @@
<?php
class XMLfile {
private $ident;
private $xml;
private $curr;
function XMLfile($i) {
$this->ident = $i;
$this->xml = new XMLNode($this->ident);
$this->curr = $this->xml;
}
function getIdent() {
return $this->ident;
}
function addXML($name,$attrs,$open) {
if($open == true) {
if($name == "__KEY__") {
$x = explode(".",$attrs["VALUE"]);
if(sizeof($x) > 1) {
$v = $x[1];
$a = array("sheetid"=>$attrs["VALUE"]);
}
else {
$v = $attrs["VALUE"];
$a = array();
}
$this->curr = new XMLNode($v,null,$this->curr);
foreach($a as $key=>$elem) {
$this->curr->addArg($key,$elem);
}
$tmp = $this->curr->getParent();
$tmp->addChild($this->curr);
}
elseif($name == "__VAL__") {
$this->curr->setValue($attrs["VALUE"]);
}
else {
$this->curr = new XMLNode($name,null,$this->curr);
if(isset($attrs["VALUE"])) {
$this->curr->addArg("value",$attrs["VALUE"]);
}
$tmp = $this->curr->getParent();
$tmp->addChild($this->curr);
}
}
else {
if($name == "__KEY__") {
// do nothing
}
elseif($name == "__VAL__") {
$this->curr = $this->curr->getParent();
}
elseif($name == $this->curr->getName()) {
if($this->curr->getArg("value") !== null) {
$this->curr->setValue($this->curr->getArg("value"));
$this->curr->clearArg("value");
}
$this->curr = $this->curr->getParent();
}
else {
$this->curr = $this->curr->getParent();
}
}
}
function generate($i) {
return $this->xml->generate($i);
}
}
?>

View file

@ -0,0 +1,106 @@
<?php
class XMLgenerator {
private $def = array();
private $files = array();
private $wildcard = array();
function XMLgenerator() {
//load xml def & filegen
#$this->def['xml/CLEAR'] = array("stats");
require_once("xmldef/public.php");
$this->files["public"] = new XMLfile("public");
require_once("xmldef/logs.php");
$this->files["logs"] = new XMLfile("logs");
require_once("xmldef/stats.php");
$this->files["stats"] = new XMLfile("stats");
require_once("xmldef/faction.php");
$this->files["faction"] = new XMLfile("faction");
require_once("xmldef/inventory.php");
$this->files["inventory"] = new XMLfile("inventory");
require_once("xmldef/shop.php");
$this->files["shop"] = new XMLfile("shop");
require_once("xmldef/fame.php");
$this->files["fame"] = new XMLfile("fame");
require_once("xmldef/knowledge.php");
$this->files["knowledge"] = new XMLfile("knowledge");
require_once("xmldef/social.php");
$this->files["social"] = new XMLfile("social");
require_once("xmldef/skills.php");
$this->files["skills"] = new XMLfile("skills");
require_once("xmldef/missions.php");
$this->files["missions"] = new XMLfile("missions");
require_once("xmldef/debug.php");
$this->files["debug"] = new XMLfile("debug");
}
function addWildcard($w,$ident) {
$this->wildcard[] = array($ident,$w);
}
function xml_split($pathid,$name,$attrs,$open) {
global $tmp_log_xmlgen_time;
$microstart = explode(' ',microtime());
$start_time = $microstart[0] + $microstart[1];
#echo $pathid." => ".$name."<br>";
if(is_array($this->def[$pathid])) {
foreach($this->def[$pathid] as $elem) {
#echo $elem."<br>";
$this->files[$elem]->addXML($name,$attrs,$open);
}
}
foreach($this->wildcard as $elem) {
if($elem[1] == substr($pathid,0,strlen($elem[1]))) {
$this->files[$elem[0]]->addXML($name,$attrs,$open);
}
}
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
$tmp_log_xmlgen_time += ($stop_time - $start_time);
}
function generate() {
global $cdata,$CONF;
foreach($this->files as $elem) {
$xml = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
$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 .= $elem->generate(' ');
$xml .= "</xml>";
//store
$pth = $CONF['export_xml_path'].$elem->getIdent()."/".($cdata['cid']%10);
if(!is_dir($pth)) {
mkdir($pth,0777,true);
}
$f = fopen($pth."/".$cdata['cid'].".xml","w");
fwrite($f,$xml);
fclose($f);
}
}
}
?>

View file

@ -0,0 +1,77 @@
<?php
class XMLNode {
private $name;
private $value = null;
private $args = array();
private $children = array();
private $parent = null;
function XMLNode($n = null,$v = null,$p = null) {
$this->name = $n;
$this->value = $v;
$this->parent = $p;
}
function getParent() {
return $this->parent;
}
function getName() {
return $this->name;
}
function setName($n) {
$this->name = $n;
}
function setValue($v) {
$this->value = $v;
}
function addArg($k,$v) {
$this->args[$k] = $v;
}
function getArg($k) {
return $this->args[$k];
}
function clearArg($k) {
unset($this->args[$k]);
}
function addChild($c) {
$this->children[] = $c;
}
function generate($indent) {
$xml = "";
#for($i=0;$i<$indent;$i++) {
$xml .= $indent;
#}
$xml .= "<".strtolower($this->name);
foreach($this->args as $key=>$elem) {
$xml .= ' '.strtolower($key).'="'.$elem.'"';
}
if(sizeof($this->children) > 0) {
$xml .= ">\n";
foreach($this->children as $elem) {
$xml .= $elem->generate($indent.' ');
}
#for($i=0;$i<$indet;$i++) {
$xml .= $indent;
#}
$xml .= "</".strtolower($this->name).">\n";
}
elseif($this->value !== null) {
$xml .= ">".$this->value."</".strtolower($this->name).">\n";
}
else {
$xml .= " />\n";
}
return $xml;
}
}
?>

View file

@ -0,0 +1,160 @@
<?php
/*
* MySQL connection class
*/
class mySQL {
var $DBc;
var $DBstats;
var $cached;
function mre($in) { // shorter than "mysql_real_escape_string"
if(is_array($in)) {
foreach($in as $key=>$elem) {
$in[$key] = mysql_real_escape_string(stripslashes($elem));
}
}
else {
$in = mysql_real_escape_string(stripslashes($in));
}
return $in;
}
function mySQL($err=false) { // constructor
$this->DBstats = array();
$this->DBc = false;
//set error handling
if($err === "DIE" || $err === "PRINT" || $err === "ALERT" || $err === "HIDE" || $err === "LOG") {
$this->DBerror = $err;
}
else {
$this->DBerror = "HIDE";
}
$this->resetStats(); // reset stats counter
$this->cached = false;
}
function connect($ip,$user,$pass,$db=false) { // connect
$this->DBc = mysql_pconnect($ip,$user,$pass) or $this->error(mysql_error());
if($this->DBc && $db) {
$this->database($db);
}
$this->resetStats();
}
function database($db) { // set database
if(!$this->DBc) {
return false;
}
mysql_select_db($db,$this->DBc) or $this->error(mysql_error());
}
function resetStats() {
$this->DBstats['query'] = 0;
$this->DBstats['error'] = 0;
}
function getStats() { // return stats
return $this->DBstats;
}
function sendSQL($query,$handling="PLAIN",$buffer=false) { // can be INSERT, DELETE, UPDATE, ARRAY, NONE, PLAIN
if(!$this->DBc) {
return false;
}
if($buffer === false && $handling !== "PLAIN") {
$res = mysql_unbuffered_query($query,$this->DBc) or $this->error(mysql_error(),$query);
}
else {
$res = mysql_query($query,$this->DBc) or $this->error(mysql_error(),$query);
}
$this->DBstats['query']++;
if($res) {
if($handling === "INSERT") {
$tmp = mysql_insert_id($this->DBc) or $this->error(mysql_error());;
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "DELETE" || $handling === "UPDATE") {
$tmp = mysql_affected_rows($this->DBc) or $this->error(mysql_error());
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "ARRAY") {
$tmp = $this->parseSql($res);
$this->unlinkSql($res);
return $tmp;
}
elseif($handling === "NONE") {
$this->unlinkSql($res);
return true;
}
else {
return $res;
}
}
else {
return false;
}
}
function unlinkSql($res) {
@mysql_free_result($res);
}
private function parseSql($res) {
$data = array();
$k = 0;
while($tmp = mysql_fetch_array($res,MYSQL_ASSOC)) {
$data[$k] = $tmp;
$k++;
}
return $data;
}
function getNext($res) {
if($res) {
if($tmp = mysql_fetch_array($res,MYSQL_ASSOC)) {
return $tmp;
}
else {
return false;
}
}
else {
return false;
}
}
private function error($error,$query = false) { // error handler
global $log;
$this->DBstats['error']++;
if($query != false) {
$error .= " -->|".$query."|<--";
}
switch($this->DBerror) {
case 'DIE':
die($error);
break;
case 'PRINT':
echo "<br><b>".$error."</b><br>";
break;
case 'ALERT':
echo "<script language='javascript'>\n<!--\nalert(\"database error:\\n".mysql_real_escape_string($error)."\");\n// -->\n</script>";
break;
case 'LOG':
$log->logf("MySQL ERROR: ".$error);
break;
default:
flush();
break;
}
}
}
?>

View file

@ -0,0 +1,31 @@
<?php
// necessary to include the server api
$_SERVER['HTTP_HOST'] = 'app.ryzom.com';
require_once("../../config.php");
$CONF = array();
$CONF['logging'] = true;
$CONF['logfile'] = "/log/AchWebParser.log";
$CONF['mysql_error'] = "LOG";
$CONF['mysql_server'] = RYAPI_WEBDB_HOST;
$CONF['mysql_user'] = RYAPI_WEBDB_LOGIN;
$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['export_xml_path'] = RYAPI_PATH."data/cache/players/";
#$CONF['export_xml_path'] = "testxml/";
$CONF['data_source'] = array("PDRtoXMLdriver");
$CONF['facebook'] = false;
$CONF['fb_id'] = "447985781893176";
$CONF['fb_secret'] = "f953772f1f7d871db022a6023e7a3f42";
?>

View file

@ -0,0 +1,21 @@
<?php
function dateTime_to_timestamp($dt) {
#2012-05-12 00:26:40
$tmp = explode(" ",$dt);
$d = explode("-",$tmp[0]);
$t = explode(":",$tmp[1]);
return mktime($t[0],$t[1],$t[2],$d[1],$d[2],$d[0]);
}
function curl_get_file_contents($URL) { // http://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
#$err = curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
?>

View file

@ -0,0 +1,77 @@
<?php
/*
* Code from:
* http://www.assemblysys.com/dataServices/php_pointinpolygon.php
*
* Probably not free to use!!!
*/
class pointLocation {
var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices
function pointLocation() {
}
function pointInPolygon($point, $polygon, $pointOnVertex = true) {
$this->pointOnVertex = $pointOnVertex;
// Transform string coordinates into arrays with x and y values
$point = $this->pointStringToCoordinates($point);
$vertices = array();
foreach($polygon as $vertex) {
$vertices[] = $this->pointStringToCoordinates($vertex);
}
// Check if the point sits exactly on a vertex
if($this->pointOnVertex == true and $this->pointOnVertex($point, $vertices) == true) {
return "vertex";
}
// Check if the point is inside the polygon or on the boundary
$intersections = 0;
$vertices_count = count($vertices);
for($i=1; $i < $vertices_count; $i++) {
$vertex1 = $vertices[$i-1];
$vertex2 = $vertices[$i];
if($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary
return "boundary";
}
if($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {
$xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
if($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)
return "boundary";
}
if($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {
$intersections++;
}
}
}
// If the number of edges we passed through is even, then it's in the polygon.
if ($intersections % 2 != 0) {
return "inside";
}
else {
return "outside";
}
}
function pointOnVertex($point, $vertices) {
foreach($vertices as $vertex) {
if ($point == $vertex) {
return true;
}
}
return false;
}
function pointStringToCoordinates($pointString) {
$coordinates = explode(" ", $pointString);
return array("x" => $coordinates[0], "y" => $coordinates[1]);
}
}
?>

View file

@ -0,0 +1,13 @@
<?php
function item_grade($item) {
global $DBc;
#echo $item;
$res = $DBc->sendSQL("SELECT grade FROM ryzom_nimetu_item_data WHERE sheetid='".str_replace(".sitem","",$item)."'","ARRAY");
#echo $res[0]['grade'];
return $res[0]['grade'];
}
?>

View file

@ -0,0 +1,6 @@
<?php
$region = array();
?>

View file

@ -0,0 +1,5 @@
<?php
$region = array();
$region['place_silan'] = array("8182 -12294","11346 -12300","11346 -10252","8172 -10250","8182 -12294");
?>

View file

@ -0,0 +1,26 @@
<?php
$region = array();
$region['place_starting_zone_arena'] = array("10056 -11594 ","10144 -11726 ","10280 -11670 ","10308 -11558 ","10132 -11498 ","10056 -11594");
$region['region_newbieland_blight_zone'] = array("9376 -10940","9120 -11148","9048 -11780","9624 -11988","9792 -11732","9960 -11388","9376 -10940");
$region['region_newbieland_hunting_grounds'] = array("10296 -10812","10232 -11164","10080 -11484","10320 -11540","10824 -11540","11112 -11268","11080 -10804","10640 -10644","10296 -10812");
$region['kami_enclave'] = array("10416 -11654","10352 -11718","10416 -11770","10488 -11710","10416 -11654");
$region['karavan embassy'] = array("10388 -11818","10320 -11874","10404 -11922","10456 -11858","10388 -11818");
$region['region_newbieland_kitins_jungle'] = array("8184 -11076","8680 -11036","8704 -10244","8160 -10252","8184 -11076");
$region['region_newbieland_starting_zone'] = array("9968 -11346","10384 -11582","10788 -11574","10760 -11962","9892 -12014","9812 -11682","9968 -11346");
$region['place_shattered_ruins_trone'] = array("9678 -10692","9574 -10778","9668 -10846","9784 -10748","9678 -10692");
$region['place_shattered_ruins_silan'] = array("9558 -10764 ","9700 -10910 ","9616 -11008 ","9864 -11238 ","10158 -11224 ","10280 -11070 ","10166 -10982 ","9986 -10880 ","9878 -10808 ","9684 -10660 ","9558 -10764");
$region['region_newbieland_the_shattered_ruins'] = array("9472 -10562 ","9336 -10974 ","9824 -11266 ","10252 -11354 ","10328 -11182 ","10272 -11126 ","10288 -11074 ","10356 -11070 ","10308 -10746 ","9804 -10458 ","9472 -10562");
$region['region_newbieland_shining_lake'] = array("8608 -11244","8840 -11356","9288 -11044","9488 -10644","9360 -10340","8776 -10380","8624 -10676","8608 -11244");
?>

View file

@ -0,0 +1,82 @@
<?php
$this->registerValue("_money","_statsdb_money");
function _statsdb_money($money,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "_money";
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_money) VALUES ('".$cdata['cid']."','".$money."') ON DUPLICATE KEY UPDATE sp_money='".$money."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("_race","_statsdb_race");
function _statsdb_race($race,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "_race";
$race = "r_".strtolower($race);
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_race) VALUES ('".$cdata['cid']."','".$race."') ON DUPLICATE KEY UPDATE sp_race='".$race."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("yubopoints","_statsdb_yubototal");
function _statsdb_yubototal($yubo,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "yubopoints";
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_yubototal) VALUES ('".$cdata['cid']."','".$yubo."') ON DUPLICATE KEY UPDATE sp_yubototal='".$yubo."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("petcount","_statsdb_mekcount");
function _statsdb_mekcount($count,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "petcount";
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_mekcount) VALUES ('".$cdata['cid']."','".$count."') ON DUPLICATE KEY UPDATE sp_mekcount='".$count."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("skilllist","_statsdb_maxlevel");
function _statsdb_maxlevel($skills,$_P,$_CB) {
global $cdata,$DBc,$log;
$_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("INSERT INTO stat_players (sp_char,sp_maxlevel) VALUES ('".$cdata['cid']."','".$lvl."') ON DUPLICATE KEY UPDATE sp_maxlevel='".$lvl."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("_guildid","_statsdb_guildid");
function _statsdb_guildid($id,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "_guildid";
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_guildid) VALUES ('".$cdata['cid']."','".$id."') ON DUPLICATE KEY UPDATE sp_guildid='".$id."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
$this->registerValue("itemcount","_statsdb_itemcount");
function _statsdb_itemcount($count,$_P,$_CB) {
global $cdata,$DBc;
$_IDENT = "itemcount";
$DBc->sendSQL("INSERT INTO stat_players (sp_char,sp_itemcount) VALUES ('".$cdata['cid']."','".$count."') ON DUPLICATE KEY UPDATE sp_itemcount='".$count."'","NONE");
$_P->unregisterValue($_IDENT,$_CB);
}
?>

View file

@ -0,0 +1,845 @@
<?php
/*
* This is the XML parser. It is set to extract most of the useful information from XML files generated from PDR
*/
$BASE_PATH = dirname(__FILE__);
require_once($BASE_PATH."/entity/FactionPoints_entity.php");
require_once($BASE_PATH."/entity/Fame_entity.php");
require_once($BASE_PATH."/entity/Item_entity.php");
require_once($BASE_PATH."/entity/LastLogStats_entity.php");
require_once($BASE_PATH."/entity/Mission_entity.php");
require_once($BASE_PATH."/entity/PermanentMod_entity.php");
require_once($BASE_PATH."/entity/Pet_entity.php");
require_once($BASE_PATH."/entity/PhysCharacs_entity.php");
require_once($BASE_PATH."/entity/PhysScores_entity.php");
require_once($BASE_PATH."/entity/SkillPoints_entity.php");
require_once($BASE_PATH."/entity/Skill_entity.php");
require_once($BASE_PATH."/entity/SpentSkillPoints_entity.php");
require_once($BASE_PATH."/entity/Position_entity.php");
require_once($BASE_PATH."/entity/Gear_entity.php");
require_once($BASE_PATH."/entity/SkillList_entity.php");
require_once($BASE_PATH."/entity/MissionList_entity.php");
require_once($BASE_PATH."/entity/Friendlist_entity.php");
require_once($BASE_PATH."/entity/Friend_entity.php");
require_once($BASE_PATH."/entity/FriendOf_entity.php");
require_once($BASE_PATH."/entity/Title_entity.php");
require_once($BASE_PATH."/entity/RespawnPoints_entity.php");
class PDRtoXMLdriver extends SourceDriver {
private $ignore;
private $ignore_block;
private $lock;
private $open;
private $entity;
private $inv;
private $iblock;
private $gear;
private $skills;
private $petcount;
private $friendlist;
private $itemcount;
private $respawn_outer = 0; // needed to fetch respawn points due to nested tags with same name...
private $pathid = array();
function PDRtoXMLdriver() {
$this->lock = 0;
$this->open = null;
$this->entity = null;
$this->inv = null;
$this->iblock = false;
$this->petcount = 0;
$this->itemcount = 0;
$this->gear = new Gear();
$this->skills = new SkillList();
$this->mission = new MissionList();
$this->friendlist = new Friendlist();
//these nodes are ignored, but children are processed
$this->ignore = array();
$this->ignore[] = "XML";
$this->ignore[] = "ENTITYBASE";
$this->ignore[] = "NORMALPOSITIONS";
$this->ignore[] = "_VEC";
$this->ignore[] = "SESSIONID";
#$this->ignore[] = "POSSTATE";
$this->ignore[] = "_PLAYERROOM";
$this->ignore[] = "_INVENTORYID";
$this->ignore[] = "_PHYSCHARACS";
$this->ignore[] = "_PHYSSCORES";
$this->ignore[] = "_SKILLS";
$this->ignore[] = "_FAMES";
//these nodes are ignored, as well as their children
$this->ignore_block = array();
$this->ignore_block[] = "_MEMORIZEDPHRASES";
$this->ignore_block[] = "_FORBIDPOWERDATES";
$this->ignore_block[] = "_INEFFECTIVEAURAS";
$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";
$this->ignore_block[] = "STARTINGCHARACTERISTICVALUES";
$this->ignore_block[] = "_ENCYCLOCHAR";
$this->ignore_block[] = "_GAMEEVENT";
$this->ignore_block[] = "_ENTITYPOSITION";
$this->ignore_block[] = "_MISSIONHISTORIES";
$this->ignore_block[] = "_KNOWNBRICKS";
$this->ignore_block[] = "_BOUGHTPHRASES";
$this->ignore_block[] = "SKILLPOINTS";
$this->ignore_block[] = "SPENTSKILLPOINTS";
$this->ignore_block[] = "_LASTLOGSTATS";
}
function drive($cdata) {
global $_DISPATCHER,$MY_PATH,$log;
#$file = $this->conf['xml_dir']."account_".$uid."_".$slot."_pdr.xml";
$file = $_REQUEST['file'];
$xml_parser = xml_parser_create();
xml_set_object($xml_parser,$this);
xml_set_element_handler($xml_parser, "startElement", "endElement");
// temporary storage for xml files for debug purpose
$ftmp = fopen($MY_PATH."/log/xml_tmp/char_".$cdata['cid'].".xml","w");
$fcont = file_get_contents($file);
fwrite($ftmp,$fcont);
fclose($ftmp);
# end of temp xml store
if(!xml_parse($xml_parser, $fcont)) {
$log->logf("FATAL ERROR (PDRtoXMLdriver): unable to parse given XML!");
$log->close();
die();
}
xml_parser_free($xml_parser);
$_DISPATCHER->dispatchEntity($this->gear->getName(),$this->gear);
#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->dispatchValue('petcount',$this->petcount);
$_DISPATCHER->dispatchValue('itemcount',$this->itemcount);
}
function startElement($parser, $name, $attrs) {
global $_DISPATCHER,$DBc,$XMLgenerator;
array_push($this->pathid,$name);
$XMLgenerator->xml_split(implode("/",$this->pathid),$name,$attrs,true);
if($this->lock == 1) {
return null;
}
if(in_array($name,$this->ignore)) {
return null;
}
if(in_array($name,$this->ignore_block)) {
$this->lock = 1;
return null;
}
/* spawn points */
if($name == "RESPAWNPOINTS" && !$attrs["VALUE"]) {
$this->open = "RESPAWNPOINTS";
$this->entity = new RespawnPoints();
return null;
}
if($this->open == "RESPAWNPOINTS") {
if($name == "RESPAWNPOINTS") {
$this->respawn_outer = 0;
$this->entity->spawns[] = $attrs["VALUE"];
}
}
/* faction points */
if($name == "FACTIONPOINTS") {
$this->open = "FACTIONPOINTS";
return null;
}
if($this->open == "FACTIONPOINTS") {
if($name == "__KEY__") {
$this->entity = new FactionPoints();
$this->entity->faction = $attrs["VALUE"];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
return null;
}
/* Fame */
if($name == "_FAME") {
$this->open = "_FAME";
return null;
}
if($this->open == "_FAME") {
if($name == "__KEY__") {
$this->entity = new Fame();
$this->entity->faction = $attrs["VALUE"];
return null;
}
if($name == "FAME") {
$this->entity->fame = $attrs["VALUE"];
return null;
}
if($name == "FAMEMEMORY") {
$this->entity->famememory = $attrs["VALUE"];
return null;
}
if($name == "LASTFAMECHANGETREND") {
$this->entity->lastfamechangetrend = $attrs["VALUE"];
return null;
}
return null;
}
/* last log stats */
if($name == "_LASTLOGSTATS") {
$this->open = "_LASTLOGSTATS";
$this->entity = new LastLogStats();
return null;
}
if($this->open == "_LASTLOGSTATS") {
if($name == "LOGINTIME") {
$this->entity->logintime = $attrs["VALUE"];
return null;
}
if($name == "DURATION") {
$this->entity->duration = $attrs["VALUE"];
return null;
}
if($name == "LOGOFFTIME") {
$this->entity->logofftime = $attrs["VALUE"];
return null;
}
return null;
}
/* mission */
if($name == "_MISSIONHISTORIES") {
$this->open = "_MISSIONHISTORIES";
return null;
}
if($this->open == "_MISSIONHISTORIES") {
if($name == "__KEY__") {
$this->entity = new Mission();
$this->entity->mission = $attrs["VALUE"];
return null;
}
if($name == "SUCCESSFULL") {
$this->entity->successfull = $attrs["VALUE"];
return null;
}
if($name == "UTC_LASTSUCCESSDATE") {
$this->entity->utc_lastsuccessdate = $attrs["VALUE"];
return null;
}
return null;
}
if($name == "_FRIENDSLIST") {
$this->entity = new Friend();
$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->friendlist->friendof[] = $this->entity;
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
}
/* permanent mod */
if($name == "SCOREPERMANENTMODIFIERS") {
$this->open = "SCOREPERMANENTMODIFIERS";
return null;
}
if($this->open == "SCOREPERMANENTMODIFIERS") {
if($name == "__KEY__") {
$this->entity = new PermanentMod();
$this->entity->score = $attrs["VALUE"];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
return null;
}
/* pet */
if($name == "_PLAYERPETS") {
$this->open = "_PLAYERPETS";
return null;
}
if($this->open == "_PLAYERPETS") {
if($name == "__KEY__") {
$this->entity = new Pet();
$this->entity->pet = $attrs["VALUE"];
return null;
}
if($name == "TICKETPETSHEETID") {
$this->entity->ticketpetsheetid = $attrs["VALUE"];
return null;
}
if($name == "PETSHEETID") {
$this->entity->petsheetid = $attrs["VALUE"];
$this->petcount++;
return null;
}
if($name == "PRICE") {
$this->entity->price = $attrs["VALUE"];
return null;
}
if($name == "OWNERID") {
$this->entity->ownerid = $attrs["VALUE"];
return null;
}
if($name == "STABLEALIAS") {
$this->entity->stablealias = $attrs["VALUE"];
return null;
}
if($name == "LANDSCAPE_X") {
$this->entity->landscape_x = $attrs["VALUE"];
return null;
}
if($name == "LANDSCAPE_Y") {
$this->entity->landscape_y = $attrs["VALUE"];
return null;
}
if($name == "LANDSCAPE_Z") {
$this->entity->landscape_z = $attrs["VALUE"];
return null;
}
if($name == "UTC_DEATHTICK") {
$this->entity->utc_deathtick = $attrs["VALUE"];
return null;
}
if($name == "PETSTATUS") {
$this->entity->petstatus = $attrs["VALUE"];
return null;
}
if($name == "SLOT") {
$this->entity->slot = $attrs["VALUE"];
return null;
}
if($name == "ISTPALLOWED") {
$this->entity->istpallowed = $attrs["VALUE"];
return null;
}
if($name == "SATIETY") {
$this->entity->satiety = $attrs["VALUE"];
return null;
}
if($name == "CUSTOMNAME") {
$this->entity->customname = $attrs["VALUE"];
return null;
}
return null;
}
/* physical characteristics */
if($name == "_PHYSICALCHARACTERISTICS") {
$this->open = "_PHYSICALCHARACTERISTICS";
return null;
}
if($this->open == "_PHYSICALCHARACTERISTICS") {
if($name == "__KEY__") {
$this->entity = new PhysCharacs();
$this->entity->charac = $attrs["VALUE"];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
return null;
}
/* physical scores */
if($name == "PHYSICALSCORES") {
$this->open = "PHYSICALSCORES";
return null;
}
if($this->open == "PHYSICALSCORES") {
if($name == "__KEY__") {
$this->entity = new PhysScores();
$this->entity->score = $attrs["VALUE"];
return null;
}
if($name == "CURRENT") {
$this->entity->current = $attrs["VALUE"];
return null;
}
if($name == "BASE") {
$this->entity->base = $attrs["VALUE"];
return null;
}
if($name == "MAX") {
$this->entity->max = $attrs["VALUE"];
return null;
}
if($name == "BASEREGENERATEREPOS") {
$this->entity->baseregeneraterepos = $attrs["VALUE"];
return null;
}
if($name == "BASEREGENERATEACTION") {
$this->entity->baseregenerateaction = $attrs["VALUE"];
return null;
}
if($name == "CURRENTREGENERATE") {
$this->entity->currentregenerate = $attrs["VALUE"];
return null;
}
return null;
}
/* skill points */
if($name == "SKILLPOINTS") {
$this->open = "SKILLPOINTS";
return null;
}
if($this->open == "SKILLPOINTS") {
if($name == "__KEY__") {
$this->entity = new SkillPoints();
$this->entity->skill = $attrs["VALUE"];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
return null;
}
/* spent skill points */
if($name == "SPENTSKILLPOINTS") {
$this->open = "SPENTSKILLPOINTS";
return null;
}
if($this->open == "SPENTSKILLPOINTS") {
if($name == "__KEY__") {
$this->entity = new SpentSkillPoints();
$this->entity->skill = $attrs["VALUE"];
return null;
}
if($name == "__VAL__") {
$this->entity->value = $attrs["VALUE"];
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
return null;
}
/* skills */
if($name == "SKILLS") {
$this->open = "SKILLS";
return null;
}
if($this->open == "SKILLS") {
if($name == "__KEY__") {
$this->entity = new Skill();
$this->entity->skill = $attrs["VALUE"];
return null;
}
if($name == "BASE") {
$this->entity->base = $attrs["VALUE"];
return null;
}
if($name == "CURRENT") {
$this->entity->current = $attrs["VALUE"];
return null;
}
if($name == "MAXLVLREACHED") {
$this->entity->maxlvlreached = $attrs["VALUE"];
return null;
}
if($name == "XP") {
$this->entity->xp = $attrs["VALUE"];
return null;
}
if($name == "XPNEXTLVL") {
$this->entity->xpnextlvl = $attrs["VALUE"];
return null;
}
return null;
}
/* Position */
if($name == "POSSTATE") {
$this->open = "POSSTATE";
$this->entity = new Position();
return null;
}
if($this->open == "POSSTATE") {
if($name == "X") {
$this->entity->x = $attrs["VALUE"];
return null;
}
if($name == "Y") {
$this->entity->y = $attrs["VALUE"];
return null;
}
if($name == "Z") {
$this->entity->z = $attrs["VALUE"];
return null;
}
if($name == "HEADING") {
$this->entity->heading = $attrs["VALUE"];
return null;
}
return null;
}
/* items */
if($name == "ROOMINVENTORY") {
$this->inv = "room";
return null;
}
if($name == "INVENTORY") {
$this->iblock = true;
return null;
}
if($this->iblock == true) {
if($name == "__KEY__") {
$this->inv = $attrs["VALUE"];
}
if($name == "__VAL__") {
return null;
}
}
if($name == "_ITEMS" || $name == "_ITEM") {
#echo "i<br>";
$this->open = "_ITEM";
$this->entity = new Item();
$this->entity->inventory = $this->inv;
$this->itemcount++;
return null;
}
if($this->open == "_ITEM") {
if($name == "_CRAFTPARAMETERS") {
$this->icraft = true;
return null;
}
if($this->icraft == true) {
$this->entity->_craftparameters[strtolower($name)] = $attrs["VALUE"];
return null;
}
if($name == "_ITEMID") {
$this->entity->_itemid = $attrs["VALUE"];
return null;
}
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'];
}
$this->entity->_sheetid = $attrs["VALUE"];
return null;
}
if($name == "_LOCSLOT") {
$this->entity->_locslot = $attrs["VALUE"];
return null;
}
if($name == "_HP") {
$this->entity->_hp = $attrs["VALUE"];
return null;
}
if($name == "_RECOMMENDED") {
$this->entity->_recommended = $attrs["VALUE"];
return null;
}
if($name == "_CREATORID") {
$this->entity->_creatorid = $attrs["VALUE"];
return null;
}
if($name == "_PHRASEID") {
$this->entity->_phraseid = $attrs["VALUE"];
return null;
}
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"];
return null;
}
if($name == "_USENEWSYSTEMREQUIREMENT") {
$this->entity->_usenewsystemrequirement = $attrs["VALUE"];
return null;
}
if($name == "_REQUIREDSKILLLEVEL") {
$this->entity->_requiredskilllevel = $attrs["VALUE"];
return null;
}
if($name == "_CUSTOMTEXT") {
$this->entity->_customtext = $attrs["VALUE"];
return null;
}
if($name == "_LOCKEDBYOWNER") {
$this->entity->_lockedbyowner = $attrs["VALUE"];
return null;
}
if($name == "_DROPABLE") {
$this->entity->_dropable = $attrs["VALUE"];
return null;
}
if($name == "STACKSIZE") {
$this->entity->stacksize = $attrs["VALUE"];
return null;
}
}
if($attrs["VALUE"] != "") {
$_DISPATCHER->dispatchValue(strtolower($name),$attrs["VALUE"]);
}
}
function endElement($parser, $name) {
global $_DISPATCHER,$XMLgenerator;
$XMLgenerator->xml_split(implode("/",$this->pathid),$name,null,false);
array_pop($this->pathid);
if(in_array($name,$this->ignore_block)) {
$this->lock = 0;
return null;
}
if($this->lock == 1) {
return null;
}
/* respawn points */
if($name == "RESPAWNPOINTS") {
$this->respawn_outer++; // increment to track double close at end of block
}
if($name == "RESPAWNPOINTS" && $this->respawn_outer > 1) {
$this->open = null;
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
/* faction points */
if($name == "FACTIONPOINTS") {
$this->open = null;
return null;
}
/* fame */
if($name == "__VAL__" && $this->open == "FAME") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
if($name == "_FAME") {
$this->open = null;
return null;
}
/* last log stats */
if($name == "_LASTLOGSTATS") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
/* mission */
if($name == "__VAL__" && $this->open == "_MISSIONHISTORIES") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->mission->missions[] = $this->entity;
$this->entity = null;
return null;
}
if($name == "_MISSIONHISTORIES") {
$this->open = null;
return null;
}
/* permanent mod */
if($name == "SCOREPERMANENTMODIFIERS") {
$this->open = null;
return null;
}
/* pet */
if($name == "__VAL__" && $this->open == "_PLAYERPETS") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
#echo "dispatched";
$this->entity = null;
return null;
}
if($name == "_PLAYERPETS") {
$this->open = null;
return null;
}
/* physical characteristics */
if($name == "_PHYSICALCHARACTERISTICS") {
$this->open = null;
return null;
}
/* physical scores */
if($name == "__VAL__" && $this->open == "PHYSICALSCORES") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
if($name == "PHYSICALSCORES") {
$this->open = null;
return null;
}
/* skill points */
if($name == "SKILLPOINTS") {
$this->open = null;
return null;
}
/* spent skill points */
if($name == "SPENTSKILLPOINTS") {
$this->open = null;
return null;
}
/* skills */
if($name == "__VAL__" && $this->open == "SKILLS") {
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->skills->skills[] = $this->entity;
$this->entity = null;
return null;
}
if($name == "SKILLS") {
$this->open = null;
return null;
}
/* position */
if($name == "POSSTATE") {
$this->entity->loadPlace();
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
return null;
}
/* items */
if($name == "_ITEMS" || $name == "_ITEM") {
#echo "c<br>";
if($this->open == "_ITEM") {
#echo var_export($this->entity,true);
$_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
$this->entity = null;
}
$this->open = null;
return null;
}
if($name == "INVENTORY") {
$this->iblock = false;
return null;
}
if($name == "_CRAFTPARAMETERS") {
$this->icraft = false;
return null;
}
/*if($name == "_ITEM" || $name == "_ITEMS") {
$this->open = null;
return null;
}*/
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class FactionPoints extends Entity {
public $faction;
public $value;
function FactionPoints() {
$this->setName("faction_points");
}
}
?>

View file

@ -0,0 +1,12 @@
<?php
class Fame extends Entity {
public $faction;
public $fame;
public $famememory;
public $lastfamechangetrend;
function Fame() {
$this->setName("fame");
}
}
?>

View file

@ -0,0 +1,15 @@
<?php
class FriendOf extends Entity {
public $id = null;
function FriendOf() {
$this->setName("friendof");
}
function getRealID() {
$tmp = explode(":",$this->id);
return $tmp[0];
}
}
?>

View file

@ -0,0 +1,15 @@
<?php
class Friend extends Entity {
public $id = null;
function Friend() {
$this->setName("friend");
}
function getRealID() {
$tmp = explode(":",$this->id);
return $tmp[0];
}
}
?>

View file

@ -0,0 +1,29 @@
<?php
class Friendlist extends Entity {
public $friends = array();
public $friendof = array();
public $confirmed = false;
function Friendlist() {
$this->setName("friendlist");
}
function countConfirmed() {
if($this->confirmed == false) {
$count = 0;
foreach($this->friends as $elem) {
$id = $elem->getRealID();
foreach($this->friendof as $elem2) {
if($elem2->getRealID() == $id) {
$count++;
}
}
}
$this->confirmed = $count;
}
return $this->confirmed;
}
}
?>

View file

@ -0,0 +1,9 @@
<?php
class Gear extends Entity {
public $items = array();
function Gear() {
$this->setName("gear");
}
}
?>

View file

@ -0,0 +1,28 @@
<?php
class Item extends Entity {
public $inventory = "";
public $_itemid = 0;
public $_sheetid = "";
public $_locslot = 0;
public $_hp = 0;
public $_recommended = "1";
public $_creatorid = "(0x0000000000:00:00:00)";
public $_phraseid = "";
public $_dropable = null;
public $stacksize = 1;
public $_usenewsystemrequirement = 1;
public $_requiredskilllevel = 0;
public $_customtext = "";
public $_lockedbyowner = 0;
public $_refinventoryslot = null;
public $refinventoryid = null;
public $_craftparameters = array();
function Item() {
$this->setName("item");
}
}
?>

View file

@ -0,0 +1,11 @@
<?php
class LastLogStats extends Entity {
public $logintime;
public $duration = 0;
public $logofftime;
function LastLogStats() {
$this->setName("lastlogstats");
}
}
?>

View file

@ -0,0 +1,9 @@
<?php
class MissionList extends Entity {
public $missions;
function MissionList() {
$this->setName("missionlist");
}
}
?>

View file

@ -0,0 +1,11 @@
<?php
class Mission extends Entity {
public $mission;
public $successful;
public $utc_lastsuccessdate;
function Mission() {
$this->setName("mission");
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class PermanentMod extends Entity {
public $score;
public $value;
function PermanentMod() {
$this->setName("permanentmodifiers");
}
}
?>

View file

@ -0,0 +1,24 @@
<?php
class Pet extends Entity {
public $pet;
public $ticketpetsheetid;
public $petsheetid;
public $pricev;
public $ownerid;
public $stablealias;
public $landscape_x;
public $landscape_y;
public $landscape_z;
public $utc_deathtick;
public $petstatus;
public $slot;
public $istpallowed;
public $satiety;
public $customname;
function Pet() {
$this->setName("pet");
#echo "created";
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class PhysCharacs extends Entity {
public $charac;
public $value;
function PhysCharacs() {
$this->setName("phys_characs");
}
}
?>

View file

@ -0,0 +1,15 @@
<?php
class PhysScores extends Entity {
public $score;
public $current;
public $base;
public $max;
public $baseregeneraterepos;
public $baseregenerateaction;
public $currentregenerate;
function PhysScores() {
$this->setName("phys_scores");
}
}
?>

View file

@ -0,0 +1,74 @@
<?php
class Position extends Entity {
public $x;
public $y;
public $z;
public $heading;
public $placeid;
function Position() {
$this->setName("position");
$this->placeid = "place_unknown";
}
function loadPlace() {
global $_DISPATCHER;
@include_once("script/include_InPoly_class.php");
$region = array();
$subregion = false;
include("script/places/global.php");
$point = floor($this->x/1000)." ".floor($this->y/1000);
$pointLocation = new pointLocation();
$res = $pointLocation->pointInPolygon($point, $region['place_silan'], false);
if($res != "outside") {
include("script/places/silan.php");
}
else {
include("script/places/continents.php");
$region2 = $region;
foreach($region2 as $key=>$r) {
$res = $pointLocation->pointInPolygon($point, $r, false);
if($res != "outside") {
include("script/places/".$key.".php");
if($subregion == true) {
foreach($region as $key2=>$r2) {
$res2 = $pointLocation->pointInPolygon($point, $r2, false);
if($res2 != "outside") {
include("script/places/".$key."/".$key2.".php");
break;
}
}
}
break;
}
}
}
foreach($region as $key=>$r) {
$res = $pointLocation->pointInPolygon($point, $r, false);
if($res != "outside") {
if($this->placeid == "place_unknown") {
$this->placeid = $key;
}
else {
$tmp = new Position();
$tmp->x = $this->x;
$tmp->y = $this->y;
$tmp->z = $this->z;
$tmp->heading = $this->heading;
$tmp->placeid = $key;
$_DISPATCHER->dispatchEntity($tmp->getName(),$tmp);
}
#break;
}
}
}
}
?>

View file

@ -0,0 +1,80 @@
<?php
class RespawnPoints extends Entity {
public $spawns;
private $region_map;
function RespawnPoints() {
$this->setName("respawn_points");
$this->spawns = array();
$this->region_map = array();
$this->region_map['spawn_global_bagne_matis'] = "roots";
$this->region_map['spawn_global_bagne_nexus'] = "roots";
$this->region_map['spawn_global_route_gouffre_fyros'] = "roots";
$this->region_map['spawn_global_route_gouffre_nexus'] = "roots";
$this->region_map['spawn_global_route_gouffre_tryker'] = "roots";
$this->region_map['spawn_global_route_gouffre_zorai'] = "roots";
$this->region_map['spawn_global_sources_fyros'] = "roots";
$this->region_map['spawn_global_sources_zorai'] = "roots";
$this->region_map['spawn_global_terre_nexus'] = "roots";
$this->region_map['spawn_global_terre_zorai'] = "roots";
$this->region_map['spawn_global_nexus_bagne'] = "roots";
$this->region_map['spawn_global_nexus_route_gouffre'] = "roots";
$this->region_map['spawn_global_nexus_terre'] = "roots";
// 13/13
$this->region_map['spawn_global_fyros_matis'] = "desert";
$this->region_map['spawn_global_fyros_route_gouffre'] = "desert";
$this->region_map['spawn_global_fyros_sources'] = "desert";
$this->region_map['spawn_global_fyros_to_zorai'] = "desert";
$this->region_map['spawn_kami_place_pyr'] = "desert";
$this->region_map['spawn_kami_place_thesos'] = "desert";
$this->region_map['spawn_karavan_place_pyr'] = "desert";
// 7/7
$this->region_map['spawn_global_matis_bagne'] = "forest";
$this->region_map['spawn_global_matis_fyros'] = "forest";
$this->region_map['spawn_global_matis_tryker'] = "forest";
$this->region_map['spawn_kami_place_dyron'] = "forest";
$this->region_map['spawn_kami_place_yrkanis'] = "forest";
$this->region_map['spawn_karavan_place_avalae'] = "forest";
$this->region_map['spawn_karavan_place_davae'] = "forest";
#$this->region_map['spawn_karavan_place_yrkanis'] = "forest";
// 8/7
$this->region_map['spawn_global_tryker_matis'] = "lakes";
$this->region_map['spawn_global_tryker_route_gouffre'] = "lakes";
#$this->region_map['spawn_kami_place_fairhaven'] = "lakes";
$this->region_map['spawn_karavan_place_avendale'] = "lakes";
$this->region_map['spawn_karavan_place_crystabell'] = "lakes";
$this->region_map['spawn_karavan_place_fairhaven'] = "lakes";
$this->region_map['spawn_karavan_place_windermeer'] = "lakes";
// 7/6
$this->region_map['spawn_kami_place_hoi_cho'] = "jungle";
$this->region_map['spawn_kami_place_jen_lai'] = "jungle";
$this->region_map['spawn_kami_place_min_cho'] = "jungle";
$this->region_map['spawn_global_zorai_route_gouffre'] = "jungle";
$this->region_map['spawn_global_zorai_sources'] = "jungle";
$this->region_map['spawn_global_zorai_terre'] = "jungle";
$this->region_map['spawn_global_zorai_to_fyros'] = "jungle";
$this->region_map['spawn_kami_place_zora'] = "jungle";
#$this->region_map['spawn_karavan_place_zora'] = "jungle";
// 9/8
}
function countRegion($r) {
$c = 0;
foreach($this->spawns as $elem) {
if($this->region_map[$elem] == $r) {
$c++;
}
}
return $c;
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class SkillList extends Entity {
public $skills;
function SkillList() {
$this->setName("skilllist");
$this->skills = array();
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class SkillPoints extends Entity {
public $skill;
public $value;
function SkillPoints() {
$this->setName("skillpoints");
}
}
?>

View file

@ -0,0 +1,14 @@
<?php
class Skill extends Entity {
public $skill;
public $current;
public $base;
public $maxlvlreached;
public $xp;
public $xpnextlvl;
function Skill() {
$this->setName("skill");
}
}
?>

View file

@ -0,0 +1,10 @@
<?php
class SpentSkillPoints extends Entity {
public $skill;
public $value;
function SpentSkillPoints() {
$this->setName("spentskillpoints");
}
}
?>

View file

@ -0,0 +1,20 @@
<?php
class Title extends Entity {
public $title_id;
public $title;
function Title() {
$this->setName("title");
$this->title_id = "";
$this->title = null;
}
function loadID() {
global $DBc;
$res = $DBc->sendSQL("SELECT t_id FROM ryzom_title WHERE t_male='".$DBc->mre($this->title)."' OR t_female='".$DBc->mre($this->title)."'","ARRAY");
$this->title_id = $res[0]['t_id'];
}
}
?>

View file

@ -0,0 +1,84 @@
<?php
$this->def['XML/UTC__PVPFLAGLASTTIMECHANGE'] = array("debug");
$this->def['XML/UTC__PVPRECENTACTIONTIME'] = array("debug");
$this->def['XML/UTC__PVPFLAGTIMESETTEDON'] = array("debug");
$this->def['XML/_REGIONKILLEDINPVP'] = array("debug");
$this->def['XML/_CREATIONPOINTSREPARTITION'] = array("debug");
$this->def['XML/UTC__FORBIDAURAUSESTARTDATE'] = array("debug");
$this->def['XML/UTC__FORBIDAURAUSEENDDATE'] = array("debug");
array_push($this->def['XML/_TITLE'],"debug");
$this->def['XML/NAMESTRINGID'] = array("debug");
$this->def['XML/_HAIRCUTEDISCOUNT'] = array("debug");
$this->addWildcard("XML/_FORBIDPOWERDATES","debug");
$this->def['XML/_INEFFECTIVEAURAS'] = array("debug");
$this->def['XML/_INEFFECTIVEAURAS/_AURAACTIVATIONDATES'] = array("debug");
$this->def['XML/_INEFFECTIVEAURAS/_AURAACTIVATIONDATES/DEACTIVATIONDATE'] = array("debug");
$this->def['XML/_INEFFECTIVEAURAS/_AURAACTIVATIONDATES/ACTIVATIONDATE'] = array("debug");
$this->def['XML/_INEFFECTIVEAURAS/_AURAACTIVATIONDATES/CONSUMABLEFAMILYID'] = array("debug");
$this->def['XML/_INEFFECTIVEAURAS/_AURAACTIVATIONDATES/POWERTYPE'] = array("debug");
$this->def['XML/_MODIFIERSINDB'] = array("debug");
$this->addWildcard("XML/_MODIFIERSINDB/BONUS","debug");
$this->addWildcard("XML/_MODIFIERSINDB/MALUS","debug");
$this->def['XML/ENTITYBASE'] = array("debug");
$this->def['XML/ENTITYBASE/_SHEETID'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEATTACKMODIFIERONENEMY'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEATTACKMODIFIERONSELF'] = array("debug");
$this->def['XML/ENTITYBASE/MAGICCASTINGMODIFIERONSELF'] = array("debug");
$this->def['XML/ENTITYBASE/MAGICCASTINGMODIFIERONENEMY'] = array("debug");
$this->def['XML/ENTITYBASE/RANGEATTACKMODIFIERONENEMY'] = array("debug");
$this->def['XML/ENTITYBASE/RANGEATTACKMODIFIERONSELF'] = array("debug");
$this->def['XML/ENTITYBASE/ATTACKMODIFIERONSELF'] = array("debug");
$this->def['XML/ENTITYBASE/CHANCETOFAILSTRATEGY'] = array("debug");
$this->def['XML/ENTITYBASE/CHANCETOFAILSPELL'] = array("debug");
$this->def['XML/ENTITYBASE/CHANCETOFAILFABER'] = array("debug");
$this->def['XML/ENTITYBASE/CHANCETOFAILHARVEST'] = array("debug");
$this->def['XML/ENTITYBASE/CHANCETOFAILTRACKING'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEATTACKSLOW'] = array("debug");
$this->def['XML/ENTITYBASE/MELEESLASHINGDAMAGEARMOR'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEBLUNTDAMAGEARMOR'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEPIERCINGDAMAGEARMOR'] = array("debug");
$this->def['XML/ENTITYBASE/MELEEDAMAGEMODIFIERFACTOR'] = array("debug");
$this->def['XML/ENTITYBASE/RANGEDAMAGEMODIFIERFACTOR'] = array("debug");
$this->def['XML/ENTITYBASE/CREATUREMELEETAKENDAMAGEFACTOR'] = array("debug");
$this->def['XML/ENTITYBASE/CREATURERANGETAKENDAMAGEFACTOR'] = array("debug");
$this->def['XML/ENTITYBASE/COMBATBRICKLATENCYMULTIPLIER'] = array("debug");
$this->def['XML/ENTITYBASE/MAGICBRICKLATENCYMULTIPLIER'] = array("debug");
$this->def['XML/ENTITYBASE/ARMORQUALITYMODIFIER'] = array("debug");
$this->def['XML/ENTITYBASE/WEAPONQUALITYMODIFIER'] = array("debug");
$this->def['XML/ENTITYBASE/ARMORABSORBTIONMULTIPLIER'] = array("debug");
$this->def['XML/RINGREWARDPOINTS'] = array("debug");
$this->def['XML/RINGREWARDPOINTS/RINGREWARDPOINTS/__KEY__'] = array("debug");
$this->def['XML/RINGREWARDPOINTS/RINGREWARDPOINTS/__VAL__'] = array("debug");
$this->addWildcard("XML/_PERSISTENTEFFECTS","debug");
$this->def['XML/_PACT'] = array("debug");
$this->def['XML/_PACT/PACTNATURE'] = array("debug");
$this->def['XML/_PACT/PACTTYPE'] = array("debug");
array_push($this->def['XML/_PLAYERPETS'],"debug");
array_push($this->def['XML/_PLAYERPETS/__KEY__'],"debug");
array_push($this->def['XML/_PLAYERPETS/__VAL__'],"debug");
$this->def['XML/_PLAYERPETS/__VAL__/TICKETPETSHEETID'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/PRICE'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/OWNERID'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/STABLEALIAS'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/SLOT'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/ISTPALLOWED'] = array("debug");
$this->def['XML/_PLAYERPETS/__VAL__/CUSTOMNAME'] = array("debug");
$this->def['XML/STARTINGCHARACTERISTICVALUES'] = array("debug");
$this->def['XML/STARTINGCHARACTERISTICVALUES/__KEY__'] = array("debug");
$this->def['XML/STARTINGCHARACTERISTICVALUES/__VAL__'] = array("debug");
$this->def['XML/_ENCYCLOCHAR'] = array("debug");
$this->def['XML/_ENCYCLOCHAR/_ENCYCHARALBUMS'] = array("debug");
$this->def['XML/_ENCYCLOCHAR/_ENCYCHARALBUMS/ALBUMSTATE'] = array("debug");
$this->def['XML/_ENCYCLOCHAR/_ENCYCHARALBUMS/THEMAS'] = array("debug");
$this->def['XML/_ENCYCLOCHAR/_ENCYCHARALBUMS/THEMAS/THEMASTATE'] = array("debug");
$this->def['XML/_ENCYCLOCHAR/_ENCYCHARALBUMS/THEMAS/RITETASKSTATEPACKED'] = array("debug");
$this->def['XML/_GAMEEVENT'] = array("debug");
$this->def['XML/_GAMEEVENT/UTC__DATE'] = array("debug");
$this->addWildcard("XML/ENTITYBASE/_ENTITYPOSITION","debug");
$this->addWildcard("XML/_ENTITYPOSITION","debug");
$this->def['XML/INVISIBLE'] = array("debug");
$this->def['XML/AGGROABLE'] = array("debug");
$this->def['XML/GODMODE'] = array("debug");
?>

View file

@ -0,0 +1,12 @@
<?php
$this->def['XML/FACTIONPOINTS'] = array("faction");
$this->def['XML/FACTIONPOINTS/__KEY__'] = array("faction");
$this->def['XML/FACTIONPOINTS/__VAL__'] = array("faction");
$this->def['XML/_ORGANIZATION'] = array("faction");
$this->def['XML/_ORGANIZATIONSTATUS'] = array("faction");
$this->def['XML/_ORGANIZATIONPOINTS'] = array("faction");
$this->def['XML/DECLAREDCULT'] = array("faction");
$this->def['XML/DECLAREDCIV'] = array("faction");
?>

View file

@ -0,0 +1,10 @@
<?php
#$this->def['XML/_FAMES/_FAME'] = array("fame");
$this->def['XML/_FAMES/_FAME/__KEY__'] = array("fame");
$this->def['XML/_FAMES/_FAME/__VAL__'] = array("fame");
$this->def['XML/_FAMES/_FAME/__VAL__/FAME'] = array("fame");
$this->def['XML/_FAMES/_FAME/__VAL__/FAMEMEMORY'] = array("fame");
$this->def['XML/_FAMES/_FAME/__VAL__/LASTFAMECHANGETREND'] = array("fame");
?>

View file

@ -0,0 +1,131 @@
<?php
$this->def['XML/_MONEY'] = array("inventory");
$this->def['XML/_PLAYERROOM'] = array("inventory");
$this->def['XML/_PLAYERROOM/BUILDING'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_ITEMID'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_SHEETID'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_LOCSLOT'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_HP'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_RECOMMENDED'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CREATORID'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_PHRASEID'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_USENEWSYSTEMREQUIREMENT'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_REQUIREDSKILLLEVEL'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CUSTOMTEXT'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_LOCKEDBYOWNER'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/STACKSIZE'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DURABILITY'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/WEIGHT'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/STATENERGY'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DODGEMODIFIER'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PARRYMODIFIER'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTIONFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/MAXSLASHINGPROTECTION'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/MAXBLUNTPROTECTION'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/MAXPIERCINGPROTECTION'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/COLOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/FOCUSBUFF'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/HPBUFF'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/SAPBUFF'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/STABUFF'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION1'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION2'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION3'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/SAPLOAD'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DMG'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/SPEED'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/RANGE'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/ADVERSARYDODGEMODIFIER'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/ADVERSARYPARRYMODIFIER'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION1FACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION2FACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PROTECTION3FACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DESERTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/FORESTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/LACUSTRERESISTANCEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/JUNGLERESISTANCEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/PRIMARYROOTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/ELEMENTALCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/ELEMENTALPOWERFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONPOWERFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/HEALCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/HEALPOWERFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/_PLAYERROOM/ROOMINVENTORY/_ITEMS/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONPOWERFACTOR'] = array("inventory");
$this->def['XML/_PLAYERPETS'] = array("inventory");
$this->def['XML/_PLAYERPETS/__KEY__'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/PETSHEETID'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/LANDSCAPE_X'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/LANDSCAPE_Y'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/LANDSCAPE_Z'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/UTC_DEATHTICK'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/PETSTATUS'] = array("inventory");
$this->def['XML/_PLAYERPETS/__VAL__/SATIETY'] = array("inventory");
$this->def['XML/INVENTORY'] = array("inventory");
$this->def['XML/INVENTORY/__KEY__'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_ITEMID'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_SHEETID'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_LOCSLOT'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_HP'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_RECOMMENDED'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CREATORID'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_PHRASEID'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_USENEWSYSTEMREQUIREMENT'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_REQUIREDSKILLLEVEL'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CUSTOMTEXT'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_LOCKEDBYOWNER'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/STACKSIZE'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DURABILITY'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/WEIGHT'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/STATENERGY'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DODGEMODIFIER'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PARRYMODIFIER'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTIONFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/MAXSLASHINGPROTECTION'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/MAXBLUNTPROTECTION'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/MAXPIERCINGPROTECTION'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/COLOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/FOCUSBUFF'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/HPBUFF'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/SAPBUFF'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/STABUFF'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION1'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION2'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION3'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/SAPLOAD'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DMG'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/SPEED'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/RANGE'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/ADVERSARYDODGEMODIFIER'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/ADVERSARYPARRYMODIFIER'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION1FACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION2FACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PROTECTION3FACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DESERTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/FORESTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/LACUSTRERESISTANCEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/JUNGLERESISTANCEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/PRIMARYROOTRESISTANCEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/ELEMENTALCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/ELEMENTALPOWERFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONPOWERFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/HEALCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/HEALPOWERFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONPOWERFACTOR'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/_REFINVENTORYSLOT'] = array("inventory");
$this->def['XML/INVENTORY/__VAL__/_ITEM/REFINVENTORYID'] = array("inventory");
?>

View file

@ -0,0 +1,11 @@
<?php
$this->def['XML/_BOUGHTPHRASES'] = array("knowledge");
$this->def['XML/_KNOWNBRICKS'] = array("knowledge");
$this->def['XML/_KNOWNPHRASES'] = array("knowledge");
$this->def['XML/_MEMORIZEDPHRASES'] = array("knowledge");
$this->def['XML/_MEMORIZEDPHRASES/PHRASEDESC/NAME'] = array("knowledge");
$this->def['XML/_MEMORIZEDPHRASES/PHRASEDESC/BRICKS'] = array("knowledge");
$this->def['XML/RESPAWNPOINTS/RESPAWNPOINTS'] = array("knowledge");
?>

View file

@ -0,0 +1,11 @@
<?php
$this->def['XML/_FIRSTCONNECTEDTIME'] = array("logs");
$this->def['XML/_LASTCONNECTEDTIME'] = array("logs");
$this->def['XML/_PLAYEDTIME'] = array("logs");
$this->def['XML/_LASTLOGSTATS'] = array("logs");
$this->def['XML/_LASTLOGSTATS/LOGINTIME'] = array("logs");
$this->def['XML/_LASTLOGSTATS/DURATION'] = array("logs");
$this->def['XML/_LASTLOGSTATS/LOGOFFTIME'] = array("logs");
?>

View file

@ -0,0 +1,3 @@
<?php
$this->addWildcard("XML/_MISSIONS","missions");
?>

View file

@ -0,0 +1,40 @@
<?php
$this->def['XML/_HAIRTYPE'] = array("public");
$this->def['XML/HAIRTYPE'] = array("public");
$this->def['XML/_HAIRCOLOR'] = array("public");
$this->def['XML/HAIRCOLOR'] = array("public");
$this->def['XML/_HATCOLOR'] = array("public");
$this->def['XML/_JACKETCOLOR'] = array("public");
$this->def['XML/_ARMSCOLOR'] = array("public");
$this->def['XML/_TROUSERSCOLOR'] = array("public");
$this->def['XML/_FEETCOLOR'] = array("public");
$this->def['XML/_HANDSCOLOR'] = array("public");
$this->def['XML/_PVPFLAG'] = array("public");
$this->def['XML/_GUILDID'] = array("public");
$this->def['XML/_TITLE'] = array("public");
$this->def['XML/GABARITHEIGHT'] = array("public");
$this->def['XML/GABARITTORSOWIDTH'] = array("public");
$this->def['XML/GABARITARMSWIDTH'] = array("public");
$this->def['XML/GABARITLEGSWIDTH'] = array("public");
$this->def['XML/GABARITBREASTSIZE'] = array("public");
$this->def['XML/MORPHTARGET1'] = array("public");
$this->def['XML/MORPHTARGET2'] = array("public");
$this->def['XML/MORPHTARGET3'] = array("public");
$this->def['XML/MORPHTARGET4'] = array("public");
$this->def['XML/MORPHTARGET5'] = array("public");
$this->def['XML/MORPHTARGET6'] = array("public");
$this->def['XML/MORPHTARGET7'] = array("public");
$this->def['XML/MORPHTARGET8'] = array("public");
$this->def['XML/EYESCOLOR'] = array("public");
$this->def['XML/TATTOO'] = array("public");
$this->def['XML/NORMALPOSITIONS/VEC/POSSTATE'] = array("public");
$this->def['XML/NORMALPOSITIONS/VEC/POSSTATE/X'] = array("public");
$this->def['XML/NORMALPOSITIONS/VEC/POSSTATE/Y'] = array("public");
$this->def['XML/NORMALPOSITIONS/VEC/POSSTATE/Z'] = array("public");
$this->def['XML/NORMALPOSITIONS/VEC/POSSTATE/HEADING'] = array("public");
$this->def['XML/ENTITYBASE/_NAME'] = array("public");
$this->def['XML/ENTITYBASE/_GENDER'] = array("public");
$this->def['XML/ENTITYBASE/_SIZE'] = array("public");
?>

View file

@ -0,0 +1,66 @@
<?php
$this->def['XML/_ITEMSINSHOPSTORE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_PRICE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_RETIREPRICE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/UTC__STARTSALECYCLE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_OWNER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_CONTINENT'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_QUANTITY'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_IDENTIFIER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_ITEMID'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_SHEETID'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_LOCSLOT'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_HP'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_RECOMMENDED'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CREATORID'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_PHRASEID'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/STACKSIZE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_USENEWSYSTEMREQUIREMENT'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CUSTOMTEXT'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_LOCKEDBYOWNER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DURABILITY'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/WEIGHT'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/STATENERGY'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DODGEMODIFIER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PARRYMODIFIER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTIONFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/MAXSLASHINGPROTECTION'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/MAXBLUNTPROTECTION'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/MAXPIERCINGPROTECTION'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/COLOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/FOCUSBUFF'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/HPBUFF'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/SAPBUFF'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/STABUFF'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION1'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION2'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION3'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/SAPLOAD'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DMG'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/SPEED'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/RANGE'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/ADVERSARYDODGEMODIFIER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/ADVERSARYPARRYMODIFIER'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION1FACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION2FACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PROTECTION3FACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DESERTRESISTANCEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/FORESTRESISTANCEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/LACUSTRERESISTANCEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/JUNGLERESISTANCEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/PRIMARYROOTRESISTANCEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/ELEMENTALCASTINGTIMEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/ELEMENTALPOWERFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/OFFENSIVEAFFLICTIONPOWERFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/HEALCASTINGTIMEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/HEALPOWERFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONCASTINGTIMEFACTOR'] = array("shop");
$this->def['XML/_ITEMSINSHOPSTORE/_ITEMSFORSALE/_ITEMPTR/_CRAFTPARAMETERS/DEFENSIVEAFFLICTIONPOWERFACTOR'] = array("shop");
?>

View file

@ -0,0 +1,21 @@
<?php
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__KEY__'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__/BASE'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__/CURRENT'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__/MAXLVLREACHED'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__/XP'] = array("skills");
$this->def['XML/ENTITYBASE/_SKILLS/SKILLS/__VAL__/XPNEXTLVL'] = array("skills");
$this->def['XML/SKILLPOINTS'] = array("skills");
$this->def['XML/SKILLPOINTS/__KEY__'] = array("skills");
$this->def['XML/SKILLPOINTS/__VAL__'] = array("skills");
$this->def['XML/SPENTSKILLPOINTS'] = array("skills");
$this->def['XML/SPENTSKILLPOINTS/__KEY__'] = array("skills");
$this->def['XML/SPENTSKILLPOINTS/__VAL__'] = array("skills");
$this->def['XML/SCOREPERMANENTMODIFIERS'] = array("skills");
$this->def['XML/SCOREPERMANENTMODIFIERS/__KEY__'] = array("skills");
$this->def['XML/SCOREPERMANENTMODIFIERS/__VAL__'] = array("skills");
?>

View file

@ -0,0 +1,7 @@
<?php
$this->def['XML/_FRIENDSLIST'] = array("social");
$this->def['XML/_ISFRIENDOF'] = array("social");
$this->def['XML/FRIENDVISIBILITy'] = array("social");
?>

View file

@ -0,0 +1,27 @@
<?php
$this->def['XML/_HPB'] = array("stats");
$this->def['XML/_PVPPOINT'] = array("stats");
$this->def['XML/_DEATHPENALTIES'] = array("stats");
$this->def['XML/_DEATHPENALTIES/_NBDEATH'] = array("stats");
$this->def['XML/_DEATHPENALTIES/_CURRENTDEATHXP'] = array("stats");
$this->def['XML/_DEATHPENALTIES/_DEATHXPTOGAIN'] = array("stats");
$this->def['XML/_DEATHPENALTIES/_BONUSUPDATETIME'] = array("stats");
$this->def['XML/ENTITYBASE/_DODGEASDEFENSE'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSCHARACS/_PHYSICALCHARACTERISTICS'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSCHARACS/_PHYSICALCHARACTERISTICS/__KEY__'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSCHARACS/_PHYSICALCHARACTERISTICS/__VAL__'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/BASEWALKSPEED'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/BASERUNSPEED'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/CURRENTWALKSPEED'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/CURRENTRUNSPEED'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__KEY__'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/CURRENT'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/BASE'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/MAX'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/BASEREGENERATEREPOS'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/BASEREGENERATEACTION'] = array("stats");
$this->def['XML/ENTITYBASE/_PHYSSCORES/__VAL__/CURRENTREGENERATE'] = array("stats");
?>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

View file

@ -0,0 +1,278 @@
-- --------------------------------------------------------
-- Host: 178.33.225.92
-- Server version: 5.5.28-0ubuntu0.12.04.2-log - (Ubuntu)
-- Server OS: debian-linux-gnu
-- HeidiSQL version: 7.0.0.4053
-- Date/time: 2012-12-10 14:52:03
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
-- Dumping structure for table app_achievements.ach_achievement
CREATE TABLE IF NOT EXISTS `ach_achievement` (
`aa_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`aa_category` bigint(20) unsigned NOT NULL,
`aa_parent` bigint(20) unsigned DEFAULT NULL,
`aa_tie_race` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_tie_cult` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_tie_civ` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_image` varchar(64) COLLATE utf8_bin NOT NULL,
`aa_dev` tinyint(1) unsigned NOT NULL DEFAULT '0',
`aa_sticky` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`aa_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_achievement_lang
CREATE TABLE IF NOT EXISTS `ach_achievement_lang` (
`aal_achievement` bigint(20) unsigned NOT NULL,
`aal_lang` varchar(2) COLLATE utf8_bin NOT NULL,
`aal_name` varchar(255) COLLATE utf8_bin NOT NULL,
`aal_template` varchar(255) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`aal_achievement`,`aal_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_atom
CREATE TABLE IF NOT EXISTS `ach_atom` (
`atom_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`atom_objective` bigint(20) unsigned NOT NULL,
`atom_mandatory` tinyint(1) unsigned NOT NULL,
`atom_ruleset` blob NOT NULL,
`atom_ruleset_parsed` blob NOT NULL,
PRIMARY KEY (`atom_id`),
KEY `atom_objective` (`atom_objective`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_category
CREATE TABLE IF NOT EXISTS `ach_category` (
`ac_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`ac_parent` bigint(20) unsigned DEFAULT NULL,
`ac_order` smallint(5) unsigned NOT NULL,
`ac_image` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`ac_dev` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ac_heroic` tinyint(1) unsigned NOT NULL,
`ac_contest` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`ac_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_category_lang
CREATE TABLE IF NOT EXISTS `ach_category_lang` (
`acl_category` bigint(20) unsigned NOT NULL,
`acl_lang` varchar(2) COLLATE utf8_bin NOT NULL,
`acl_name` varchar(255) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`acl_category`,`acl_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_fb_token
CREATE TABLE IF NOT EXISTS `ach_fb_token` (
`aft_player` bigint(20) unsigned NOT NULL,
`aft_token` varchar(255) NOT NULL,
`aft_date` bigint(20) unsigned NOT NULL,
`aft_allow` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`aft_player`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_objective
CREATE TABLE IF NOT EXISTS `ach_objective` (
`ao_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`ao_task` bigint(20) unsigned NOT NULL,
`ao_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL,
`ao_value` bigint(20) unsigned DEFAULT NULL,
`ao_display` enum('simple','meta','value','hidden') COLLATE utf8_bin NOT NULL DEFAULT 'hidden',
`ao_metalink` bigint(20) unsigned DEFAULT NULL,
PRIMARY KEY (`ao_id`),
KEY `ao_task` (`ao_task`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_objective_lang
CREATE TABLE IF NOT EXISTS `ach_objective_lang` (
`aol_objective` bigint(20) unsigned NOT NULL,
`aol_lang` varchar(2) COLLATE utf8_bin NOT NULL,
`aol_name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`aol_objective`,`aol_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_player_atom
CREATE TABLE IF NOT EXISTS `ach_player_atom` (
`apa_atom` bigint(20) unsigned NOT NULL,
`apa_player` bigint(20) unsigned NOT NULL,
`apa_date` bigint(20) unsigned NOT NULL,
`apa_expire` blob,
`apa_state` enum('GRANT','DENY') COLLATE utf8_bin NOT NULL,
`apa_value` bigint(20) unsigned NOT NULL,
KEY `apa_atom` (`apa_atom`,`apa_player`),
KEY `apa_state` (`apa_state`),
KEY `apa_atom_2` (`apa_atom`,`apa_player`,`apa_state`),
KEY `apa_player` (`apa_player`),
KEY `apa_atom_3` (`apa_atom`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_player_objective
CREATE TABLE IF NOT EXISTS `ach_player_objective` (
`apo_objective` bigint(20) unsigned NOT NULL,
`apo_player` bigint(20) unsigned NOT NULL,
`apo_date` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`apo_objective`,`apo_player`),
KEY `apo_player` (`apo_player`),
KEY `apo_objective` (`apo_objective`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_player_task
CREATE TABLE IF NOT EXISTS `ach_player_task` (
`apt_task` bigint(20) unsigned NOT NULL,
`apt_player` bigint(20) unsigned NOT NULL,
`apt_date` bigint(20) unsigned NOT NULL,
`apt_fb` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`apt_task`,`apt_player`),
KEY `apt_player` (`apt_player`),
KEY `apt_task` (`apt_task`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_player_valuecache
CREATE TABLE IF NOT EXISTS `ach_player_valuecache` (
`apv_name` varchar(64) COLLATE utf8_bin NOT NULL,
`apv_player` bigint(20) unsigned NOT NULL,
`apv_value` varchar(255) COLLATE utf8_bin NOT NULL,
`apv_date` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`apv_name`,`apv_player`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_task
CREATE TABLE IF NOT EXISTS `ach_task` (
`at_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`at_achievement` bigint(20) unsigned NOT NULL,
`at_parent` bigint(20) unsigned DEFAULT NULL,
`at_value` int(10) unsigned NOT NULL,
`at_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL DEFAULT 'all',
`at_condition_value` int(10) unsigned DEFAULT NULL,
`at_dev` tinyint(1) unsigned NOT NULL DEFAULT '0',
`at_torder` smallint(5) unsigned NOT NULL,
`at_inherit` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`at_id`),
UNIQUE KEY `ap_parent` (`at_parent`),
KEY `at_achievement` (`at_achievement`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_task_lang
CREATE TABLE IF NOT EXISTS `ach_task_lang` (
`atl_task` bigint(20) unsigned NOT NULL,
`atl_lang` varchar(2) COLLATE utf8_bin NOT NULL,
`atl_name` varchar(255) COLLATE utf8_bin NOT NULL,
`atl_template` varchar(255) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`atl_task`,`atl_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_task_tie_civ
CREATE TABLE IF NOT EXISTS `ach_task_tie_civ` (
`attciv_task` bigint(20) unsigned NOT NULL,
`attciv_civ` varchar(64) NOT NULL,
PRIMARY KEY (`attciv_task`,`attciv_civ`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_task_tie_cult
CREATE TABLE IF NOT EXISTS `ach_task_tie_cult` (
`attcult_task` bigint(20) unsigned NOT NULL,
`attcult_cult` varchar(64) NOT NULL,
PRIMARY KEY (`attcult_task`,`attcult_cult`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.ach_task_tie_race
CREATE TABLE IF NOT EXISTS `ach_task_tie_race` (
`attr_task` bigint(20) unsigned NOT NULL,
`attr_race` varchar(64) NOT NULL,
PRIMARY KEY (`attr_task`,`attr_race`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.stat_daily
CREATE TABLE IF NOT EXISTS `stat_daily` (
`sd_day` date NOT NULL DEFAULT '0000-00-00',
`sd_players` bigint(20) unsigned DEFAULT NULL,
`sd_money_total` bigint(20) unsigned DEFAULT NULL,
`sd_money_avg` int(10) unsigned DEFAULT NULL,
`sd_money_mean` int(10) unsigned DEFAULT NULL,
`sd_mek_total` bigint(20) unsigned DEFAULT NULL,
`sd_mek_avg` smallint(5) unsigned DEFAULT NULL,
`sd_mek_mean` smallint(5) unsigned DEFAULT NULL,
`sd_lvl_total` bigint(20) unsigned DEFAULT NULL,
`sd_lvl_avg` int(10) unsigned DEFAULT NULL,
`sd_lvl_mean` int(10) unsigned DEFAULT NULL,
`sd_item_total` bigint(20) unsigned DEFAULT NULL,
`sd_item_avg` int(10) unsigned DEFAULT NULL,
`sd_item_mean` int(10) unsigned DEFAULT NULL,
`sd_yubo_total` bigint(20) unsigned DEFAULT NULL,
`sd_yubo_avg` int(10) unsigned DEFAULT NULL,
`sd_yubo_mean` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`sd_day`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table app_achievements.stat_players
CREATE TABLE IF NOT EXISTS `stat_players` (
`sp_char` bigint(20) unsigned NOT NULL DEFAULT '0',
`sp_money` bigint(20) unsigned DEFAULT NULL,
`sp_race` enum('r_matis','r_tryker','r_fyros','r_zorai') DEFAULT NULL,
`sp_yubototal` int(10) unsigned DEFAULT NULL,
`sp_mekcount` int(10) unsigned DEFAULT NULL,
`sp_maxlevel` smallint(5) unsigned DEFAULT NULL,
`sp_guildid` int(10) unsigned DEFAULT NULL,
`sp_itemcount` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`sp_char`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View file

@ -0,0 +1,340 @@
<?php
class AVLTree {
/*---------------------------
AVL trees are balanced B-Trees. Please refer to http://en.wikipedia.org/wiki/AVL_tree
This implementation allows the functions insert, find and remove. Please
note, that remove does not rebalance the tree, since node removal is
quite rare in this project.
---------------------------*/
private $root;
private $debug;
function AVLTree($log = false) {
$this->root = null;
$this->debug = $log;
}
function preorder() {
$this->AVLpreorder($this->root);
}
private function AVLpreorder($p) { // recursive; output preorder representation
if($p != null) {
echo $p->getID().", ";
$this->AVLpreorder($p->getLeft());
$this->AVLpreorder($p->getRight());
}
}
function inorder() {
$this->AVLinorder($this->root);
}
private function AVLinorder($p) { // recursive; output postorder representation
if($p != null) {
$this->AVLinorder($p->getLeft());
echo $p->getID().", ";
$this->AVLinorder($p->getRight());
}
}
function insert($node) { // insert a new node
if($this->root == null) {
$this->root = new AVLTreeNode($node);
}
else {
$this->root = $this->AVLinsert($this->root,new AVLTreeNode($node));
}
}
function remove($id) { // remove a node
$n = $this->AVLfind($id,$this->root);
if($n != null) {
$this->AVLremove($this->root,$n);
return $n->getNode();
}
return null;
}
function find($id) { // find a node
$res = $this->AVLfind($id,$this->root);
if($res != null) {
return $res->getNode();
}
return null;
}
private function AVLfind($id,$n) { // recursive; search for a node
if($n != null) {
if($n->getID() != $id) {
if($n->getID() > $id) {
$n = $this->AVLfind($id,$n->getLeft());
}
else {
$n = $this->AVLfind($id,$n->getRight());
}
}
}
return $n;
}
private function AVLremove($r,$n) { // remove a node from the actual tree
if($n->getLeft() == null || $n->getRight() == null) {
$s = $n;
}
else {
$s = $this->Successor($n);
$n->setNode($r->getNode());
}
if($r->getLeft() != null) {
$p = $s->getLeft();
}
else {
$p = $s->getRight();
}
if($p != null) {
$p->setParent($s->getParent());
}
if($r->getParent() == null) {
$r = $p;
}
else {
$tmp = $s->getParent();
if($s == $tmp->getLeft()) {
$tmp->setLeft($p);
}
else {
$tmp->setRight($p);
}
}
return $r;
}
private function AVLinsert($r,$n) { // insert a node into the actual tree
if($r == null) {
$r = $n;
}
else {
if($n->getID() < $r->getID()) {
$r->setLeft($this->AVLinsert($r->getLeft(),$n));
$r = $this->balance($r); // rebalance
}
elseif($n->getID() > $r->getID()) {
$r->setRight($this->AVLinsert($r->getRight(),$n));
$r = $this->balance($r); // rebalance
}
$r->setHeight(max($r->getHeightLeft(),$r->getHeightRight())+1);
}
return $r;
}
private function balance($r) { // do a rebalancation of the tree
if($r->bal() == -2) {
$lc = $r->getLeft();
if($lc->getHeightLeft() >= $lc->getHeightRight()) {
$r = $this->RotateToRight($r);
}
else {
$r = $this->DoubleRotateLeftRight($r);
}
}
if($r->bal() == 2) {
$rc = $r->getRight();
if($rc->getHeightRight() >= $rc->getHeightLeft()) {
$r = $this->RotateToLeft($r);
}
else {
$r = $this->DoubleRotateRightLeft($r);
}
}
return $r;
}
private function Successor($r) { // find the successor for a node
if($r->getRight() != null) {
return $this->Minimum($r->getRight());
}
else {
$n = $r->getParent();
while($n != null && $r == $n->getRight()) {
$r = $n;
$n = $n->getParent();
}
return $n;
}
}
private function Minimum($r) { // find the minimum of a tree
if($r == null) {
return null;
}
if($r->getLeft() == null) {
return $r;
}
$p = $r;
while($p->getLeft() != null) {
$p = $p->getLeft();
}
return $p;
}
//rotations
private function RotateToRight($r) {
if($this->debug) {
echo "rotaRight<br>";
}
$v = $r->getLeft();
$r->setLeft($v->getRight());
$v->setRight($r);
$r->setHeight(max($r->getHeightLeft(),$r->getHeightRight())+1);
$v->setHeight(max($v->getHeightLeft(),$r->getHeight())+1);
return $v;
}
private function DoubleRotateLeftRight($r) {
$r->setLeft($this->RotateToLeft($r->getLeft()));
return $this->RotateToRight($r);
}
private function RotateToLeft($r) {
if($this->debug) {
echo "rotaLeft<br>";
}
$v = $r->getRight();
$r->setRight($v->getLeft());
$v->setLeft($r);
$r->setHeight(max($r->getHeightLeft(),$r->getHeightRight())+1);
$v->setHeight(max($v->getHeightRight(),$r->getHeight())+1);
return $v;
}
private function DoubleRotateRightLeft($r) {
$r->setRight($this->RotateToRight($r->getRight()));
return $this->RotateToLeft($r);
}
//end rotations
}
/*
* AVL tree nodes
*/
class AVLTreeNode {
private $height;
private $left;
private $right;
private $node;
private $parent;
function AVLTreeNode($node) {
$this->height = 0;
$this->left = null; // left child
$this->right = null; // right child
$this->node = $node; // actual data stored
$this->parent = null; // parent node
}
function getParent() {
return $this->parent;
}
function setParent($p) {
$this->parent = $p;
}
function getNode() {
return $this->node;
}
function getLeft() {
return $this->left;
}
function getRight() {
return $this->right;
}
function getHeightLeft() {
if($this->left == null) {
return -1;
}
return $this->left->getHeight();
}
function getHeightRight() {
if($this->right == null) {
return -1;
}
return $this->right->getHeight();
}
function bal() { // calculate value to eval balancing
$r = -1;
$l = -1;
if($this->right != null) {
$r = $this->right->getHeight();
}
if($this->left != null) {
$l = $this->left->getHeight();
}
return ($r-$l);
}
function getID() {
return $this->node->getID();
}
function getHeight() {
return $this->height;
}
function setHeight($h) {
$this->height = $h;
}
function setRight($r) {
$this->right = $r;
if($r != null) {
$r->setParent($this);
}
}
function setLeft($l) {
$this->left = $l;
if($l != null) {
$l->setParent($this);
}
}
function setNode($n) {
$this->node = $n;
}
}
?>

View file

@ -0,0 +1,260 @@
<?php
/*
* The Achievement class that holds one achievement. It is able to load one an the same task an treat is as both,
* open and done.
*/
class AchAchievement extends AchList {
#########################
# PHP 5.3 compatible
# InDev_trait replaces this in PHP 5.4
protected $dev;
function inDev() {
return ($this->dev == 1);
}
function getDev() {
return $this->dev;
}
function setInDev($tf) {
if($tf == true) {
$this->setDev(1);
}
else {
$this->setDev(0);
}
$this->update();
}
function setDev($d) {
$this->dev = $d;
}
#########################
protected $parent_id;
protected $category;
#protected $tie_race;
#protected $tie_civ;
#protected $tie_cult;
protected $image;
protected $name;
protected $template;
protected $sticky;
function AchAchievement($data,$parent) {
global $DBc,$_USER,$_CONF;
parent::__construct();
$this->setParent($parent); // real parent node
$this->setID($data['aa_id']);
$this->parent_id = $data['aa_parent']; // id of parent
$this->category = $data['aa_category'];
#$this->tie_race = $data['aa_tie_race'];
#$this->tie_civ = $data['aa_tie_civ'];
#$this->tie_cult = $data['aa_tie_cult'];
$this->image = $data['aa_image'];
$this->name = $data['aal_name'];
$this->template = $data['aal_template'];
$this->dev = $data['aa_dev'];
$this->sticky = $data['aa_sticky'];
if($this->name == null) {
$res = $DBc->sqlQuery("SELECT * FROM ach_achievement_lang WHERE aal_lang='".$_CONF['default_lang']."' AND aal_achievement='".$this->id."'");
$this->name = $res[0]['aal_name'];
$this->template = $res[0]['aal_template'];
}
$res = $DBc->sqlQuery("SELECT * FROM ach_task LEFT JOIN (ach_task_lang) ON (atl_lang='".$_USER->getLang()."' AND atl_task=at_id) LEFT JOIN (ach_player_task) ON (apt_task=at_id AND apt_player='".$_USER->getID()."') WHERE at_achievement='".$this->id."' ORDER by at_torder ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$tmp = $this->makeChild($res[$i]);
if($tmp->isDone()) {
$this->addDone($tmp);
}
else {
$this->addOpen($tmp);
}
}
$iter = $this->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
$curr->loadHeritage();
}
}
function parentDone() { // check if the parent is complete
if($this->parent_id == null) {
return true;
}
else {
$p = $this->parent->getChildDataByID($this->parent_id);
if($p == null) {
return true;
}
return ($p->hasOpen() == false);
}
}
#@override Parentum::makeChild()
protected function makeChild($a) {
return new AchTask($a,$this);
}
function getParentID() {
return $this->parent_id;
}
function getTieRace() {
#return $this->tie_race;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->hasTieRace()) {
return true;
}
}
return false;
}
function getTieCiv() {
#return $this->tie_civ;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->hasTieCiv()) {
return true;
}
}
return false;
}
function getTieCult() {
#return $this->tie_cult;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->hasTieCult()) {
return true;
}
}
return false;
}
function isTiedRace($r) {
#return $this->tie_race;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->isTiedRace($r)) {
return true;
}
}
return false;
}
function isTiedCiv($c) {
#return $this->tie_civ;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->isTiedCiv($c)) {
return true;
}
}
return false;
}
function isTiedCult($c) {
#return $this->tie_cult;
$iter = $this->nodes->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->isTiedCult($c)) {
return true;
}
}
return false;
}
function getImage() {
return $this->image;
}
function getName() {
return $this->name;
}
function getValueDone() { // calculate the yubopoints that are already done
$val = 0;
$iter = $this->getDone();
while($iter->hasNext()) {
$curr = $iter->getNext();
$val += $curr->getValue();
}
return $val;
}
function getValueOpen() { // get the yubopoints of the next open task
$iter = $this->getOpen();
if($iter->hasNext()) {
$curr = $iter->getNext();
return $curr->getValue();
}
return 0;
}
function fillTemplate($insert = array()) { // fill the naming template with given value
if($this->template == null) {
return implode(";",$insert);
}
else {
$tmp = $this->template;
$match = array();
preg_match_all('#\[([0-9]+)\]#', $this->template, $match);
foreach($match[0] as $key=>$elem) {
$tmp = str_replace("[".$match[1][$key]."]",$insert[$key],$tmp);
}
return $tmp;
}
}
function getTemplate() {
return $this->template;
}
function getCategory() {
return $this->category;
}
function getSticky() {
return $this->sticky;
}
function isSticky() {
return ($this->sticky == 1);
}
function isHeroic() { // check parent category if it is heroic
return $this->parent->isHeroic();
}
function isContest() {
return $this->parent->isContest();
}
}
?>

View file

@ -0,0 +1,165 @@
<?php
/*
* Category class that is loading all achievements tied to it.
*/
class AchCategory extends AchList implements Tieable {
protected $ties_cult;
protected $ties_civ;
protected $ties_race;
protected $ties_race_dev;
protected $ties_cult_dev;
protected $ties_civ_dev;
protected $cult;
protected $civ;
protected $race;
protected $heroic;
protected $contest;
function AchCategory($id,$race = null,$cult = null,$civ = null) {
global $DBc,$_USER;
parent::__construct();
$civ = $DBc->sqlEscape($civ);
$cult = $DBc->sqlEscape($cult);
$race = $DBc->sqlEscape($race);
if($race == null) {
$race = $_USER->getRace();
}
if($cult == null) {
$cult = $_USER->getCult();
}
if($civ == null) {
$civ = $_USER->getCiv();
}
$this->cult = $cult;
$this->civ = $civ;
$this->id = $DBc->sqlEscape($id);
$res = $DBc->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' ORDER by aa_sticky DESC, aal_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$tmp = $this->makeChild($res[$i]);
if($tmp->hasOpen()) {
$this->addOpen($tmp); #AchList::addOpen()
}
if($tmp->hasDone()) {
$this->addDone($tmp); #AchList::addDone()
}
}
$res = $DBc->sqlQuery("SELECT ac_heroic,ac_contest FROM ach_category WHERE ac_id='".$this->id."'");
$this->heroic = $res[0]['ac_heroic'];
$this->contest = $res[0]['ac_contest'];
//load counts for tie determination
/*$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
$this->ties_cult = $res[0]['anz'];
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
$this->ties_civ = $res[0]['anz'];
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'");
$this->ties_race = $res[0]['anz'];
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_race IS NOT NULL AND aa_category='".$this->id."'");
$this->ties_race_dev = $res[0]['anz'];
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."'");
$this->ties_cult_dev = $res[0]['anz'];
$res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_civ IS NOT NULL AND aa_category='".$this->id."'");
$this->ties_civ_dev = $res[0]['anz'];*/
$iter = $this->nodes->getIterator();
$tmp = false;
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->getTieRace()) {
$tmp = true;
break;
}
}
$this->ties_race = $tmp;
$iter = $this->nodes->getIterator();
$tmp = false;
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->getTieCiv()) {
$tmp = true;
break;
}
}
$this->ties_civ = $tmp;
$iter = $this->nodes->getIterator();
$tmp = false;
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->getTieCult()) {
$tmp = true;
break;
}
}
$this->ties_cult = $tmp;
}
#@override Parentum::makeChild()
protected function makeChild($a) {
return new AchAchievement($a,$this);
}
function isTiedRace() {
return ($this->ties_race > 0);
}
function isTiedCult() {
return ($this->ties_cult > 0);
}
function isTiedCiv() {
return ($this->ties_civ > 0);
}
function isTiedRaceDev() {
return ($this->ties_race_dev > 0);
}
function isTiedCultDev() {
return ($this->ties_cult_dev > 0);
}
function isTiedCivDev() {
return ($this->ties_civ_dev > 0);
}
function getCurrentCiv() {
return $this->civ;
}
function getCurrentCult() {
return $this->cult;
}
function getCurrentRace() {
return $this->race;
}
function isHeroic() {
return ($this->heroic == 1);
}
function isContest() {
return ($this->contest == 1);
}
}
?>

View file

@ -0,0 +1,81 @@
<?php
abstract class AchList extends Parentum {
/*---------------------------
This class organizes nodes to distinguish between "open" and "done" nodes.
child_open and child_done refer to Parentum::nodes
---------------------------*/
protected $child_done;
protected $child_open;
function AchList() {
parent::__construct();
$this->child_done = new DLL();
$this->child_open = new DLL();
}
final function getDone() {
return $this->child_done->getIterator();
}
final function getOpen() {
return $this->child_open->getIterator();
}
final function hasOpen() {
return ($this->child_open->getSize() != 0);
}
final function hasDone() {
return ($this->child_done->getSize() != 0);
}
final function addOpen($data,$b = null) {
$this->child_open->addNode($data,$b);
$this->addChild($data,$b); #Parentum::addChild()
}
final function addDone($data,$b = null) {
$this->child_done->addNode($data,$b);
$this->addChild($data,$b); #Parentum::addChild()
}
final function setChildDone($id) {
$this->addChildDone($id);
$this->removeChildOpen($id);
}
final function setChildOpen($id) {
$this->addChildOpen($id);
$this->removeChildDone($id);
}
final function addChildDone($id) {
$data = $this->getChildDataByID($id);
$this->child_done->addNode($data);
}
final function addChildOpen($id) {
$data = $this->getChildDataByID($id);
$this->child_open->addNode($data);
}
final function removeChildDone($id) {
$this->child_done->removeNode($id);
}
final function removeChildOpen($id) {
$this->child_open->removeNode($id);
}
#@OVERRIDE Parentum::removeChild()
function removeChild($id) {
parent::removeChild($id);
$this->child_open->removeNode($id);
$this->child_done->removeNode($id);
}
}
?>

View file

@ -0,0 +1,107 @@
<?php
class AchMenuNode extends Parentum {
#########################
# PHP 5.3 compatible
# InDev_trait replaces this in PHP 5.4
protected $dev;
function inDev() {
return ($this->dev == 1);
}
function getDev() {
return $this->dev;
}
function setInDev($tf) {
if($tf == true) {
$this->setDev(1);
}
else {
$this->setDev(0);
}
$this->update();
}
function setDev($d) {
$this->dev = $d;
}
#########################
protected $parent_id;
protected $name;
protected $open;
protected $image;
protected $order;
function AchMenuNode($data,$parent) {
global $DBc,$_USER,$_CONF;
parent::__construct();
$this->setParent($parent);
$this->setID($data['ac_id']);
$this->parent_id = $data['ac_parent'];
$this->name = $data['acl_name'];
$this->image = $data['ac_image'];
$this->order = $data['ac_order'];
$this->open = ($this->id == $data['open']);
$this->dev = $data['ac_dev'];
if($this->name == null) {
$res = $DBc->sqlQuery("SELECT * FROM ach_category_lang WHERE acl_lang='".$_CONF['default_lang']."' AND acl_category='".$this->id."'");
$this->name = $res[0]['acl_name'];
}
$res = $DBc->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$_USER->getLang()."' AND acl_category=ac_id) WHERE ac_parent='".$this->id."' ORDER by ac_order ASC, acl_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$res[$i]['open'] = $data['open'];
$this->addChild($this->makeChild($res[$i]));
}
}
#@override Parentum::makeChild()
protected function makeChild($a) {
return new AchMenuNode($a,$this);
}
function getName() {
return $this->name;
}
function getParentID() {
return $this->parent_id;
}
function hasOpenCat() { // finds the currently open MenuNode and returns it's ID. If not found the result will be 0 instead.
if($this->open) {
return $this->id;
}
$iter = $this->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
$res = $curr->hasOpenCat();
if($res != 0) {
return $res;
}
}
return 0;
}
function isOpen() {
return $this->open;
}
function getImage() {
return $this->image;
}
function getOrder() {
return $this->order;
}
}
?>

View file

@ -0,0 +1,58 @@
<?php
class AchMenu extends Parentum {
/*---------------------------
This class is the dispatcher for actual MenuNodes.
Since every MenuNode will only keep a list of it's children,
we have to handle the main nodes which have no parent this way.
---------------------------*/
protected $open;
function AchMenu($open = false) {
global $DBc,$_USER;
parent::__construct();
$this->open = $open;
// the summary page is autogenerated and has no database entry. We add it manually here.
$tmp = array();
$tmp['ac_id'] = 0;
$tmp['ac_parent'] = null;
$tmp['acl_name'] = get_translation('ach_summary',$_USER->getLang());
$tmp['ac_image'] = "summary.png";
$tmp['ac_order'] = -1;
$tmp['open'] = $open;
$this->addChild(new AchMenuNode($tmp,$this));
$res = $DBc->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$_USER->getLang()."' AND acl_category=ac_id) WHERE ac_parent IS NULL ORDER by ac_order ASC, acl_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$res[$i]['open'] = $open;
$this->addChild($this->makeChild($res[$i]));
}
}
function getOpen() { // just returns the previously set ID of the currently open MenuNode
return $this->open;
}
function getOpenCat() { // finds the currently open MenuNode and returns it's ID. If not found the result will be 0 instead.
$iter = $this->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
$res = $curr->hasOpenCat();
if($res != 0) {
return $res;
}
}
return 0;
}
#@override Parentum::makeChild()
protected function makeChild($a) {
return new AchMenuNode($a,$this);
}
}
?>

View file

@ -0,0 +1,104 @@
<?php
class AchObjective extends Parentum {
protected $task;
protected $condition;
protected $value;
protected $name;
protected $display;
protected $done;
protected $progress;
protected $meta_image;
protected $metalink;
function AchObjective($data,$parent) {
global $DBc,$_USER,$_CONF;
parent::__construct();
$this->setParent($parent);
$this->setID($data['ao_id']);
$this->task = $data['ao_task'];
$this->condition = $data['ao_condition'];
$this->value = $data['ao_value'];
$this->name = $data['aol_name'];
$this->display = $data['ao_display'];
$this->done = $data['apo_date'];
$this->meta_image = $data['aa_image'];
$this->metalink = $data['ao_metalink'];
if($this->metalink != null) {
$this->name = $data['aal_name'];
if($this->name == null) {
$res = $DBc->sqlQuery("SELECT * FROM ach_achievement_lang WHERE aal_lang='".$_CONF['default_lang']."' AND aal_achievement='".$this->metalink."'");
$this->name = $res[0]['aal_name'];
}
}
else {
if($this->name == null) {
$res = $DBc->sqlQuery("SELECT * FROM ach_objective_lang WHERE aol_lang='en' AND aol_objective='".$this->id."'");
$this->name = $res[0]['aol_name'];
}
}
$this->progress = $this->value;
if(!$this->isDone()) {
$res = $DBc->sqlQuery("SELECT sum(apa_value) as anz FROM ach_player_atom,ach_atom WHERE apa_atom=atom_id AND atom_objective='".$this->id."' AND apa_player='".$_USER->getID()."'");
$this->progress = $res[0]['anz'];
}
}
#@override: Parentum::makeChild()
protected function makeChild($a) {
return null;
}
function getMetaImage() {
return $this->meta_image;
}
function getMetalink() {
return $this->metalink;
}
function getTask() {
return $this->task;
}
function getCondition() {
return $this->condition;
}
function getValue() {
return $this->value;
}
function getProgress() {
return $this->progress;
}
function getName() {
return $this->name;
}
function getDisplayName() {
if(substr($this->name,0,1) == "!") {
return substr($this->name,1);
}
return $this->parent->fillTemplate(explode(";",$this->name));
}
function getDisplay() {
return $this->display;
}
function isDone() {
return ($this->done > 0);
}
function getDone() {
return $this->done;
}
}
?>

View file

@ -0,0 +1,118 @@
<?php
class AchSummary extends AchList implements Tieable {
private $menu;
private $stats;
function AchSummary(&$menu,$size = 10) {
global $DBc,$_USER;
parent::__construct();
$this->menu = $menu;
#die("x:".$size);
//read all recent tasks of user
//make distinct achievement list
$res = $DBc->sqlQuery("SELECT DISTINCT aa_id,ach.*,(SELECT aal_name FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_name, (SELECT aal_template FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_template FROM ach_achievement as ach,ach_task,ach_player_task WHERE at_achievement=aa_id AND apt_player='".$_USER->getID()."' AND apt_task=at_id ORDER by apt_date DESC LIMIT 0,".$size);
#echo var_export($res,true);
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->addDone($this->makeChild($res[$i]));
}
}
#@override: Parentum::makeChild()
protected function makeChild($a) {
return new AchAchievement($a,$this);
}
function getSummary() {
if(!is_array($this->stats)) { // only load if needed
//now we have to find the # of tasks for each main menu entry
//and also sum up how many have been completed
$this->stats = array(); // [][name,done,total]
$iter = $this->menu->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->getID() == 0 || $curr->inDev()) {
continue; // skip summary page
}
$res = $this->sumStats($curr);
$this->stats[] = array($curr->getName(),$res[0],$res[1],$res[2]);
}
}
return $this->stats;
}
private function sumStats(&$node) {
global $DBc,$_USER;
#return array(0,0);
#echo ">".gettype($node)."<";
$done = 0;
$total = 0;
$hero = false;
//read for current ID
//sum
$res = $DBc->sqlQuery("SELECT count(at_id) as anz FROM ach_task,ach_achievement,ach_player_task WHERE aa_category='".$node->getID()."' AND at_achievement=aa_id AND apt_player='".$_USER->getID()."' AND apt_task=at_id");
$done += $res[0]["anz"];
$res = $DBc->sqlQuery("SELECT count(at_id) as anz FROM ach_task,ach_achievement WHERE aa_category='".$node->getID()."' AND at_achievement=aa_id AND aa_dev='0' AND at_dev='0'");
$total += $res[0]["anz"];
$res = $DBc->sqlQuery("SELECT ac_heroic FROM ach_category WHERE ac_id='".$node->getID()."' AND ac_dev='0'");
if($res[0]["ac_heroic"] == 1) {
$hero = true;
}
$iter = $node->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
$res = $this->sumStats($curr);
$done += $res[0];
$total += $res[1];
$hero = ($hero == true || $res[2] == true);
}
return array($done,$total,$hero);
}
function isTiedCult() {
return false;
}
function isTiedCiv() {
return false;
}
function getCurrentCiv() {
return "c_neutral";
}
function getCurrentCult() {
return "c_neutral";
}
function isHeroic() {
return false;
}
function isContest() {
return false;
}
}
?>

View file

@ -0,0 +1,238 @@
<?php
class AchTask extends Parentum {
#########################
# PHP 5.3 compatible
# InDev_trait replaces this in PHP 5.4
protected $dev;
function inDev() {
return ($this->dev == 1);
}
function getDev() {
return $this->dev;
}
function setInDev($tf) {
if($tf == true) {
$this->setDev(1);
}
else {
$this->setDev(0);
}
$this->update();
}
function setDev($d) {
$this->dev = $d;
}
#########################
protected $achievement;
protected $value;
protected $name;
protected $done;
protected $template;
protected $parent_id;
protected $inherit_obj;
private $heritage_list;
protected $tie_race;
protected $tie_cult;
protected $tie_civ;
function AchTask($data,$parent) {
global $DBc,$_USER,$_CONF;
parent::__construct();
#$this->heritage_list = array();
$this->setParent($parent);
$this->setID($data['at_id']);
$this->achievement = $data['at_achievement'];
$this->value = $data['at_value'];
$this->name = $data['atl_name'];
$this->done = $data['apt_date'];
$this->dev = $data['at_dev'];
$this->template = $data['atl_template'];
$this->parent_id = $data['at_parent'];
$this->inherit_obj = $data['at_inherit'];
if($this->inherit_obj == 1) {
$this->heritage_list = new AVLTree();
}
else {
$this->heritage_list = null;
}
if($this->name == null) {
$res = $DBc->sqlQuery("SELECT * FROM ach_task_lang WHERE atl_lang='".$_CONF['default_lang']."' AND atl_task='".$this->id."'");
$this->name = $res[0]['atl_name'];
$this->template = $res[0]['atl_template'];
}
$res = $DBc->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$_USER->getLang()."' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player='".$_USER->getID()."') LEFT JOIN (ach_achievement,ach_achievement_lang) ON (aa_id=ao_metalink AND aa_id=aal_achievement AND aal_lang='".$_USER->getLang()."') WHERE ao_task='".$this->id."' ORDER by aol_name ASC,aal_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->addChild($this->makeChild($res[$i]));
}
//load ties
$res = $DBc->sqlQuery("SELECT attr_race FROM ach_task_tie_race WHERE attr_task='".$this->id."'");
$sz = sizeof($res);
$this->tie_race = array();
for($i=0;$i<$sz;$i++) {
$this->tie_race[] = $res[$i]['attr_race'];
}
$res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'");
$sz = sizeof($res);
$this->tie_cult = array();
for($i=0;$i<$sz;$i++) {
$this->tie_cult[] = $res[$i]['attcult_cult'];
}
$res = $DBc->sqlQuery("SELECT attciv_civ FROM ach_task_tie_civ WHERE attciv_task='".$this->id."'");
$sz = sizeof($res);
$this->tie_civ = array();
for($i=0;$i<$sz;$i++) {
$this->tie_civ[] = $res[$i]['attciv_civ'];
}
}
function loadHeritage() {
if($this->inherit_obj == 0) {
return false;
}
$child = $this->parent->getChildDataByID($this->parent_id);
if($child == null) {
return false;
}
$iter = $child->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
$this->addChild($curr);
$this->heritage_list->insert($curr);
}
}
#@override Parentum::makeChild()
protected function makeChild($a) {
return new AchObjective($a,$this);
}
function getHeritage() {
return $this->inherit_obj;
}
function isInherited($id) {
if($this->getHeritage() == 0) {
return false;
}
if($this->heritage_list == null) {
return false;
}
return ($this->heritage_list->find($id) != null);
}
function hasTieRace() {
return (sizeof($this->tie_race) != 0);
}
function hasTieCult() {
return (sizeof($this->tie_cult) != 0);
}
function hasTieCiv() {
return (sizeof($this->tie_civ) != 0);
}
function isTiedRace($r) {
if(sizeof($this->tie_race) == 0) {
return true;
}
return in_array($r,$this->race);
}
function isTiedCult($c) {
if(sizeof($this->tie_cult) == 0) {
return true;
}
return in_array($c,$this->tie_cult);
}
function isTiedCiv($c) {
if(sizeof($this->tie_civ) == 0) {
return true;
}
return in_array($c,$this->tie_civ);
}
function getAchievement() {
return $this->achievement;
}
function getValue() {
return $this->value;
}
function getDisplayName() {
if(substr($this->name,0,1) == "!") {
return substr($this->name,1);
}
return $this->parent->fillTemplate(explode(";",$this->name));
}
function getName() {
return $this->name;
}
function objDrawable() {
$iter = $this->getIterator();
while($iter->hasNext()) {
$curr = $iter->getNext();
if($curr->getDisplay() != "hidden") {
return true;
}
}
return false;
}
function isDone() {
return ($this->done > 0);
}
function getDone() {
return $this->done;
}
function fillTemplate($insert = array()) {
if($this->template == null) {
return implode(";",$insert);
}
else {
$tmp = $this->template;
$match = array();
preg_match_all('#\[([0-9]+)\]#', $this->template, $match);
foreach($match[0] as $key=>$elem) {
$tmp = str_replace("[".$match[1][$key]."]",$insert[$key],$tmp);
}
return $tmp;
}
}
function getTemplate() {
return $this->template;
}
function getParentID() {
return $this->parent_id;
}
}
?>

View file

@ -0,0 +1,167 @@
<?php
/*
* Doubly Linked List
*
* This list is linked to an avl tree for searching purpose!
*/
class DLL {
private $first;
private $last;
private $size;
private $avl;
function DLL() {
$this->avl = new AVLTree();
$this->first = null;
$this->last = null;
$this->size = 0;
}
function getIterator() {
return new NodeIterator($this->first);
}
final function getSize() {
return $this->size;
}
final function isEmpty() {
return ($this->size == 0);
}
function getFirst() {
return $this->first;
}
function getLast() {
return $this->last;
}
function addNode($data,$before = null) { // add a node
if($this->findNode($data->getID()) != null) {
return false;
}
$n = new DLLnode($data);
if($before == null) {
//insert as last
if($this->last != null) {
$this->last->setChild($n);
}
$n->setParent($this->last);
$this->last = $n;
}
else {
//insert before
$b = $this->findNode($before);
if($b != null) {
if($b == $this->first) {
$this->first = $n;
}
$tmp = $b->getParent();
$b->setParent($n);
$n->setChild($b);
if($tmp != null) {
$tmp->setChild($n);
}
}
else {
$this->addNode($data);
return null;
}
}
if($this->first == null) {
$this->first = $n;
}
$this->avl->insert($n); // pass on to avl tree
$this->size++;
return null;
}
function removeNode($id) { // remove a node
#$this->avl->inorder();
$n = $this->findNode($id);
if($n != null) {
$p = $n->getParent();
$c = $n->getChild();
if($c != null) {
$c->setParent($p);
if($p != null) {
$p->setChild($c);
}
}
else {
if($p != null) {
$p->setChild(null);
}
$this->last = $p;
}
if($p == null) {
if($c != null) {
$c->setParent(null);
$this->first = $c;
}
else {
$this->first = null;
}
}
$this->avl->remove($id); // pass on to avl tree
$this->size--;
}
}
function findNode($id) {
return $this->avl->find($id);
}
}
/*
* List nodes
*/
class DLLnode {
private $parent;
private $child;
public $data;
function DLLNode($d) {
$this->parent = null;
$this->child = null;
$this->data = $d; // actual data
}
final function getParent() {
return $this->parent;
}
final function setParent($p) {
$this->parent = $p;
}
final function getChild() {
return $this->child;
}
final function setChild($c) {
$this->child = $c;
}
final function getIterator() {
return new NodeIterator($this);
}
function getID() {
return $this->data->getID();
}
}
?>

View file

@ -0,0 +1,33 @@
<?php
trait InDev {
/*---------------------------
This trait provides basic functionality used to
handle "in development" flags.
---------------------------*/
protected $dev;
final function inDev() {
return ($this->dev == 1);
}
final function getDev() {
return $this->dev;
}
final function setInDev($tf) {
if($tf == true) {
$this->setDev(1);
}
else {
$this->setDev(0);
}
$this->update();
}
final function setDev($d) {
$this->dev = $d;
}
}
?>

View file

@ -0,0 +1,33 @@
<?php
class NodeIterator {
/*---------------------------
The NodeIterator can be used to iterate linked lists.
Sample:
$iter = new NodeIterator(array());
while($iter->hasNext()) {
$curr = $iter->getNext();
// ...
}
---------------------------*/
private $node;
function NodeIterator($node) {
$this->node = $node;
}
function hasNext() {
if($this->node == null) {
return false;
}
return true;
}
function getNext() {
$n = $this->node;
$this->node = $this->node->getChild();
return $n->data;
}
}
?>

View file

@ -0,0 +1,32 @@
<?php
abstract class Node {
/*---------------------------
This class provides basic functionality common to nodes.
Every node has an id and a parent.
---------------------------*/
protected $id;
protected $parent;
function Node() {
// dummy constructor
}
final function getID() {
return $this->id;
}
final function getParent() {
return $this->parent;
}
final function setID($id) {
$this->id = $id;
}
final function setParent($p) {
$this->parent = $p;
}
}
?>

View file

@ -0,0 +1,49 @@
<?php
abstract class Parentum extends Node {
/*---------------------------
This class allows external access to the child-node list.
Use the NodeIterator to iterate through the list since
the numeric array keys might have gaps due to node removals!
Once init() has been called, an AVLTree is used to support the
functions removeChild() and findChild(). init() must be called
before adding any nodes!
---------------------------*/
protected $nodes;
function Parentum() {
parent::__construct();
$this->nodes = new DLL(); // Doubly Linked List
}
abstract protected function makeChild($args); // overwriteable child generator; allows to define child type (eg.: admin classes that inherit from base class)
function isEmpty() {
return $this->nodes->isEmpty();
}
function addChild($data,$b = null) {
$this->nodes->addNode($data,$b);
}
function removeChild($id) {
$this->nodes->removeNode($id);
}
function getChildByID($id) { // returns a DLL node
return $this->nodes->findNode($id);
}
function getChildDataByID($id) { // returns the actual content of the found DLL node
$tmp = $this->getChildByID($id);
if($tmp != null) {
return $tmp->data;
}
return null;
}
function getIterator() {
return $this->nodes->getIterator();
}
}
?>

View file

@ -0,0 +1,41 @@
<?php
class RyzomUser {
private $data;
function RyzomUser($data) {
$this->data = $data;
}
function getID() {
return $this->data["id"];
}
function getLang() {
return $this->data['lang'];
}
function isIG() {
return $this->data['ig'];
}
function getParam($p) {
return $this->data[$p];
}
function getRace() {
return $this->data['race'];
}
function getCiv() {
return $this->data['civilization'];
}
function getCult() {
return $this->data['cult'];
}
function getName() {
return $this->data['char_name'];
}
}
?>

View file

@ -0,0 +1,17 @@
<?php
interface Tieable {
/*---------------------------
The Tieable interface is needed to define methods required
by Parentum classes that have child nodes that vary depending
on a user's cult of civ allegiance.
---------------------------*/
function isTiedCult();
function isTiedCiv();
function getCurrentCiv();
function getCurrentCult();
}
?>

View file

@ -0,0 +1,18 @@
<?php
if(!defined('APP_NAME')) {
die(-1);
}
$_CONF = array();
$_CONF['summary_size'] = 3;
$_CONF['default_lang'] = 'en';
$_CONF['enable_webig'] = true;
$_CONF['enable_offgame'] = true;
$_CONF['image_url'] = "http://www.3025-game.de/special/app_achievements/";
$_CONF['image_cdate'] = 0; // timestamp to bybass image cache ingame
$_CONF['use_fb'] = false;
$_CONF['fb_id'] = "447985781893176";
$_CONF['fb_secret'] = "f953772f1f7d871db022a6023e7a3f42";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

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