#1470 bugfix in webig renderer (bgcolor); ER scheme/SQL update; untested wip of achievement app
--HG-- branch : gsoc2012-achievementshg/feature/gsoc2013-dfighter
parent
14d5257929
commit
36f39152e5
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 181 KiB |
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if(!defined('APP_NAME')) {
|
||||
die(-1);
|
||||
}
|
||||
|
||||
$achConf = array();
|
||||
|
||||
$achConf['summary_size'] = 12;
|
||||
$achConf['default_lang'] = 'en';
|
||||
$achConf['enable_webig'] = true;
|
||||
$achConf['enable_offgame'] = true;
|
||||
$achConf['use_cache'] = false;
|
||||
?>
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class AchAchievement extends AchList {
|
||||
private $id;
|
||||
private $parent;
|
||||
private $category;
|
||||
private $tie_race;
|
||||
private $tie_civ;
|
||||
private $tie_cult;
|
||||
private $image;
|
||||
private $name;
|
||||
|
||||
function AchAchievement(&$data,$lang) {
|
||||
global $db;
|
||||
|
||||
$this->id = $data['aa_id'];
|
||||
$this->parent = $data['aa_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'];
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$lang."' AND apl_achievement=ap_id) WHERE ap_achievement='".$this->id."' AND ap_parent IS NULL");
|
||||
#MISSING: or parent is done
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$tmp = new AchPerk($res[$i],$lang);
|
||||
|
||||
$this->child_open[] = sizeof($this->nodes);
|
||||
$this->nodes[] = $tmp;
|
||||
/*if($res[$i]['']) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}*/
|
||||
#MISSING: divide into groups -> open/done
|
||||
}
|
||||
}
|
||||
|
||||
function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
function getParent() {
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
function getTieRace() {
|
||||
return $this->tie_race;
|
||||
}
|
||||
|
||||
function getTieCiv() {
|
||||
return $this->tie_civ;
|
||||
}
|
||||
|
||||
function getTieCult() {
|
||||
return $this->tie_cult;
|
||||
}
|
||||
|
||||
function getImage() {
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
$val = 0;
|
||||
foreach($this->child_done as $elem) {
|
||||
$val += $this->nodes[$elem]->getValue();
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
class AchCategory extends AchList {
|
||||
private $id = false;
|
||||
|
||||
function AchCategory($id,$lang = 'en') {
|
||||
global $db;
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL");
|
||||
#MISSING: or parent is done
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$tmp = new AchAchievement($res[$i],$lang);
|
||||
if($tmp->hasOpen()) {
|
||||
$this->child_open[] = sizeof($this->nodes);
|
||||
}
|
||||
if($tmp->hasDone()) {
|
||||
$this->child_done[] = sizeof($this->nodes);
|
||||
}
|
||||
|
||||
$this->nodes[] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
abstract class RenderNodeIterator {
|
||||
private $nodes = array();
|
||||
|
||||
function getSize() {
|
||||
return sizeof($this->nodes);
|
||||
}
|
||||
|
||||
function getChild($i) {
|
||||
return $this->nodes[$i];
|
||||
}
|
||||
|
||||
function isEmpty() {
|
||||
return (sizeof($this->nodes) == 0);
|
||||
}
|
||||
|
||||
function getChildren() {
|
||||
return $this->nodes;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AchList extends RenderNodeIterator {
|
||||
private $child_done = array();
|
||||
private $child_open = array();
|
||||
|
||||
function getDone() {
|
||||
return $this->child_done;
|
||||
}
|
||||
|
||||
function getOpen() {
|
||||
return $this->child_open;
|
||||
}
|
||||
|
||||
function hasOpen() {
|
||||
return (sizeof($this->child_open) != 0);
|
||||
}
|
||||
|
||||
function hasDone() {
|
||||
return (sizeof($this->child_done) != 0);
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
class AchMenu extends RenderNodeIterator {
|
||||
function AchMenu($open = false,$lang = 'en') {
|
||||
global $db;
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' AND acl_category=ac_id) WHERE ac_parent IS NULL");
|
||||
#MISSING: ORDER by
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AchMenuNode extends RenderNodeIterator {
|
||||
private $id = false;
|
||||
private $parent = false;
|
||||
private $name = null;
|
||||
private $open = false;
|
||||
|
||||
function AchMenuNode(&$data,$open,$lang) {
|
||||
global $db;
|
||||
|
||||
$this->id = $data['ac_id'];
|
||||
$this->parent = $data['ac_parent'];
|
||||
$this->name = $data['acl_name'];
|
||||
|
||||
$this->open = ($open==$data['ac_id']);
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_category LEFT JOIN (ach_category_lang) ON (acl_lang='".$lang."' AND acl_category=ac_id) WHERE ac_parent='".$this->id."'");
|
||||
#MISSING: ORDER by
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
|
||||
}
|
||||
}
|
||||
|
||||
function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function getParent() {
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
function isOpen() {
|
||||
return $this->open;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class AchObjective {
|
||||
private $id;
|
||||
private $perk;
|
||||
private $condition;
|
||||
private $value;
|
||||
private $name;
|
||||
private $display;
|
||||
|
||||
function AchObjective(&$data,$lang) {
|
||||
$this->id = $data['ao_id'];
|
||||
$this->perk = $data['ao_perk'];
|
||||
$this->condition = $data['ao_condition'];
|
||||
$this->value = $data['ao_value'];
|
||||
$this->name = $data['aol_name'];
|
||||
$this->display = $data['ao_display'];
|
||||
}
|
||||
|
||||
function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
function getPerk() {
|
||||
return $this->perk;
|
||||
}
|
||||
|
||||
function getCondition() {
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function getDisplay() {
|
||||
return $this->display;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
class AchPerk extends RenderNodeIterator {
|
||||
private $id;
|
||||
private $parent;
|
||||
private $achievement;
|
||||
private $value;
|
||||
private $name;
|
||||
|
||||
function AchPerk(&$data,$lang) {
|
||||
global $db;
|
||||
|
||||
$this->id = $data['ap_id'];
|
||||
$this->parent = $data['ap_parent'];
|
||||
$this->achievement = $data['ap_achievement'];
|
||||
$this->value = $data['ap_value'];
|
||||
$this->name = $data['apl_name'];
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$lang."' AND aol_objective=ao_id) WHERE ao_perk='".$this->id."'");
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$this->nodes[] = new AchObjective($res[$i],$lang);
|
||||
}
|
||||
}
|
||||
|
||||
function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
function getParent() {
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
function getAchievement() {
|
||||
return $this->achievement;
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
class AchSummary extends AchList {
|
||||
|
||||
function AchSummary($size = 10,$lang = 'en') {
|
||||
global $db;
|
||||
|
||||
$res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND aa_parent IS NULL");
|
||||
#MISSING: or parent is done
|
||||
#MISSING: player's status on achievement
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$tmp = new AchAchievement($res[$i],$lang);
|
||||
if($tmp->hasDone()) {
|
||||
$this->child_done[] = sizeof($this->nodes);
|
||||
$this->nodes[] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue