From 4f1fc4c3e626d66f67e4674bd540cb7579053b58 Mon Sep 17 00:00:00 2001 From: SirCotare Date: Fri, 15 Feb 2013 14:50:17 +0100 Subject: [PATCH] #1470 updated admin tool to latest live version --- .../class/AdmAchievement_class.php | 12 -- .../class/AdmTask_class.php | 43 +++++ code/web/app/app_achievements_admin/conf.php | 8 +- .../include/adm_render_ach.php | 151 +++++++++++------- .../include/adm_render_atom.php | 2 +- .../include/adm_render_csr.php | 32 ++-- code/web/app/app_achievements_admin/index.php | 131 ++++++++++++--- 7 files changed, 269 insertions(+), 110 deletions(-) diff --git a/code/web/app/app_achievements_admin/class/AdmAchievement_class.php b/code/web/app/app_achievements_admin/class/AdmAchievement_class.php index 747254953..5722457d2 100644 --- a/code/web/app/app_achievements_admin/class/AdmAchievement_class.php +++ b/code/web/app/app_achievements_admin/class/AdmAchievement_class.php @@ -124,18 +124,6 @@ $this->category = $c; } - function setTieRace($t) { - $this->tie_race = $t; - } - - function setTieCiv($t) { - $this->tie_civ = $t; - } - - function setTieCult($t) { - $this->tie_cult = $t; - } - function setImage($i) { $this->image = $i; } diff --git a/code/web/app/app_achievements_admin/class/AdmTask_class.php b/code/web/app/app_achievements_admin/class/AdmTask_class.php index 6f6f8856b..26d050740 100644 --- a/code/web/app/app_achievements_admin/class/AdmTask_class.php +++ b/code/web/app/app_achievements_admin/class/AdmTask_class.php @@ -96,6 +96,8 @@ $DBc->sqlQuery("DELETE FROM ach_task WHERE at_id='".$this->getID()."'"); $DBc->sqlQuery("DELETE FROM ach_player_task WHERE apt_task='".$this->getID()."'"); + $DBc->sqlQuery("DELETE FROM ach_task_tie_align WHERE atta_task='".$this->getID()."'"); + $DBc->sqlQuery("DELETE FROM ach_task_tie_race WHERE attr_task='".$this->getID()."'"); $iter = $this->getIterator(); while($iter->hasNext()) { @@ -111,6 +113,17 @@ $DBc->sqlQuery("UPDATE ach_task SET at_parent=".mkn($this->getParentID()).",at_value='".$DBc->sqlEscape($this->getValue())."',at_condition='".$DBc->sqlEscape($this->getCondition())."',at_condition_value=".mkn($this->getConditionValue()).",at_dev='".$this->getDev()."',at_torder='".$this->torder."', at_inherit='".$this->inherit_obj."' WHERE at_id='".$this->getID()."'"); $DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).") ON DUPLICATE KEY UPDATE atl_name='".$DBc->sqlEscape($this->getName())."',atl_template=".mkn($this->getTemplate()).""); + + $DBc->sqlQuery("DELETE FROM ach_task_tie_align WHERE atta_task='".$this->getID()."'"); + $DBc->sqlQuery("DELETE FROM ach_task_tie_race WHERE attr_task='".$this->getID()."'"); + + foreach($this->tie_race as $elem) { + $DBc->sqlQuery("INSERT INTO ach_task_tie_race (attr_task,attr_race) VALUES ('".$this->getID()."','".$DBc->sqlEscape($elem)."')"); + } + + foreach($this->tie_align as $elem) { + $DBc->sqlQuery("INSERT INTO ach_task_tie_align (atta_task,atta_alignment) VALUES ('".$this->getID()."','".$DBc->sqlEscape($elem)."')"); + } } function insert() { @@ -123,6 +136,14 @@ $this->setID($id); $DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).")"); + + foreach($this->tie_race as $elem) { + $DBc->sqlQuery("INSERT INTO ach_task_tie_race (attr_task,attr_race) VALUES ('".$this->getID()."','".$DBc->sqlEscape($elem)."')"); + } + + foreach($this->tie_align as $elem) { + $DBc->sqlQuery("INSERT INTO ach_task_tie_align (atta_task,atta_alignment) VALUES ('".$this->getID()."','".$DBc->sqlEscape($elem)."')"); + } } function setAchievement($a) { @@ -141,6 +162,14 @@ $this->value = $v; } + function setTieRace($t) { + $this->tie_race = $t; + } + + function setTieAlign($t) { + $this->tie_align = $t; + } + function getCondition() { return $this->condition; } @@ -198,5 +227,19 @@ } } } + + function isTiedRace($r) { + if(sizeof($this->tie_race) == 0) { + return false; + } + return in_array($r,$this->tie_race); + } + + function isTiedAlign($cult,$civ) { + if(sizeof($this->tie_align) == 0) { + return false; + } + return in_array(($cult.'|'.$civ),$this->tie_align); + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements_admin/conf.php b/code/web/app/app_achievements_admin/conf.php index 7163ef95a..1f20ac5a7 100644 --- a/code/web/app/app_achievements_admin/conf.php +++ b/code/web/app/app_achievements_admin/conf.php @@ -12,10 +12,10 @@ $_CONF['enable_CSR'] = true; $_CONF['enable_ADM'] = true; - /*$_CONF['char_mysql_server'] = "localhost"; - $_CONF['char_mysql_user'] = "root"; - $_CONF['char_mysql_pass'] = ""; - $_CONF['char_mysql_database'] = "app_achievements";*/ + $_CONF['char_mysql_server'] = RYAPI_NELDB_HOST; + $_CONF['char_mysql_user'] = RYAPI_NELDB_LOGIN; + $_CONF['char_mysql_pass'] = RYAPI_NELDB_PASS; + $_CONF['char_mysql_database'] = RYAPI_NELDB_RING; $_CONF['langs'] = array('en','de','fr','es','ru'); ?> \ No newline at end of file diff --git a/code/web/app/app_achievements_admin/include/adm_render_ach.php b/code/web/app/app_achievements_admin/include/adm_render_ach.php index 9259842af..4b8c1a2d7 100644 --- a/code/web/app/app_achievements_admin/include/adm_render_ach.php +++ b/code/web/app/app_achievements_admin/include/adm_render_ach.php @@ -138,30 +138,6 @@ $html .= " - - cult: - - - - - - civilization: - - - - image: @@ -199,6 +175,28 @@ condition value: + + allegiance: + + + + @@ -209,7 +207,7 @@ "; - if($cat->isTiedCultDev() || $cat->isTiedCivDev()) { + if($cat->hasTieAlignDev()) { $html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat); } @@ -218,13 +216,17 @@ while($iter->hasNext()) { $curr = $iter->getNext(); - $html .= ach_render_achievement_open($curr); + if(!$curr->isTiedAlign_open($cat->getCurrentCult(),$cat->getCurrentCiv())) { + #continue; + } + + $html .= ach_render_achievement_open($curr,$cat); } return $html; } - function ach_render_achievement_open(&$ach) { + function ach_render_achievement_open(&$ach,&$cat) { global $_CONF,$menu; $html = '
@@ -303,30 +305,6 @@ $html .= " - - - - - - - - @@ -400,6 +378,28 @@ + + + + @@ -440,7 +440,7 @@ "; - $html .= ach_render_task_open($ach); + $html .= ach_render_task_open($ach,$cat); $html .= '
cult: - -
civilization: - -
image: condition value:
allegiance: + +
@@ -455,7 +455,7 @@ return $html; } - function ach_render_task_open(&$ach) { + function ach_render_task_open(&$ach,&$cat) { global $metalist; @@ -467,6 +467,10 @@ $task = $task_list->getNext(); + if(!$task->isTiedAlign($cat->getCurrentCult(),$cat->getCurrentCiv())) { + #continue; + } + $html .= ""; @@ -546,6 +550,28 @@ + + + + @@ -908,7 +934,7 @@
[task:]".$task->getDisplayName()." (".$task->getValue().")condition value:
allegiance: + +
"; - if($cat->isTiedCultDev()) { + if($cat->isAllowedCult()) { $html.= ""; } - if($cat->isTiedCivDev()) { + if($cat->isAllowedCiv()) { $html.= ""; } $html.= "
show all
@@ -934,30 +961,30 @@
"; - 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("".get_translation('ach_c_neutral',$_USER->getLang())."")); } 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("".get_translation('ach_c_neutral',$_USER->getLang())."")); - } - 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("".get_translation('ach_c_neutral',$_USER->getLang())."")); } 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 .= "".ach_translate_cc($cult).""; - if($cat->isTiedCiv() && $civ != "c_neutral") { + if($cat->isAllowedCiv() && $civ != "c_neutral") { #and the CIV $html .= get_translation('ach_allegiance_and',$_USER->getLang())." ".ach_translate_cc($civ).""; } } - elseif($cat->isTiedCiv() && $civ != "c_neutral") { + elseif($cat->isAllowedCiv() && $civ != "c_neutral") { #CIV $html .= "".ach_translate_cc($civ).""; } diff --git a/code/web/app/app_achievements_admin/include/adm_render_atom.php b/code/web/app/app_achievements_admin/include/adm_render_atom.php index f5791a098..ccf5d2366 100644 --- a/code/web/app/app_achievements_admin/include/adm_render_atom.php +++ b/code/web/app/app_achievements_admin/include/adm_render_atom.php @@ -146,7 +146,7 @@ function catchTab(item,e){ } $html = "
-
[+] ".$ach->getName()." (ties= race: ".$ach->getTieRace()."; civ: ".$ach->getTieCiv()."; cult: ".$ach->getTieCult().")
+
[+] ".$ach->getName()."
".ach_render_task_open($ach)."
"; diff --git a/code/web/app/app_achievements_admin/include/adm_render_csr.php b/code/web/app/app_achievements_admin/include/adm_render_csr.php index 48327cfc2..143d20dd2 100644 --- a/code/web/app/app_achievements_admin/include/adm_render_csr.php +++ b/code/web/app/app_achievements_admin/include/adm_render_csr.php @@ -18,6 +18,18 @@ return $res[0]['name']; } + function user_get_data($id) { + global $_CONF,$DBc_char; + $DBc_align = new mySQL($_CONF['mysql_error']); + $DBc_align->connect($_CONF['char_mysql_server'],$_CONF['char_mysql_user'],$_CONF['char_mysql_pass'],$_CONF['char_mysql_database']); + + $res = $DBc_char->sqlQuery("SELECT cid FROM players WHERE id='".$DBc_char->sqlEscape($id)."'"); + + $res = $DBc_align->sendSQL("SELECT race,civilisation,cult FROM characters WHERE char_id='".$res[0]['cid']."'","ARRAY"); + + return $res[0]; + } + function csr_render_yubopoints() { global $DBc,$_USER,$_CONF; @@ -137,7 +149,7 @@ function csr_render_category(&$cat) { $html = ""; - if($cat->isTiedCult() || $cat->isTiedCiv()) { + if($cat->hasTieAlign_done() || $cat->hasTieAlign_open()) { $html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat); } @@ -501,10 +513,10 @@ } -
+
"; - if($cat->isTiedCult()) { + if($cat->isAllowedCult()) { $html.= ""; } - if($cat->isTiedCiv()) { + if($cat->isAllowedCiv()) { $html.= "