#1470 updated achievements app to latest live version
This commit is contained in:
parent
4f1fc4c3e6
commit
ccf6788cd2
9 changed files with 397 additions and 148 deletions
|
@ -4,7 +4,7 @@
|
|||
* open and done.
|
||||
*/
|
||||
|
||||
class AchAchievement extends AchList {
|
||||
class AchAchievement extends AchList implements Tieable {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# InDev_trait replaces this in PHP 5.4
|
||||
|
@ -44,7 +44,7 @@
|
|||
protected $template;
|
||||
protected $sticky;
|
||||
|
||||
function AchAchievement($data,$parent) {
|
||||
function AchAchievement($data,&$parent) {
|
||||
global $DBc,$_USER,$_CONF;
|
||||
|
||||
parent::__construct();
|
||||
|
@ -68,7 +68,7 @@
|
|||
$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");
|
||||
$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."' AND (NOT EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id) OR EXISTS (SELECT * FROM ach_task_tie_align WHERE atta_task=at_id AND atta_alignment LIKE '".$parent->getCurrentCult().'|'.$parent->getCurrentCiv()."')) ORDER by at_torder ASC");
|
||||
|
||||
$sz = sizeof($res);
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
|
@ -112,12 +112,64 @@
|
|||
return $this->parent_id;
|
||||
}
|
||||
|
||||
function getTieRace() {
|
||||
function hasTieRace_open() {
|
||||
#return $this->tie_race;
|
||||
$iter = $this->child_open->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieRace_open() && !$curr->inDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieAlign_open() {
|
||||
#return $this->tie_civ;
|
||||
$iter = $this->child_open->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieAlign_open() && !$curr->inDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieRace_done() {
|
||||
#return $this->tie_race;
|
||||
$iter = $this->child_done->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieRace_done() && !$curr->inDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieAlign_done() {
|
||||
#return $this->tie_civ;
|
||||
$iter = $this->child_done->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieAlign_done() && !$curr->inDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieRaceDev() {
|
||||
#return $this->tie_race;
|
||||
$iter = $this->nodes->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieRace()) {
|
||||
if($curr->hasTieRaceDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -125,12 +177,12 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function getTieCiv() {
|
||||
function hasTieAlignDev() {
|
||||
#return $this->tie_civ;
|
||||
$iter = $this->nodes->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieCiv()) {
|
||||
if($curr->hasTieAlignDev()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -138,25 +190,14 @@
|
|||
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) {
|
||||
function isTiedRace_open($r) {
|
||||
#return $this->tie_race;
|
||||
$iter = $this->nodes->getIterator();
|
||||
$iter = $this->child_open->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->isTiedRace($r)) {
|
||||
if($curr->isTiedRace_open($r)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -164,12 +205,12 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function isTiedCiv($c) {
|
||||
function isTiedAlign_open($cult,$civ) {
|
||||
#return $this->tie_civ;
|
||||
$iter = $this->nodes->getIterator();
|
||||
$iter = $this->child_open->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->isTiedCiv($c)) {
|
||||
if($curr->isTiedAlign_open($cult,$civ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -177,12 +218,12 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function isTiedCult($c) {
|
||||
#return $this->tie_cult;
|
||||
$iter = $this->nodes->getIterator();
|
||||
function isTiedRace_done($r) {
|
||||
#return $this->tie_race;
|
||||
$iter = $this->child_done->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->isTiedCult($c)) {
|
||||
if($curr->isTiedRace_done($r)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -190,6 +231,20 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function isTiedAlign_done($cult,$civ) {
|
||||
#return $this->tie_civ;
|
||||
$iter = $this->child_done->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->isTiedAlign_done($cult,$civ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function getImage() {
|
||||
return $this->image;
|
||||
}
|
||||
|
|
|
@ -4,28 +4,34 @@
|
|||
*/
|
||||
|
||||
class AchCategory extends AchList implements Tieable {
|
||||
protected $ties_cult;
|
||||
protected $ties_civ;
|
||||
protected $ties_race;
|
||||
protected $ties_align_done;
|
||||
protected $ties_race_done;
|
||||
protected $ties_align_open;
|
||||
protected $ties_race_open;
|
||||
protected $ties_race_dev;
|
||||
protected $ties_cult_dev;
|
||||
protected $ties_civ_dev;
|
||||
protected $ties_align_dev;
|
||||
protected $cult;
|
||||
protected $civ;
|
||||
protected $race;
|
||||
protected $heroic;
|
||||
protected $contest;
|
||||
protected $allow_civ;
|
||||
protected $allow_cult;
|
||||
|
||||
function AchCategory($id,$race = null,$cult = null,$civ = null) {
|
||||
function AchCategory($id,$race = null,$cult = "c_neutral",$civ = "c_neutral") {
|
||||
global $DBc,$_USER;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if($civ != "%") {
|
||||
$civ = $DBc->sqlEscape($civ);
|
||||
}
|
||||
if($cult != "%") {
|
||||
$cult = $DBc->sqlEscape($cult);
|
||||
}
|
||||
$race = $DBc->sqlEscape($race);
|
||||
|
||||
if($race == null) {
|
||||
/*if($race == null) {
|
||||
$race = $_USER->getRace();
|
||||
}
|
||||
|
||||
|
@ -35,10 +41,11 @@
|
|||
|
||||
if($civ == null) {
|
||||
$civ = $_USER->getCiv();
|
||||
}
|
||||
}*/
|
||||
|
||||
$this->cult = $cult;
|
||||
$this->civ = $civ;
|
||||
$this->rave = $race;
|
||||
|
||||
$this->id = $DBc->sqlEscape($id);
|
||||
|
||||
|
@ -56,61 +63,78 @@
|
|||
}
|
||||
}
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT ac_heroic,ac_contest FROM ach_category WHERE ac_id='".$this->id."'");
|
||||
$res = $DBc->sqlQuery("SELECT ac_heroic,ac_contest,ac_allow_civ,ac_allow_cult FROM ach_category WHERE ac_id='".$this->id."'");
|
||||
$this->heroic = $res[0]['ac_heroic'];
|
||||
$this->contest = $res[0]['ac_contest'];
|
||||
$this->allow_civ = $res[0]['ac_allow_civ'];
|
||||
$this->allow_cult = $res[0]['ac_allow_cult'];
|
||||
|
||||
//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()) {
|
||||
if($curr->hasTieRace_open() && !$curr->inDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_race = $tmp;
|
||||
$this->ties_race_open = $tmp;
|
||||
|
||||
$iter = $this->nodes->getIterator();
|
||||
$tmp = false;
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->getTieCiv()) {
|
||||
if($curr->hasTieAlign_open() && !$curr->inDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_civ = $tmp;
|
||||
$this->ties_align_open = $tmp;
|
||||
|
||||
$iter = $this->nodes->getIterator();
|
||||
$tmp = false;
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->getTieCult()) {
|
||||
if($curr->hasTieRace_done() && !$curr->inDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_cult = $tmp;
|
||||
$this->ties_race_done = $tmp;
|
||||
|
||||
$iter = $this->nodes->getIterator();
|
||||
$tmp = false;
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieAlign_done() && !$curr->inDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_align_done = $tmp;
|
||||
|
||||
$iter = $this->nodes->getIterator();
|
||||
$tmp = false;
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieRaceDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_race_dev = $tmp;
|
||||
|
||||
$iter = $this->nodes->getIterator();
|
||||
$tmp = false;
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->hasTieAlignDev()) {
|
||||
$tmp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->ties_align_dev = $tmp;
|
||||
}
|
||||
|
||||
#@override Parentum::makeChild()
|
||||
|
@ -118,28 +142,36 @@
|
|||
return new AchAchievement($a,$this);
|
||||
}
|
||||
|
||||
function isTiedRace() {
|
||||
return ($this->ties_race > 0);
|
||||
function isAllowedCult() {
|
||||
return ($this->allow_cult == 1);
|
||||
}
|
||||
|
||||
function isTiedCult() {
|
||||
return ($this->ties_cult > 0);
|
||||
function isAllowedCiv() {
|
||||
return ($this->allow_civ == 1);
|
||||
}
|
||||
|
||||
function isTiedCiv() {
|
||||
return ($this->ties_civ > 0);
|
||||
function hasTieRace_open() {
|
||||
return $this->ties_race_open;
|
||||
}
|
||||
|
||||
function isTiedRaceDev() {
|
||||
return ($this->ties_race_dev > 0);
|
||||
function hasTieAlign_open() {
|
||||
return $this->ties_align_open;
|
||||
}
|
||||
|
||||
function isTiedCultDev() {
|
||||
return ($this->ties_cult_dev > 0);
|
||||
function hasTieRace_done() {
|
||||
return $this->ties_race_done;
|
||||
}
|
||||
|
||||
function isTiedCivDev() {
|
||||
return ($this->ties_civ_dev > 0);
|
||||
function hasTieAlign_done() {
|
||||
return $this->ties_align_done;
|
||||
}
|
||||
|
||||
function hasTieRaceDev() {
|
||||
return $this->ties_race_dev;
|
||||
}
|
||||
|
||||
function hasTieAlignDev() {
|
||||
return $this->ties_align_dev;
|
||||
}
|
||||
|
||||
function getCurrentCiv() {
|
||||
|
@ -154,6 +186,22 @@
|
|||
return $this->race;
|
||||
}
|
||||
|
||||
function isTiedRace_open($r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isTiedAlign_open($cult,$civ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isTiedRace_done($r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isTiedAlign_done($cult,$civ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function isHeroic() {
|
||||
return ($this->heroic == 1);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//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);
|
||||
$res = $DBc->sqlQuery("SELECT DISTINCT apt_date,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 ach.aa_dev='0' AND apt_player='".$_USER->getID()."' AND apt_task=at_id ORDER by apt_date DESC LIMIT 0,".$size);
|
||||
|
||||
#echo var_export($res,true);
|
||||
|
||||
|
@ -107,6 +107,10 @@
|
|||
return "c_neutral";
|
||||
}
|
||||
|
||||
function getCurrentRace() {
|
||||
return "r_matis";
|
||||
}
|
||||
|
||||
function isHeroic() {
|
||||
return false;
|
||||
}
|
||||
|
@ -114,5 +118,55 @@
|
|||
function isContest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieRace_open()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieAlign_open()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieRace_done()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieAlign_done()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieRaceDev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasTieAlignDev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTiedRace_open($r)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function isTiedAlign_open($cult, $civ)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function isTiedRace_done($r)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function isTiedAlign_done($cult, $civ)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
class AchTask extends Parentum {
|
||||
class AchTask extends Parentum implements Tieable {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# InDev_trait replaces this in PHP 5.4
|
||||
|
@ -38,8 +38,9 @@
|
|||
protected $inherit_obj;
|
||||
private $heritage_list;
|
||||
protected $tie_race;
|
||||
protected $tie_cult;
|
||||
protected $tie_civ;
|
||||
#protected $tie_cult;
|
||||
#protected $tie_civ;
|
||||
protected $tie_align;
|
||||
|
||||
function AchTask($data,$parent) {
|
||||
global $DBc,$_USER,$_CONF;
|
||||
|
@ -88,7 +89,7 @@
|
|||
$this->tie_race[] = $res[$i]['attr_race'];
|
||||
}
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'");
|
||||
/*$res = $DBc->sqlQuery("SELECT attcult_cult FROM ach_task_tie_cult WHERE attcult_task='".$this->id."'");
|
||||
$sz = sizeof($res);
|
||||
|
||||
$this->tie_cult = array();
|
||||
|
@ -102,6 +103,14 @@
|
|||
$this->tie_civ = array();
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$this->tie_civ[] = $res[$i]['attciv_civ'];
|
||||
}*/
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT atta_alignment FROM ach_task_tie_align WHERE atta_task='".$this->id."'");
|
||||
$sz = sizeof($res);
|
||||
|
||||
$this->tie_align = array();
|
||||
for($i=0;$i<$sz;$i++) {
|
||||
$this->tie_align[] = $res[$i]['atta_alignment'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +128,7 @@
|
|||
$this->addChild($curr);
|
||||
$this->heritage_list->insert($curr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#@override Parentum::makeChild()
|
||||
|
@ -141,36 +151,74 @@
|
|||
}
|
||||
|
||||
function hasTieRace() {
|
||||
if($this->dev == 1) {
|
||||
return false;
|
||||
}
|
||||
return (sizeof($this->tie_race) != 0);
|
||||
}
|
||||
|
||||
function hasTieCult() {
|
||||
return (sizeof($this->tie_cult) != 0);
|
||||
function hasTieAlign() {
|
||||
if($this->dev == 1) {
|
||||
return false;
|
||||
}
|
||||
return (sizeof($this->tie_align) != 0);
|
||||
}
|
||||
|
||||
function hasTieCiv() {
|
||||
return (sizeof($this->tie_civ) != 0);
|
||||
function hasTieRace_open() {
|
||||
return $this->hasTieRace();
|
||||
}
|
||||
|
||||
function hasTieRace_done() {
|
||||
return $this->hasTieRace();
|
||||
}
|
||||
|
||||
function hasTieAlign_open() {
|
||||
return $this->hasTieAlign();
|
||||
}
|
||||
|
||||
function hasTieAlign_done() {
|
||||
return $this->hasTieAlign();
|
||||
}
|
||||
|
||||
function hasTieRaceDev() {
|
||||
return (sizeof($this->tie_race) != 0);
|
||||
}
|
||||
|
||||
function hasTieAlignDev() {
|
||||
return (sizeof($this->tie_align) != 0);
|
||||
}
|
||||
|
||||
function isTiedRace($r) {
|
||||
if(sizeof($this->tie_race) == 0) {
|
||||
return true;
|
||||
}
|
||||
return in_array($r,$this->race);
|
||||
return in_array($r,$this->tie_race);
|
||||
}
|
||||
|
||||
function isTiedCult($c) {
|
||||
if(sizeof($this->tie_cult) == 0) {
|
||||
function isTiedAlign($cult,$civ) {
|
||||
if($cult == "%" || $civ == "%") {
|
||||
return true;
|
||||
}
|
||||
return in_array($c,$this->tie_cult);
|
||||
if(sizeof($this->tie_align) == 0) {
|
||||
return true;
|
||||
}
|
||||
return in_array(($cult.'|'.$civ),$this->tie_align);
|
||||
}
|
||||
|
||||
function isTiedCiv($c) {
|
||||
if(sizeof($this->tie_civ) == 0) {
|
||||
return true;
|
||||
function isTiedRace_open($r) {
|
||||
return $this->isTiedRace($r);
|
||||
}
|
||||
return in_array($c,$this->tie_civ);
|
||||
|
||||
function isTiedRace_done($r) {
|
||||
return $this->isTiedRace($r);
|
||||
}
|
||||
|
||||
function isTiedAlign_done($cult,$civ) {
|
||||
return $this->isTiedAlign($cult,$civ);
|
||||
}
|
||||
|
||||
function isTiedAlign_open($cult,$civ) {
|
||||
return $this->isTiedAlign($cult,$civ);
|
||||
}
|
||||
|
||||
function getAchievement() {
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
}
|
||||
|
||||
function getRace() {
|
||||
return $this->data['race'];
|
||||
return 'r_'.$this->data['race'];
|
||||
}
|
||||
|
||||
function getCiv() {
|
||||
return $this->data['civilization'];
|
||||
return 'c_'.$this->data['civ'];
|
||||
}
|
||||
|
||||
function getCult() {
|
||||
return $this->data['cult'];
|
||||
return 'c_'.$this->data['cult'];
|
||||
}
|
||||
|
||||
function getName() {
|
||||
|
|
|
@ -6,12 +6,28 @@
|
|||
on a user's cult of civ allegiance.
|
||||
---------------------------*/
|
||||
|
||||
function isTiedCult();
|
||||
function hasTieRace_open();
|
||||
|
||||
function isTiedCiv();
|
||||
function hasTieAlign_open();
|
||||
|
||||
function getCurrentCiv();
|
||||
function hasTieRace_done();
|
||||
|
||||
function getCurrentCult();
|
||||
function hasTieAlign_done();
|
||||
|
||||
function hasTieRaceDev();
|
||||
|
||||
function hasTieAlignDev();
|
||||
|
||||
function isTiedRace_open($r);
|
||||
|
||||
function isTiedAlign_open($cult,$civ);
|
||||
|
||||
function isTiedRace_done($r);
|
||||
|
||||
function isTiedAlign_done($cult,$civ);
|
||||
|
||||
#function getCurrentCiv();
|
||||
|
||||
#function getCurrentCult();
|
||||
}
|
||||
?>
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
$c = "<table>
|
||||
<tr>
|
||||
<td>".ach_render_yubopoints($_USER->getID())."</td>
|
||||
<td>".ach_render_yubopoints()."</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -22,7 +22,21 @@
|
|||
$open = $menu->getOpenCat();
|
||||
|
||||
if($open != 0) {
|
||||
$cat = new AchCategory($open,$_REQUEST['cult'],$_REQUEST['civ']);
|
||||
if($_REQUEST['cult']) {
|
||||
$cult = $_REQUEST['cult'];
|
||||
}
|
||||
else {
|
||||
$cult = $_USER->getCult();
|
||||
}
|
||||
|
||||
if($_REQUEST['civ']) {
|
||||
$civ = $_REQUEST['civ'];
|
||||
}
|
||||
else {
|
||||
$civ = $_USER->getCiv();
|
||||
}
|
||||
|
||||
$cat = new AchCategory($open,$_USER->getRace(),$cult,$civ);
|
||||
}
|
||||
else {
|
||||
$cat = new AchSummary($menu,$_CONF['summary_size']);
|
||||
|
@ -47,7 +61,7 @@
|
|||
$html = "<form method='post' action='?cat=".$cat->getID()."'>
|
||||
<table>
|
||||
<tr>";
|
||||
if($cat->isTiedCult()) {
|
||||
if($cat->isAllowedCult()) {
|
||||
$html.= "<td>
|
||||
<select name='cult'>
|
||||
<option value='c_neutral'"; if($cult == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
@ -56,7 +70,7 @@
|
|||
</select>
|
||||
</td>";
|
||||
}
|
||||
if($cat->isTiedCiv()) {
|
||||
if($cat->isAllowedCiv()) {
|
||||
$html.= "<td>
|
||||
<select name='civ'>
|
||||
<option value='c_neutral'"; if($civ == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
@ -73,30 +87,30 @@
|
|||
|
||||
<font size='12px' color='#FFFFFF'>";
|
||||
|
||||
if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
|
||||
/*if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
|
||||
#While being of neutral allegiance with the higher powers
|
||||
$html .= get_translation('ach_allegiance_neutral_cult',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
||||
}
|
||||
elseif($cat->isTiedCiv() && !$cat->isTiedCult() && $civ == "c_neutral") { // xx / neutral
|
||||
#While being of neutral allegiance with the homin civilizations
|
||||
$html .= get_translation('ach_allegiance_neutral_civ',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
||||
}
|
||||
elseif($cat->isTiedCiv() && $cat->isTiedCult() && $cult == "c_neutral" && $civ == "c_neutral") { // neutral / neutral
|
||||
}*/
|
||||
if(($cult == "c_neutral" || !$cat->isAllowedCult()) && ($civ == "c_neutral" || !$cat->isAllowedCiv())) { // neutral / neutral
|
||||
#While being of neutral allegiance
|
||||
$html .= get_translation('ach_allegiance_neutral',$_USER->getLang(),array("<font color='orange'>".get_translation('ach_c_neutral',$_USER->getLang())."</font>"));
|
||||
}
|
||||
else { //other
|
||||
#While being aligned with the
|
||||
$html .= get_translation('ach_allegiance_start',$_USER->getLang());
|
||||
if($cat->isTiedCult() && $cult != "c_neutral") {
|
||||
if($cat->isAllowedCult() && $cult != "c_neutral") {
|
||||
#CULT
|
||||
$html .= "<font color='orange'>".ach_translate_cc($cult)."</font>";
|
||||
if($cat->isTiedCiv() && $civ != "c_neutral") {
|
||||
if($cat->isAllowedCiv() && $civ != "c_neutral") {
|
||||
#and the CIV
|
||||
$html .= get_translation('ach_allegiance_and',$_USER->getLang())." <font color='orange'>".ach_translate_cc($civ)."</font>";
|
||||
}
|
||||
}
|
||||
elseif($cat->isTiedCiv() && $civ != "c_neutral") {
|
||||
elseif($cat->isAllowedCiv() && $civ != "c_neutral") {
|
||||
#CIV
|
||||
$html .= "<font color='orange'>".ach_translate_cc($civ)."</font>";
|
||||
}
|
||||
|
@ -153,7 +167,7 @@
|
|||
else {
|
||||
$html .= "<img src='".$_CONF['image_url']."pic/menu_space.png?cacheid=".$_CONF['image_cdate']."' />";
|
||||
}
|
||||
$html .= "</td><td><a href='?lang=en&cat=".$curr->getID()."'><font size='".(16-$sub)."px'";
|
||||
$html .= "</td><td><a href='?cat=".$curr->getID()."'><font size='".(16-$sub)."px'";
|
||||
if($curr->isOpen()) {
|
||||
$html .= " color='orange'";
|
||||
}
|
||||
|
@ -181,7 +195,7 @@
|
|||
return "<center style='font-size:24px;'>".get_translation('ach_no_heroic_deeds',$_USER->getLang())."</center>";
|
||||
}
|
||||
|
||||
if($cat->isTiedCult() || $cat->isTiedCiv()) {
|
||||
if($cat->hasTieAlign_done() || $cat->hasTieAlign_open()) {
|
||||
$html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat);
|
||||
}
|
||||
|
||||
|
@ -189,10 +203,10 @@
|
|||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
if($curr->inDev() || !$curr->parentDone()) {
|
||||
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_done($cat->getCurrentRace()) || !$curr->isTiedAlign_done($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= ach_render_achievement_done($curr);
|
||||
$html .= ach_render_achievement_done($curr,$cat);
|
||||
}
|
||||
|
||||
if($cat->isHeroic()) {
|
||||
|
@ -203,16 +217,16 @@
|
|||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
if($curr->inDev() || !$curr->parentDone()) {
|
||||
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_open($cat->getCurrentRace()) || !$curr->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= ach_render_achievement_open($curr);
|
||||
$html .= ach_render_achievement_open($curr,$cat);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_achievement_done(&$ach) {
|
||||
function ach_render_achievement_done(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "
|
||||
|
@ -223,7 +237,7 @@
|
|||
<tr>
|
||||
<td width='70px'><img src='".$_CONF['image_url']."pic/icon/".$ach->getImage()."?cacheid=".$_CONF['image_cdate']."'></td>
|
||||
<td><center><font size='22px'><b>".$ach->getName()."</b></font></center>
|
||||
<table>".ach_render_task_done($ach)."</table>
|
||||
<table>".ach_render_task_done($ach,$cat)."</table>
|
||||
</td>
|
||||
<td width='35px'>";
|
||||
if((!$ach->isHeroic() && !$ach->isContest()) && $ach->getValueDone() > 0) {
|
||||
|
@ -243,7 +257,7 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_achievement_open(&$ach) {
|
||||
function ach_render_achievement_open(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "
|
||||
|
@ -291,7 +305,7 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_task_done(&$ach) {
|
||||
function ach_render_task_done(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
$html = "";
|
||||
|
||||
|
@ -299,7 +313,7 @@
|
|||
while($task_list->hasNext()) {
|
||||
$task = $task_list->getNext();
|
||||
|
||||
if($task->inDev()) {
|
||||
if($task->inDev() || !$task->isTiedRace_open($cat->getCurrentRace()) || !$task->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= "<tr><td><font color='#66CC00'><b>".$task->getDisplayName()."</b></font><br>( ".date('d.m.Y',$task->getDone())." )";
|
||||
|
@ -370,13 +384,13 @@
|
|||
|
||||
$html = "";
|
||||
if($obj->isdone()) {
|
||||
$html .= "<img src='".$_CONF['image_url']."pic/check.png?cacheid=".$_CONF['image_cdate']."' height='10px' /> <font color='#71BE02;'>";
|
||||
$html .= "<table><tr><td><img src='".$_CONF['image_url']."pic/check.png?cacheid=".$_CONF['image_cdate']."' height='10px' /></td><td> <font color='#71BE02;'>";
|
||||
}
|
||||
else {
|
||||
$html .= "<img src='".$_CONF['image_url']."pic/pending.png?cacheid=".$_CONF['image_cdate']."' height='10px' /> <font color='#999999;'>";
|
||||
$html .= "<table><tr><td><img src='".$_CONF['image_url']."pic/pending.png?cacheid=".$_CONF['image_cdate']."' height='10px' /> <font color='#999999;'></td><td>";
|
||||
}
|
||||
|
||||
$html .= $obj->getDisplayName()."</font>";
|
||||
$html .= $obj->getDisplayName()."</font></td></tr></table>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
function ach_render() {
|
||||
global $user,$_CONF;
|
||||
global $_USER,$_CONF;
|
||||
|
||||
$c = "<center><table>
|
||||
<tr>
|
||||
<td colspan='2' align='left'>
|
||||
<div style='display:block;border-bottom:1px solid #000000;'>
|
||||
<div style='float:left;width:420px;'>".ach_render_yubopoints($user['id'])."</div>
|
||||
<div style='float:left;width:420px;'>".ach_render_yubopoints()."</div>
|
||||
<div style='float:right;width:420px;text-align:right;'>".ach_render_facebook()."</div>
|
||||
<div style='clear:both;'></div>
|
||||
</div>
|
||||
|
@ -31,7 +31,21 @@
|
|||
$open = $menu->getOpenCat();
|
||||
|
||||
if($open != 0) {
|
||||
$cat = new AchCategory($open,null,$_REQUEST['cult'],$_REQUEST['civ']);
|
||||
if($_REQUEST['cult']) {
|
||||
$cult = $_REQUEST['cult'];
|
||||
}
|
||||
else {
|
||||
$cult = $_USER->getCult();
|
||||
}
|
||||
|
||||
if($_REQUEST['civ']) {
|
||||
$civ = $_REQUEST['civ'];
|
||||
}
|
||||
else {
|
||||
$civ = $_USER->getCiv();
|
||||
}
|
||||
|
||||
$cat = new AchCategory($open,$_USER->getRace(),$cult,$civ);
|
||||
}
|
||||
else {
|
||||
#die($_CONF['summary_size']);
|
||||
|
@ -63,7 +77,7 @@
|
|||
<div style='display:block;text-align:center;'><form method='post' action='?cat=".$cat->getID()."' id='cc_form'>
|
||||
<table>
|
||||
<tr>";
|
||||
if($cat->isTiedCult()) {
|
||||
if($cat->isAllowedCult()) {
|
||||
$html.= "<td>
|
||||
<select name='cult' onchange='document.getElementById(\"cc_form\").submit();'>
|
||||
<option value='c_neutral'"; if($cult == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
@ -72,7 +86,7 @@
|
|||
</select>
|
||||
</td>";
|
||||
}
|
||||
if($cat->isTiedCiv()) {
|
||||
if($cat->isAllowedCiv()) {
|
||||
$html.= "<td>
|
||||
<select name='civ' onchange='document.getElementById(\"cc_form\").submit();'>
|
||||
<option value='c_neutral'"; if($civ == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
@ -89,30 +103,30 @@
|
|||
|
||||
<div style='display:block;font-weight:bold;font-size:20px;color:#FFFFFF;text-align:center;margin-bottom:5px;'>";
|
||||
|
||||
if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
|
||||
/*if($cat->isTiedCult() && !$cat->isTiedCiv() && $cult == "c_neutral") { // neutral / xx
|
||||
#While being of neutral allegiance with the higher powers
|
||||
$html .= get_translation('ach_allegiance_neutral_cult',$_USER->getLang(),array("<span class='o'>".get_translation('ach_c_neutral',$_USER->getLang())."</span>"));
|
||||
}
|
||||
elseif($cat->isTiedCiv() && !$cat->isTiedCult() && $civ == "c_neutral") { // xx / neutral
|
||||
#While being of neutral allegiance with the homin civilizations
|
||||
$html .= get_translation('ach_allegiance_neutral_civ',$_USER->getLang(),array("<span class='o'>".get_translation('ach_c_neutral',$_USER->getLang())."</span>"));
|
||||
}
|
||||
elseif($cat->isTiedCiv() && $cat->isTiedCult() && $cult == "c_neutral" && $civ == "c_neutral") { // neutral / neutral
|
||||
}*/
|
||||
if(($cult == "c_neutral" || !$cat->isAllowedCult()) && ($civ == "c_neutral" || !$cat->isAllowedCiv())) { // neutral / neutral
|
||||
#While being of neutral allegiance
|
||||
$html .= get_translation('ach_allegiance_neutral',$_USER->getLang(),array("<span class='o'>".get_translation('ach_c_neutral',$_USER->getLang())."</span>"));
|
||||
}
|
||||
else { //other
|
||||
#While being aligned with the
|
||||
$html .= get_translation('ach_allegiance_start',$_USER->getLang());
|
||||
if($cat->isTiedCult() && $cult != "c_neutral") {
|
||||
if($cat->isAllowedCult() && $cult != "c_neutral") {
|
||||
#CULT
|
||||
$html .= "<span class='o'>".ach_translate_cc($cult)."</span>";
|
||||
if($cat->isTiedCiv() && $civ != "c_neutral") {
|
||||
if($cat->isAllowedCiv() && $civ != "c_neutral") {
|
||||
#and the CIV
|
||||
$html .= get_translation('ach_allegiance_and',$_USER->getLang())." <span class='o'>".ach_translate_cc($civ)."</span>";
|
||||
}
|
||||
}
|
||||
elseif($cat->isTiedCiv() && $civ != "c_neutral") {
|
||||
elseif($cat->isAllowedCiv() && $civ != "c_neutral") {
|
||||
#CIV
|
||||
$html .= "<span class='o'>".ach_translate_cc($civ)."</span>";
|
||||
}
|
||||
|
@ -193,7 +207,7 @@
|
|||
if($curr->inDev()) {
|
||||
continue;
|
||||
}
|
||||
$html .= "<span class='ach_mspan'><a href='?lang=en&cat=".$curr->getID()."'><table class='ach_menu'>
|
||||
$html .= "<span class='ach_mspan'><a href='?cat=".$curr->getID()."'><table class='ach_menu'>
|
||||
<tr>";
|
||||
if($sub == 0) {
|
||||
$html .= "<td style='width:32px;'><img src='".$_CONF['image_url']."pic/menu/".$curr->getImage()."' /></td>";
|
||||
|
@ -221,7 +235,7 @@
|
|||
return "<center style='font-size:24px;'>".get_translation('ach_no_heroic_deeds',$_USER->getLang())."</center>";
|
||||
}
|
||||
|
||||
if($cat->isTiedCult() || $cat->isTiedCiv()) {
|
||||
if($cat->hasTieAlign_done() || $cat->hasTieAlign_open()) {
|
||||
$html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat);
|
||||
}
|
||||
|
||||
|
@ -229,10 +243,10 @@
|
|||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
if($curr->inDev() || !$curr->parentDone()) {
|
||||
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_done($cat->getCurrentRace()) || !$curr->isTiedAlign_done($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= ach_render_achievement_done($curr);
|
||||
$html .= ach_render_achievement_done($curr,$cat);
|
||||
}
|
||||
|
||||
if($cat->isHeroic()) {
|
||||
|
@ -243,16 +257,16 @@
|
|||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
if($curr->inDev() || !$curr->parentDone()) {
|
||||
if($curr->inDev() || !$curr->parentDone() || !$curr->isTiedRace_open($cat->getCurrentRace()) || !$curr->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= ach_render_achievement_open($curr);
|
||||
$html .= ach_render_achievement_open($curr,$cat);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_achievement_done(&$ach) {
|
||||
function ach_render_achievement_done(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
|
||||
$html = '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
|
||||
|
@ -277,7 +291,7 @@
|
|||
}
|
||||
$html .= '</td>
|
||||
</tr><tr><td align="center" valign="top"><table>';
|
||||
$html .= ach_render_task_done($ach);
|
||||
$html .= ach_render_task_done($ach,$cat);
|
||||
$html .= '</table></td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_done_r.png);"></td>
|
||||
|
@ -292,7 +306,7 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_achievement_open(&$ach) {
|
||||
function ach_render_achievement_open(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
|
||||
$html = '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
|
||||
|
@ -352,7 +366,7 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_task_done(&$ach) {
|
||||
function ach_render_task_done(&$ach,&$cat) {
|
||||
global $_CONF;
|
||||
$html = "";
|
||||
|
||||
|
@ -360,7 +374,7 @@
|
|||
while($task_list->hasNext()) {
|
||||
$task = $task_list->getNext();
|
||||
|
||||
if($task->inDev()) {
|
||||
if($task->inDev() || !$task->isTiedRace_open($cat->getCurrentRace()) || !$task->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) {
|
||||
continue;
|
||||
}
|
||||
$html .= "<tr><td><span style='color:#66CC00;font-weight:bold;'>".$task->getDisplayName()."</span></td><td>( ".date('d.m.Y',$task->getDone())." )</td>";
|
||||
|
|
|
@ -105,6 +105,6 @@ else {
|
|||
}
|
||||
|
||||
|
||||
echo ryzom_app_render("achievements", $c, $_USER->isIG());
|
||||
echo ryzom_app_render(strtoupper(get_translation('ach_app_name',$_USER->getLang())), $c, $_USER->isIG());
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue