#1470 updated admin tool to latest live version

--HG--
branch : gsoc2012-achievements
This commit is contained in:
SirCotare 2013-02-15 14:50:17 +01:00
parent cffdcc5339
commit 598adb8489
7 changed files with 269 additions and 110 deletions

View file

@ -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;
}

View file

@ -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);
}
}
?>

View file

@ -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');
?>

View file

@ -138,30 +138,6 @@
$html .= "</select>
</td>
</tr>
<tr>
<td class='bw'>cult:</td>
<td>
<select name='aa_tie_cult'>
<option value='null' selected='selected'>any</option>
<option value='c_neutral'>neutral</option>
<option value='c_kami'>Kami</option>
<option value='c_karavan'>Karavan</option>
</select>
</td>
</tr>
<tr>
<td class='bw'>civilization:</td>
<td>
<select name='aa_tie_civ'>
<option value='null' selected='selected'>any</option>
<option value='c_neutral'>neutral</option>
<option value='c_fyros'>Fyros</option>
<option value='c_matis'>Matis</option>
<option value='c_tryker'>Tryker</option>
<option value='c_zorai'>Zorai</option>
</select>
</td>
</tr>
<tr>
<td class='bw'>image:</td>
<td><input type='text' name='aa_image' /></td>
@ -199,6 +175,28 @@
<td class='bw'>condition value:</td>
<td><input type='text' name='at_condition_value' /></td>
</tr>
<tr>
<td class='bw'>allegiance:</td>
<td>
<select name='at_tie_allegiance[]' multiple='multiple' size='15'>
<option value='c_neutral|c_neutral'>neutral / neutral</option>
<option value='c_kami|c_neutral'>Kami / neutral</option>
<option value='c_karavan|c_neutral'>Karavan / neutral</option>
<option value='c_neutral|c_fyros'>neutral / Fyros</option>
<option value='c_kami|c_fyros'>Kami / Fyros</option>
<option value='c_karavan|c_fyros'>Karavan / Fyros</option>
<option value='c_neutral|c_matis'>neutral / Matis</option>
<option value='c_kami|c_matis'>Kami / Matis</option>
<option value='c_karavan|c_matis'>Karavan / Matis</option>
<option value='c_neutral|c_tryker'>neutral / Tryker</option>
<option value='c_kami|c_tryker'>Kami / Tryker</option>
<option value='c_karavan|c_tryker'>Karavan / Tryker</option>
<option value='c_neutral|c_zorai'>neutral / Zorai</option>
<option value='c_kami|c_zorai'>Kami / Zorai</option>
<option value='c_karavan|c_zorai'>Karavan / Zorai</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'><input type='hidden' value='0' name='at_inherit' /><input type='submit' value='create' /></td>
</tr>
@ -209,7 +207,7 @@
</div>
</div>";
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 = '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
@ -303,30 +305,6 @@
$html .= "</select>
</td>
</tr>
<tr>
<td class='bw'>cult:</td>
<td>
<select name='aa_tie_cult'>
<option value='null'"; if($ach->getTieCult() == null) { $html .= " selected='selected'"; } $html .= ">any</option>
<option value='c_neutral'"; if($ach->getTieCult() == "c_neutral") { $html .= " selected='selected'"; } $html .= ">neutral</option>
<option value='c_kami'"; if($ach->getTieCult() == "c_kami") { $html .= " selected='selected'"; } $html .= ">Kami</option>
<option value='c_karavan'"; if($ach->getTieCult() == "c_karavan") { $html .= " selected='selected'"; } $html .= ">Karavan</option>
</select>
</td>
</tr>
<tr>
<td class='bw'>civilization:</td>
<td>
<select name='aa_tie_civ'>
<option value='null'"; if($ach->getTieCiv() == null) { $html .= " selected='selected'"; } $html .= ">any</option>
<option value='c_neutral'"; if($ach->getTieCiv() == "c_neutral") { $html .= " selected='selected'"; } $html .= ">neutral</option>
<option value='c_fyros'"; if($ach->getTieCiv() == "c_fyros") { $html .= " selected='selected'"; } $html .= ">Fyros</option>
<option value='c_matis'"; if($ach->getTieCiv() == "c_matis") { $html .= " selected='selected'"; } $html .= ">Matis</option>
<option value='c_tryker'"; if($ach->getTieCiv() == "c_tryker") { $html .= " selected='selected'"; } $html .= ">Tryker</option>
<option value='c_zorai'"; if($ach->getTieCiv() == "c_zorai") { $html .= " selected='selected'"; } $html .= ">Zorai</option>
</select>
</td>
</tr>
<tr>
<td class='bw'>image:</td>
<td><input type='text' name='aa_image' value='".htmlspecialchars($ach->getImage())."' /></td>
@ -400,6 +378,28 @@
<td class='bw'>condition value:</td>
<td><input type='text' name='at_condition_value' /></td>
</tr>
<tr>
<td class='bw'>allegiance:</td>
<td>
<select name='at_tie_allegiance[]' multiple='multiple' size='15'>
<option value='c_neutral|c_neutral'>neutral / neutral</option>
<option value='c_kami|c_neutral'>Kami / neutral</option>
<option value='c_karavan|c_neutral'>Karavan / neutral</option>
<option value='c_neutral|c_fyros'>neutral / Fyros</option>
<option value='c_kami|c_fyros'>Kami / Fyros</option>
<option value='c_karavan|c_fyros'>Karavan / Fyros</option>
<option value='c_neutral|c_matis'>neutral / Matis</option>
<option value='c_kami|c_matis'>Kami / Matis</option>
<option value='c_karavan|c_matis'>Karavan / Matis</option>
<option value='c_neutral|c_tryker'>neutral / Tryker</option>
<option value='c_kami|c_tryker'>Kami / Tryker</option>
<option value='c_karavan|c_tryker'>Karavan / Tryker</option>
<option value='c_neutral|c_zorai'>neutral / Zorai</option>
<option value='c_kami|c_zorai'>Kami / Zorai</option>
<option value='c_karavan|c_zorai'>Karavan / Zorai</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='add' /></td>
</tr>
@ -440,7 +440,7 @@
</form>
</div>";
$html .= ach_render_task_open($ach);
$html .= ach_render_task_open($ach,$cat);
$html .= '</td></tr></tbody></table></center>
</td>
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_pending_r.png);"></td>
@ -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 .= "<table><tr><td><span style='color:#999999;font-weight:bold;display:block;'><a name='task_".$task->getID()."'>[task:]</a>".$task->getDisplayName()." (".$task->getValue().")</span></td>";
@ -546,6 +550,28 @@
<td class='bw'>condition value:</td>
<td><input type='text' name='at_condition_value' value='".htmlspecialchars($task->getConditionValue(),ENT_QUOTES)."' /></td>
</tr>
<tr>
<td class='bw'>allegiance:</td>
<td>
<select name='at_tie_allegiance[]' multiple='multiple' size='15'>
<option value='c_neutral|c_neutral'"; if($task->isTiedAlign('c_neutral','c_neutral')) { $html .= " selected='selected'"; } $html .= ">neutral / neutral</option>
<option value='c_kami|c_neutral'"; if($task->isTiedAlign('c_kami','c_neutral')) { $html .= " selected='selected'"; } $html .= ">Kami / neutral</option>
<option value='c_karavan|c_neutral'"; if($task->isTiedAlign('c_karavan','c_neutral')) { $html .= " selected='selected'"; } $html .= ">Karavan / neutral</option>
<option value='c_neutral|c_fyros'"; if($task->isTiedAlign('c_neutral','c_fyros')) { $html .= " selected='selected'"; } $html .= ">neutral / Fyros</option>
<option value='c_kami|c_fyros'"; if($task->isTiedAlign('c_kami','c_fyros')) { $html .= " selected='selected'"; } $html .= ">Kami / Fyros</option>
<option value='c_karavan|c_fyros'"; if($task->isTiedAlign('c_karavan','c_fyros')) { $html .= " selected='selected'"; } $html .= ">Karavan / Fyros</option>
<option value='c_neutral|c_matis'"; if($task->isTiedAlign('c_neutral','c_matis')) { $html .= " selected='selected'"; } $html .= ">neutral / Matis</option>
<option value='c_kami|c_matis'"; if($task->isTiedAlign('c_kami','c_matis')) { $html .= " selected='selected'"; } $html .= ">Kami / Matis</option>
<option value='c_karavan|c_matis'"; if($task->isTiedAlign('c_karavan','c_matis')) { $html .= " selected='selected'"; } $html .= ">Karavan / Matis</option>
<option value='c_neutral|c_tryker'"; if($task->isTiedAlign('c_neutral','c_tryker')) { $html .= " selected='selected'"; } $html .= ">neutral / Tryker</option>
<option value='c_kami|c_tryker'"; if($task->isTiedAlign('c_kami','c_tryker')) { $html .= " selected='selected'"; } $html .= ">Kami / Tryker</option>
<option value='c_karavan|c_tryker'"; if($task->isTiedAlign('c_karavan','c_tryker')) { $html .= " selected='selected'"; } $html .= ">Karavan / Tryker</option>
<option value='c_neutral|c_zorai'"; if($task->isTiedAlign('c_neutral','c_zorai')) { $html .= " selected='selected'"; } $html .= ">neutral / Zorai</option>
<option value='c_kami|c_zorai'"; if($task->isTiedAlign('c_kami','c_zorai')) { $html .= " selected='selected'"; } $html .= ">Kami / Zorai</option>
<option value='c_karavan|c_zorai'"; if($task->isTiedAlign('c_karavan','c_zorai')) { $html .= " selected='selected'"; } $html .= ">Karavan / Zorai</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='save' /></td>
</tr>
@ -908,7 +934,7 @@
<div style='display:block;text-align:center;'><form method='post' action='?mode=ach&cat=".$cat->getID()."' id='cc_form'>
<table>
<tr>";
if($cat->isTiedCultDev()) {
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>
@ -917,7 +943,7 @@
</select>
</td>";
}
if($cat->isTiedCivDev()) {
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>
@ -926,7 +952,8 @@
<option value='c_tryker'"; if($civ == "c_tryker") { $html.= " selected='selected'"; } $html .= ">Tryker</option>
<option value='c_zorai'"; if($civ == "c_zorai") { $html.= " selected='selected'"; } $html .= ">Zorai</option>
</select>
</td>";
</td>
<td><a href='?mode=ach&cat=".$cat->getID()."&cult=%&civ=%'>show all</a></td>";
}
$html.= "</tr>
</table>
@ -934,30 +961,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>";
}

View file

@ -146,7 +146,7 @@ function catchTab(item,e){
}
$html = "<div style='display: block; margin-bottom: 5px;'>
<div style='display:block;font-size:22px;' class='bar'><a href='javascript:hs(\"ach_".$ach->getID()."\",\"block\");'>[+]</a> ".$ach->getName()." <span style='font-size:12px;'>(ties= race: ".$ach->getTieRace()."; civ: ".$ach->getTieCiv()."; cult: ".$ach->getTieCult().")</span></div>
<div style='display:block;font-size:22px;' class='bar'><a href='javascript:hs(\"ach_".$ach->getID()."\",\"block\");'>[+]</a> ".$ach->getName()."</div>
<div style='margin-left:25px;display:".$o.";' id='ach_".$ach->getID()."'>".ach_render_task_open($ach)."</div>
</div>";

View file

@ -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 @@
}
</style>
<div style='display:block;text-align:center;'><form method='post' action='?cat=".$cat->getID()."' id='cc_form'>
<div style='display:block;text-align:center;'><form method='post' action='?cat=".$cat->getID()."&mode=player&pid=".$_REQUEST['pid']."' 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>
@ -513,7 +525,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>
@ -530,30 +542,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>";
}

View file

@ -140,6 +140,37 @@ $c = "<script type='text/javascript'>
$c .= "</div></td>
<td valign='top'>";
/*if($_REQUEST['mode'] == "insert_fame" && $_ADMIN->isAdmin()) {
$ftpl = 'ENTITY fame AS $fame {
if($fame->faction == ".faction" && ceil($fame->fame/6000) >= [0]) {
GRANT;
FINAL ENTITY;
}
}';
$res = $DBc->sqlQuery("SELECT at_id,atl_name FROM ach_achievement,ach_task,ach_task_lang WHERE at_achievement=aa_id AND ((aa_category<'24' AND aa_category>'15') OR aa_category='56') AND atl_task=at_id AND atl_lang='en'");
for($i=0;$i<sizeof($res);$i++) {
$DBc->sqlQuery("INSERT INTO ach_objective (ao_task,ao_condition,ao_value,ao_display,ao_metalink) VALUES ('".$res[$i]['at_id']."','all',NULL,'hidden',NULL)");
$nid = $DBc->insertID();
$DBc->sqlQuery("INSERT INTO ach_atom (atom_objective,atom_mandatory,atom_ruleset) VALUES ('".$nid."','0','".$DBc->sqlEscape(str_replace('[0]',$res[$i]['atl_name'],$ftpl))."')");
$c .= "INSERT INTO ach_objective (ao_task,ao_condition,ao_value,ao_display,ao_metalink) VALUES ('".$res[$i]['at_id']."','all',NULL,'hidden',NULL)<br>";
$c .= "INSERT INTO ach_atom (atom_objective,atom_mandatory,atom_ruleset) VALUES ('".$nid."','0','".$DBc->sqlEscape(str_replace('[0]',$res[$i]['atl_name'],$ftpl))."')<p>";
}
}
if($_REQUEST['mode'] == "enable_fame" && $_ADMIN->isAdmin()) {
$res = $DBc->sqlQuery("SELECT aa_id FROM ach_achievement WHERE (aa_category<'24' AND aa_category>'14') OR aa_category='56'");
for($i=0;$i<sizeof($res);$i++) {
$DBc->sqlQuery("UPDATE ach_achievement SET aa_dev='0' WHERE aa_id='".$res[$i]['aa_id']."'");
$DBc->sqlQuery("UPDATE ach_task SET at_dev='0' WHERE at_achievement='".$res[$i]['aa_id']."'");
}
}*/
/*
* translation
*/
@ -150,9 +181,9 @@ $c .= "</div></td>
$user['id'] = 0;
$user['lang'] = 'en';
$user['name'] = 'Talvela';
$user['race'] = "r_matis";
$user['civilization'] = "c_neutral";
$user['cult'] = "c_neutral";
$user['race'] = "matis";
$user['civ'] = "neutral";
$user['cult'] = "neutral";
$_USER = new RyzomUser($user);
@ -236,9 +267,9 @@ $c .= "</div></td>
$user['id'] = 0;
$user['lang'] = 'en';
$user['name'] = 'Talvela';
$user['race'] = "r_matis";
$user['civilization'] = "c_neutral";
$user['cult'] = "c_neutral";
$user['race'] = "matis";
$user['civ'] = "neutral";
$user['cult'] = "neutral";
$_USER = new RyzomUser($user);
@ -311,9 +342,9 @@ $c .= "</div></td>
$user['id'] = 1;
$user['lang'] = 'en';
$user['name'] = 'Talvela';
$user['race'] = "r_matis";
$user['civilization'] = "c_neutral";
$user['cult'] = "c_neutral";
$user['race'] = "matis";
$user['civ'] = "neutral";
$user['cult'] = "neutral";
$_USER = new RyzomUser($user);
@ -359,9 +390,9 @@ $c .= "</div></td>
$user['id'] = 0;
$user['lang'] = 'en';
$user['name'] = 'Talvela';
$user['race'] = "r_matis";
$user['civilization'] = "c_neutral";
$user['cult'] = "c_neutral";
$user['race'] = "matis";
$user['civ'] = "neutral";
$user['cult'] = "neutral";
$_USER = new RyzomUser($user);
@ -382,7 +413,31 @@ $c .= "</div></td>
$open = $menu->getOpenCat();
if($open != 0) {
$cat = new AdmCategory($open,$_REQUEST['race'],$_REQUEST['cult'],$_REQUEST['civ']);
if($_REQUEST['cult']) {
$cult = $_REQUEST['cult'];
$_SESSION['cult'] = $cult;
}
elseif($_SESSION['cult']) {
$cult = $_SESSION['cult'];
}
else {
$cult = $_USER->getCult();
}
if($_REQUEST['civ']) {
$civ = $_REQUEST['civ'];
$_SESSION['civ'] = $civ;
}
elseif($_SESSION['civ']) {
$civ = $_SESSION['civ'];
}
else {
$civ = $_USER->getCiv();
}
echo $civ.$cult;
$cat = new AdmCategory($open,$_USER->getRace(),$cult,$civ);
$microstop = explode(' ',microtime());
$stop_time = $microstop[0] + $microstop[1];
@ -416,8 +471,6 @@ $c .= "</div></td>
$ach->setCategory($cat->getID());
$ach->setName($_REQUEST['aal_name']);
$ach->setTemplate($_REQUEST['aal_template']);
$ach->setTieCult($_REQUEST['aa_tie_cult']);
$ach->setTieCiv($_REQUEST['aa_tie_civ']);
$ach->setImage($_REQUEST['aa_image']);
$ach->setParentID($_REQUEST['aa_parent']);
$ach->setSticky($_REQUEST['aa_sticky']);
@ -433,6 +486,10 @@ $c .= "</div></td>
$task->setConditionValue($_REQUEST['at_condition_value']);
$task->setHeritage(0);
if(is_array($_REQUEST['at_tie_allegiance'])) {
$task->setTieAlign($_REQUEST['at_tie_allegiance']);
}
$ach->insertNode($task);
}
@ -442,8 +499,8 @@ $c .= "</div></td>
if($ach != null) {
$ach->setName($_REQUEST['aal_name']);
$ach->setTemplate($_REQUEST['aal_template']);
$ach->setTieCult($_REQUEST['aa_tie_cult']);
$ach->setTieCiv($_REQUEST['aa_tie_civ']);
#$ach->setTieCult($_REQUEST['aa_tie_cult']);
#$ach->setTieCiv($_REQUEST['aa_tie_civ']);
$ach->setImage($_REQUEST['aa_image']);
$ach->setParentID($_REQUEST['aa_parent']);
$ach->setSticky($_REQUEST['aa_sticky']);
@ -464,6 +521,10 @@ $c .= "</div></td>
$task->setConditionValue($_REQUEST['at_condition_value']);
$task->setHeritage($_REQUEST['at_inherit']);
if(is_array($_REQUEST['at_tie_allegiance'])) {
$task->setTieAlign($_REQUEST['at_tie_allegiance']);
}
$ach->insertNode($task);
$task->setParentID($_REQUEST['at_parent']);
$ach->orderTasks();
@ -482,6 +543,10 @@ $c .= "</div></td>
$task->setConditionValue($_REQUEST['at_condition_value']);
$task->setHeritage($_REQUEST['at_inherit']);
if(is_array($_REQUEST['at_tie_allegiance'])) {
$task->setTieAlign($_REQUEST['at_tie_allegiance']);
}
$task->setParentID($_REQUEST['at_parent']);
$ach = $task->getParent();
@ -599,10 +664,11 @@ $c .= "</div></td>
$user = array();
$user['id'] = $_REQUEST['pid'];
$user['lang'] = 'en';
$dta = user_get_data($_REQUEST['pid']);
$user['char_name'] = user_get_name($_REQUEST['pid']);
$user['race'] = "r_matis";
$user['civilization'] = "c_neutral";
$user['cult'] = "c_neutral";
$user['race'] = substr($dta['race'],2);
$user['civ'] = substr($dta['civilisation'],2);
$user['cult'] = substr($dta['cult'],2);
$_USER = new RyzomUser($user);
@ -611,7 +677,29 @@ $c .= "</div></td>
$open = $menu->getOpenCat();
if($open != 0) {
$cat = new CSRCategory($open,null,$_REQUEST['cult'],$_REQUEST['civ']);
if($_REQUEST['cult']) {
$cult = $_REQUEST['cult'];
$_SESSION['cult'] = $cult;
}
elseif($_SESSION['cult']) {
$cult = $_SESSION['cult'];
}
else {
$cult = $_USER->getCult();
}
if($_REQUEST['civ']) {
$civ = $_REQUEST['civ'];
$_SESSION['civ'] = $civ;
}
elseif($_SESSION['civ']) {
$civ = $_SESSION['civ'];
}
else {
$civ = $_USER->getCiv();
}
$cat = new CSRCategory($open,$_USER->getRace(),$cult,$civ);
if($_REQUEST['grant'] != "") {
$cat->grantNode($_REQUEST['grant'],$_USER->getID());
@ -660,6 +748,7 @@ $c .= "</td>
</tr>
</table></center>";
#$c = var_export($_USER).$c;
echo ryzom_app_render("achievements admin", $c, $_ADMIN->isIG());