diff --git a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php
index 0d02dcc70..3394635f3 100644
--- a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php
+++ b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php
@@ -9,39 +9,34 @@
require_once("class/mySQL_class.php");
require_once("conf.php");
require_once("include/functions_inc.php");
+ require_once("class/Entity_abstract.php");
- $_REQUEST['file'] = $argv[1];
+ if(!$_REQUEST['file']) {
+ $_REQUEST['file'] = $argv[1];
+ }
-
- /*$logfile = false;
+ $log = new Logfile();
if($CONF['logging'] == true) {
require_once("class/Logfile_class.php");
- #$logfile = fopen($CONF['logfile'].'.'.date("Ymd",time()).'.txt','a');
- $logfile = new Logfile($CONF['logfile']);#!! MUST HAVE ONE LOGFILE PER RUN!!
- }*/
+ $log = new Logfile($CONF['logfile']);
+ }
- //set mode: cron || single with given cid
- #MISSING: conf to allow external calls; whitelist ips
- /*$MODE = "CRON";
- if($_REQUEST["cid"] > 0 || $_REQUEST["invoke"] == "TRUE") {
- if($_REQUEST["cid"] > 0 && $_REQUEST["invoke"] == "TRUE") {
- $MODE = "SINGLE";
- $CID = $DBc->mre($_REQUEST["cid"]);
- }
- else {
- $e = "Failed to start SINGLE mode; cid=".$_REQUEST["cid"];
- logf($e);
- die($e);
- }
- }*/
+ $log->logf("File: '".$_REQUEST['file']."'");
+
+ $log->logf("Starting up... ",false);
+
+ if(!$_REQUEST['file']) {
+ $log->logf("ERROR: no file given! EXITING!");
+ die();
+ }
//create database connection
$DBc = new mySQL($CONF['mysql_error']);
$DBc->connect($CONF['mysql_server'],$CONF['mysql_user'],$CONF['mysql_pass'],$CONF['mysql_database']);
- #if($MODE == "CRON") {
- # $RID = $DBc->sendSQL("INSERT INTO ach_monitor_state (ams_start,ams_end) VALUES ('".time()."','0')","INSERT"); // insert run into monitoring table
- #}
+ $DBc_char = new mySQL($_CONF['mysql_error']);
+ $DBc_char->connect($CONF['char_mysql_server'],$CONF['char_mysql_user'],$CONF['char_mysql_pass'],$CONF['char_mysql_database']);
+
require_once("class/DataDispatcher_class.php");
require_once("class/DataSourceHandler_class.php");
@@ -50,11 +45,8 @@
require_once("class/ValueCache_class.php");
require_once("class/Atom_class.php");
- #MISSING: static ValueCache!
-
$_CACHE = new ValueCache();
-
//create datasource handler
$_DISPATCHER = new DataDispatcher();
$_DATASOURCE = new DataSourceHandler();
@@ -64,87 +56,98 @@
$_DATASOURCE->addSource($tmp);
}
- // fetch candidates
- /*if($MODE == "SINGLE") {
- $chars = array();
- $chars[] = array('amc_character',$CID);
- }
- else {
- #$chars = array();
-
- $DBc->sendSQL("UPDATE ach_monitor_character SET amc_working='0' WHERE amc_last_import<'".(time()-60*60)."'"); // unlock if something went wrong
-
- $DBc->sendSQL("UPDATE ach_monitor_character SET amc_working='".$RID."' WHERE amc_last_login>amc_last_import AND amc_working='0'","NONE");
-
- $chars = $DBc->sendSQL("SELECT amc_character FROM ach_monitor_character WHERE amc_working='".$RID."'","ARRAY");
- }*/
+ #REPLACE WITH REGEX!!!
$tmp = explode("/",$_REQUEST['file']);
$tmp2 = explode("_",$tmp[(sizeof($tmp)-1)]);
$chars = array(($tmp2[1]*16+$tmp2[2]));
+
+ $log->logf(" done!");
foreach($chars as $cid) {
#STEP 1: load and register atoms
+ $log->logf("Processing char '".$cid."' ...");
+
+ $log->logi("Loading and registering Atoms... ",false);
+
$atom_list = array();
$res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$cid."' AND app_perk=ap_id)","ARRAY");
foreach($res as $perk) {
//get unfinished atoms belonging to unfinished objectives
- $res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective WHERE ao_perk='".$perk['ap_id']."' AND ao_id=atom_objective AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cid."' AND apo_objective=ao_id)","ARRAY");
+ $res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective,ach_achievement WHERE ao_perk='".$perk['ap_id']."' AND ao_id=atom_objective AND ap_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cid."' AND apo_objective=ao_id) AND (aa_tie_race IS NULL OR aa_tie_race='') AND (aa_tie_cult IS NULL OR aa_tie_cult='') AND (aa_tie_civ IS NULL OR aa_tie_civ='')","ARRAY");
foreach($res2 as $atom) {
$a = new Atom($atom,$cid);
$atom_list[] = $a;
$a->register();
}
}
+
+ $log->logf("done!");
+
+ $log->logi("Driving data... ",false);
#STEP 2: drive data
$_CACHE->setChar($cid);
$_DATASOURCE->drive($cid);
+ $log->logf("done!");
+
#STEP 3: detect obj/perk 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='".$cid."') AND NOT 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='".$cid."'))","ARRAY");
+ $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='".$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='".$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']."','".$cid."','".time()."')","NONE");
}
- $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='".$cid."') AND ao_value<=(SELECT count(*) 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='".$cid."'))","ARRAY");
+ $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='".$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='".$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']."','".$cid."','".time()."')","NONE");
}
- $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='".$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='".$cid."'))","ARRAY");
+ $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='".$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='".$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']."','".$cid."','".time()."')","NONE");
}
+ $log->logf("done!");
+ $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='".$cid."' AND atom_objective=ao_id)");
+
+ $log->logf("done!");
+
//perk
- $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."'))","ARRAY");
+ $log->logi("Detecting Perks... ",false);
+ $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE");
}
- $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND ap_value<=(SELECT count(*) FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."'))","ARRAY");
+ $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND ap_value<=(SELECT count(*) FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE");
}
- $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."'))","ARRAY");
+ $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE");
}
+
+ $log->logf("done!");
}
-
-
+ $log->logf("Run complete; exiting...");
+ exit(0);
?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php
index 700475e45..9e9bc30ab 100644
--- a/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php
+++ b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php
@@ -17,7 +17,7 @@
function register() {
global $DBc,$_DATA;
- echo "register
";
+ #echo "register
";
try {
return eval($this->ruleset);
@@ -40,18 +40,29 @@
$_DISPATCHER->unregisterValue($name,$callback);
}
- function grant() {
+ function registerEntity($name,$func) {
+ global $_DISPATCHER;
+
+ $tmp = new Callback($this,$func);
+ $_DISPATCHER->registerEntity($name,$tmp);
+ }
+
+ function unregisterEntity($name,$callback) {
+ global $_DISPATCHER;
+
+ $_DISPATCHER->unregisterEntity($name,$callback);
+ }
+
+ function grant($count = 1) {
global $DBc;
- echo "G
";
-
- $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$this->user."','".time()."',null,'GRANT')","NONE");
+ $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state,apa_value) VALUES ('".$this->id."','".$this->user."','".time()."',null,'GRANT','".$count."')","NONE");
}
function deny() {
global $DBc;
- $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$this->user."','".time()."',null,'DENY')","NONE");
+ $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$this->user."','".time()."',null,'DENY','1')","NONE");
}
function reset_() {
diff --git a/code/web/app/app_achievements/_AchWebParser/class/DataDispatcher_class.php b/code/web/app/app_achievements/_AchWebParser/class/DataDispatcher_class.php
index b20239821..2ee25d979 100644
--- a/code/web/app/app_achievements/_AchWebParser/class/DataDispatcher_class.php
+++ b/code/web/app/app_achievements/_AchWebParser/class/DataDispatcher_class.php
@@ -53,7 +53,6 @@
}
function dispatchValue($key,$val) {
- echo "dispatching: $key=>$val
";
if(is_array($this->value[$key])) {
foreach($this->value[$key] as $callback) {
$callback->call($val);
diff --git a/code/web/app/app_achievements/_AchWebParser/class/Entity_abstract.php b/code/web/app/app_achievements/_AchWebParser/class/Entity_abstract.php
new file mode 100644
index 000000000..e7322444a
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/class/Entity_abstract.php
@@ -0,0 +1,13 @@
+name;
+ }
+
+ function setName($n) {
+ $this->name = $n;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php b/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php
index 58254ff3c..aab4cb01c 100644
--- a/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php
+++ b/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php
@@ -3,20 +3,34 @@
private $logfile;
private $buffer;
- function Logfile($f) {
- $this->logfile = $f;
- $this->buffer = "";
+ function Logfile($f = false) {
+ $this->logfile = false;
+
+ if($f != false) {
+ $this->logfile = fopen($this->logfile.'.'.$_REQUEST['file'].'.'.date("Ymd",time()).'.txt','a');;
+ }
}
- function append($t) {
- $this->buffer .= $t;
+ function logf($t,$nl = true) {
+ $this->write($t);
+ if($nl == true) {
+ $this->write("\n");
+ }
}
- function write() {
- $f = fopen($this->logfile.'.'.date("Ymd",time()).'.txt','a');
- fwrite($f,$this->buffer);
- fclose($f);
- $this->buffer = "";
+ function logi($t,$nl = true) {
+ $this->write(" > ".$t);
+ if($nl == true) {
+ $this->write("\n");
+ }
+ }
+
+ function write($txt) {
+ fwrite($this->logfile,$txt);
+ }
+
+ function close() {
+ fclose($this->logfile);
}
}
?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php b/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php
index dba981254..5aca70da4 100644
--- a/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php
+++ b/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php
@@ -132,6 +132,8 @@
}
private function error($error,$query = false) {
+ global $log;
+
$this->DBstats['error']++;
if($query != false) {
@@ -149,7 +151,7 @@
echo "";
break;
case 'LOG':
- logf("MySQL ERROR: ".$error);
+ $log->logf("MySQL ERROR: ".$error);
break;
default:
flush();
diff --git a/code/web/app/app_achievements/_AchWebParser/conf.php b/code/web/app/app_achievements/_AchWebParser/conf.php
index 5cf0e27ff..dc5286fd1 100644
--- a/code/web/app/app_achievements/_AchWebParser/conf.php
+++ b/code/web/app/app_achievements/_AchWebParser/conf.php
@@ -1,31 +1,21 @@
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/script/in_region_script.php b/code/web/app/app_achievements/_AchWebParser/script/in_region_script.php
new file mode 100644
index 000000000..282670c79
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/script/in_region_script.php
@@ -0,0 +1,128 @@
+sendSQL("SELECT c_pos_x,c_pos_y FROM ryzom_character WHERE c_xmlid='".$xmlid."'","ARRAY");
+ #$points[] = floor($comp[0]['c_pos_x'])." ".floor($comp[0]['c_pos_y']);
+ $points[] = floor($pos->x/1000)." ".floor($pos->y/1000);
+
+ $pointLocation = new pointLocation();
+
+ foreach($points as $point) {
+ if($pointLocation->pointInPolygon($point, $region[$where], false) != "outside") {
+ return true;
+ }
+ }
+
+ echo "false";
+
+ return false;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php b/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php
new file mode 100644
index 000000000..491fa11bb
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php
@@ -0,0 +1,68 @@
+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;
+ }
+ }
+
+ }
+
+ function pointStringToCoordinates($pointString) {
+ $coordinates = explode(" ", $pointString);
+ return array("x" => $coordinates[0], "y" => $coordinates[1]);
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php
index 60241dca2..b48da1c0d 100644
--- a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php
@@ -1,9 +1,34 @@
lock = 0;
+ $this->open = null;
+ $this->entity = null;
+ $this->inv = null;
+ $this->iblock = false;
+ $this->gear = new Gear();
+ $this->skills = new SkillList();
+ $this->mission = new MissionList();
+
+ //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[] = "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";
@@ -45,7 +80,7 @@
}
function drive($cid) {
- global $CONF;
+ global $CONF,$_DISPATCHER;
echo "kk";
@@ -64,6 +99,10 @@
echo "error";
}
xml_parser_free($xml_parser);
+
+ $_DISPATCHER->dispatchEntity($this->gear->getName(),$this->gear);
+ $_DISPATCHER->dispatchEntity($this->skills->getName(),$this->skills);
+ $_DISPATCHER->dispatchEntity($this->skills->mission(),$this->mission);
}
function startElement($parser, $name, $attrs) {
@@ -81,17 +120,624 @@
$this->lock = 1;
return null;
}
+
+ /* 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;
+ }
+
+ /* 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"];
+ 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 Skills();
+ $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") {
+ $this->open = "_ITEM";
+ $this->entity = new Item();
+ $this->entity->inventory = $this->inv;
+ 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") {
+ $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"];
+ 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"] != "") {
- echo "dispatching";
$_DISPATCHER->dispatchValue(strtolower($name),$attrs["VALUE"]);
}
}
function endElement($parser, $name) {
+ global $_DISPATCHER;
+
if(in_array($name,$this->ignore_block)) {
$this->lock = 0;
}
+
+ /* 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") {
+ $_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
+ $this->entity = null;
+ return null;
+ }
+
+ /* items */
+ if($name == "_ITEMS") {
+ $_DISPATCHER->dispatchEntity($this->entity->getName(),$this->entity);
+ if($this->entity->refinventoryid != null) {
+ $this->gear->items[] = $this->entity;
+ }
+ $this->entity = null;
+ return null;
+ }
+
+ if($name == "INVENTORY") {
+ $this->iblock = false;
+ return null;
+ }
+
+ if($name == "_ITEM" || $name == "_ITEMS") {
+ $this->open = null;
+ return null;
+ }
+
+
}
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/FactionPoints_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/FactionPoints_entity.php
new file mode 100644
index 000000000..fa18a0fc6
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/FactionPoints_entity.php
@@ -0,0 +1,10 @@
+setName("faction_points");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Fame_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Fame_entity.php
new file mode 100644
index 000000000..0cfc5f15b
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Fame_entity.php
@@ -0,0 +1,12 @@
+setName("fame");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Gear_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Gear_entity.php
new file mode 100644
index 000000000..b84008061
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Gear_entity.php
@@ -0,0 +1,9 @@
+setName("gear");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Item_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Item_entity.php
new file mode 100644
index 000000000..2ffb89316
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Item_entity.php
@@ -0,0 +1,28 @@
+setName("item");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/LastLogStats_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/LastLogStats_entity.php
new file mode 100644
index 000000000..30878f04a
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/LastLogStats_entity.php
@@ -0,0 +1,11 @@
+setName("lastlogstats");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/MissionList_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/MissionList_entity.php
new file mode 100644
index 000000000..ab4a7bea9
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/MissionList_entity.php
@@ -0,0 +1,9 @@
+setName("missionlist");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Mission_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Mission_entity.php
new file mode 100644
index 000000000..7a95ac744
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Mission_entity.php
@@ -0,0 +1,11 @@
+setName("mission");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PermanentMod_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PermanentMod_entity.php
new file mode 100644
index 000000000..008a74895
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PermanentMod_entity.php
@@ -0,0 +1,10 @@
+setName("permanentmodifiers");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Pet_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Pet_entity.php
new file mode 100644
index 000000000..e92499d93
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Pet_entity.php
@@ -0,0 +1,24 @@
+setName("pet");
+ #echo "created";
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysCharacs_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysCharacs_entity.php
new file mode 100644
index 000000000..c71109d02
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysCharacs_entity.php
@@ -0,0 +1,10 @@
+setName("phys_characs");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysScores_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysScores_entity.php
new file mode 100644
index 000000000..d7deca5bb
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/PhysScores_entity.php
@@ -0,0 +1,15 @@
+setName("phys_scores");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Position_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Position_entity.php
new file mode 100644
index 000000000..029b1525b
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Position_entity.php
@@ -0,0 +1,12 @@
+setName("position");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillList_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillList_entity.php
new file mode 100644
index 000000000..b3e885b81
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillList_entity.php
@@ -0,0 +1,9 @@
+setName("skilllist");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillPoints_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillPoints_entity.php
new file mode 100644
index 000000000..81582b703
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SkillPoints_entity.php
@@ -0,0 +1,10 @@
+setName("skillpoints");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Skill_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Skill_entity.php
new file mode 100644
index 000000000..f06132ac8
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/Skill_entity.php
@@ -0,0 +1,14 @@
+setName("skill");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SpentSkillPoints_entity.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SpentSkillPoints_entity.php
new file mode 100644
index 000000000..5bacb0e52
--- /dev/null
+++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/entity/SpentSkillPoints_entity.php
@@ -0,0 +1,10 @@
+setName("spentskillpoints");
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/_doc/devshot_005.jpg b/code/web/app/app_achievements/_doc/devshot_005.jpg
new file mode 100644
index 000000000..63fc3380d
Binary files /dev/null and b/code/web/app/app_achievements/_doc/devshot_005.jpg differ
diff --git a/code/web/app/app_achievements/class/AchAchievement_class.php b/code/web/app/app_achievements/class/AchAchievement_class.php
index 67d0360d9..4de86b646 100644
--- a/code/web/app/app_achievements/class/AchAchievement_class.php
+++ b/code/web/app/app_achievements/class/AchAchievement_class.php
@@ -1,5 +1,8 @@
dev = $d;
}
+ #########################
protected $parent_id;
protected $category;
diff --git a/code/web/app/app_achievements/class/AchMenuNode_class.php b/code/web/app/app_achievements/class/AchMenuNode_class.php
index ef232d520..8676ab974 100644
--- a/code/web/app/app_achievements/class/AchMenuNode_class.php
+++ b/code/web/app/app_achievements/class/AchMenuNode_class.php
@@ -1,5 +1,8 @@
dev = $d;
}
+ #########################
protected $parent_id;
protected $name;
diff --git a/code/web/app/app_achievements/class/AchMenu_class.php b/code/web/app/app_achievements/class/AchMenu_class.php
index 60f21f17b..6d11b10df 100644
--- a/code/web/app/app_achievements/class/AchMenu_class.php
+++ b/code/web/app/app_achievements/class/AchMenu_class.php
@@ -15,14 +15,14 @@
$this->open = $open;
// the summary page is autogenerated and has no database entry. We add it manually here.
- /*$tmp = array();
+ $tmp = array();
$tmp['ac_id'] = 0;
$tmp['ac_parent'] = null;
$tmp['acl_name'] = get_translation('ach_summary',$_USER->getLang());
$tmp['ac_image'] = "test.png";
$tmp['ac_order'] = -1;
$tmp['open'] = $open;
- $this->addChild(new AchMenuNode($tmp,$this));*/
+ $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");
diff --git a/code/web/app/app_achievements/class/AchObjective_class.php b/code/web/app/app_achievements/class/AchObjective_class.php
index 2f5a38543..5a314a8fc 100644
--- a/code/web/app/app_achievements/class/AchObjective_class.php
+++ b/code/web/app/app_achievements/class/AchObjective_class.php
@@ -27,7 +27,7 @@
$this->progress = $this->value;
if(!$this->isDone()) {
- $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_player_atom,ach_atom WHERE apa_atom=atom_id AND atom_objective='".$this->id."' AND apa_player='".$_USER->getID()."'");
+ $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'];
}
}
diff --git a/code/web/app/app_achievements/class/AchPerk_class.php b/code/web/app/app_achievements/class/AchPerk_class.php
index bef5e5d71..25585db11 100644
--- a/code/web/app/app_achievements/class/AchPerk_class.php
+++ b/code/web/app/app_achievements/class/AchPerk_class.php
@@ -1,5 +1,8 @@
dev = $d;
}
+ #########################
protected $achievement;
protected $value;
diff --git a/code/web/app/app_achievements/class/AchSummary_class.php b/code/web/app/app_achievements/class/AchSummary_class.php
index 85ca43b37..c607774de 100644
--- a/code/web/app/app_achievements/class/AchSummary_class.php
+++ b/code/web/app/app_achievements/class/AchSummary_class.php
@@ -13,7 +13,7 @@
//read all recent perks 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 FROM ach_achievement as ach,ach_perk,ach_player_perk WHERE ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id ORDER by app_date DESC LIMIT 0,".($size-1));
+ $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_perk,ach_player_perk WHERE ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id ORDER by app_date DESC LIMIT 0,".($size-1));
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
diff --git a/code/web/app/app_achievements/conf.php b/code/web/app/app_achievements/conf.php
index a9ff621a3..f31fc7bc3 100644
--- a/code/web/app/app_achievements/conf.php
+++ b/code/web/app/app_achievements/conf.php
@@ -10,4 +10,8 @@
$_CONF['enable_webig'] = true;
$_CONF['enable_offgame'] = true;
$_CONF['image_url'] = "http://www.3025-game.de/special/app_achievements/";
+
+ $_CONF['use_fb'] = true;
+ $_CONF['fb_id'] = "447985781893176";
+ $_CONF['fb_secret'] = "f953772f1f7d871db022a6023e7a3f42";
?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/fb.php b/code/web/app/app_achievements/fb.php
new file mode 100644
index 000000000..57b33dbbd
--- /dev/null
+++ b/code/web/app/app_achievements/fb.php
@@ -0,0 +1,57 @@
+ $_CONF['fb_id'],
+ 'secret' => $_CONF['fb_secret'],
+ 'cookie' => true
+ ));
+
+ // Get the url to redirect for login to facebook
+ // and request permission to write on the user's wall.
+ $login_url = $facebook->getLoginUrl(
+ array('scope' => 'publish_stream')
+ );
+
+
+ // If not authenticated, redirect to the facebook login dialog.
+ // The $login_url will take care of redirecting back to us
+ // after successful login.
+ if (!$facebook->getUser()) {
+
+ echo '';
+ }
+ else {
+ echo var_export($facebook->getUser(),true);
+ // Do the wall post.
+ try {
+
+ $facebook->api("/me/feed", "post", array(
+ message => "My character Talvela just earned 'Bejeweled' on Ryzom!",
+ picture => "http://www.3025-game.de/special/app_achievements/pic/icon/test.png",
+ link => "http://www.ryzom.com",
+ name => "Ryzom - MMO",
+ caption => "Join and play for fee!"
+ ));
+ echo "post";
+
+ } catch (FacebookApiException $e) {
+ echo $e;
+ $login_url = $facebook->getLoginUrl( array(
+ 'scope' => 'publish_stream'
+ ));
+ echo 'Please login.';
+ #error_log($e->getType());
+ #error_log($e->getMessage());
+ }
+ }
+?>
\ No newline at end of file
diff --git a/code/web/app/app_achievements/fb/facebook.php b/code/web/app/app_achievements/fb/facebook.php
new file mode 100644
index 000000000..c577c2aa4
--- /dev/null
+++ b/code/web/app/app_achievements/fb/facebook.php
@@ -0,0 +1,93 @@
+constructSessionVariableName($key);
+ $_SESSION[$session_var_name] = $value;
+ }
+
+ protected function getPersistentData($key, $default = false) {
+ if (!in_array($key, self::$kSupportedKeys)) {
+ self::errorLog('Unsupported key passed to getPersistentData.');
+ return $default;
+ }
+
+ $session_var_name = $this->constructSessionVariableName($key);
+ return isset($_SESSION[$session_var_name]) ?
+ $_SESSION[$session_var_name] : $default;
+ }
+
+ protected function clearPersistentData($key) {
+ if (!in_array($key, self::$kSupportedKeys)) {
+ self::errorLog('Unsupported key passed to clearPersistentData.');
+ return;
+ }
+
+ $session_var_name = $this->constructSessionVariableName($key);
+ unset($_SESSION[$session_var_name]);
+ }
+
+ protected function clearAllPersistentData() {
+ foreach (self::$kSupportedKeys as $key) {
+ $this->clearPersistentData($key);
+ }
+ }
+
+ protected function constructSessionVariableName($key) {
+ return implode('_', array('fb',
+ $this->getAppId(),
+ $key));
+ }
+}
diff --git a/code/web/app/app_achievements/include/ach_render_ig.php b/code/web/app/app_achievements/include/ach_render_ig.php
index dee5e19c9..e9f54c163 100644
--- a/code/web/app/app_achievements/include/ach_render_ig.php
+++ b/code/web/app/app_achievements/include/ach_render_ig.php
@@ -413,12 +413,12 @@
"; - if(($prog/$val) > 0.85) { + if(($prog/$val) > 0.5) { $html .= " ".nf($prog)." / ".nf($val)." "; } $html .= " | "; - if(($prog/$val) <= 0.85) { + if(($prog/$val) <= 0.5) { $html .= " ".nf($prog)." / ".nf($val)." "; } $html .= " | diff --git a/code/web/app/app_achievements/include/ach_render_web.php b/code/web/app/app_achievements/include/ach_render_web.php index 3058b2890..8c9df92bd 100644 --- a/code/web/app/app_achievements/include/ach_render_web.php +++ b/code/web/app/app_achievements/include/ach_render_web.php @@ -4,7 +4,14 @@ $c = "
".ach_render_yubopoints($user['id'])." | +
+
+
+
+ ".ach_render_yubopoints($user['id'])."
+ ".ach_render_facebook()."
+
+ |
||
";
@@ -120,13 +127,29 @@
$res = $DBc->sqlQuery("SELECT sum(ap_value) as anz FROM ach_perk,ach_player_perk WHERE ap_id=app_perk AND app_player='".$_USER->getID()."'");
- $html = " ".$_USER->getName()." ".max(0,$res[0]['anz'])." ";
+ $html = "".$_USER->getName()." ".max(0,$res[0]['anz'])." ";
return $html;
}
function ach_render_facebook() {
-
+ return "";
}
function ach_render_twitter() {
@@ -446,12 +469,12 @@
|