#1470 working frontend + demo data; ingame rendering not included

--HG--
branch : gsoc2012-achievements
This commit is contained in:
SirCotare 2012-05-27 21:08:28 +02:00
parent 36f39152e5
commit 454055ad7e
20 changed files with 794 additions and 183 deletions

View file

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 25. Mai 2012 um 11:46
-- Erstellungszeit: 27. Mai 2012 um 21:05
-- Server Version: 5.1.46
-- PHP-Version: 5.3.2
@ -32,9 +32,9 @@ CREATE TABLE IF NOT EXISTS `ach_achievement` (
`aa_tie_race` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_tie_cult` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_tie_civ` varchar(64) COLLATE utf8_bin DEFAULT NULL,
`aa_image` varchar(255) COLLATE utf8_bin NOT NULL,
`aa_image` varchar(64) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`aa_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `ach_atom` (
`atom_ruleset` blob NOT NULL,
`atom_primary` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`atom_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
@ -73,8 +73,10 @@ CREATE TABLE IF NOT EXISTS `ach_atom` (
CREATE TABLE IF NOT EXISTS `ach_category` (
`ac_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`ac_parent` bigint(20) unsigned DEFAULT NULL,
`ac_order` smallint(5) unsigned NOT NULL,
`ac_image` varchar(64) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`ac_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ;
-- --------------------------------------------------------
@ -100,9 +102,9 @@ CREATE TABLE IF NOT EXISTS `ach_objective` (
`ao_perk` bigint(20) unsigned NOT NULL,
`ao_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL,
`ao_value` int(10) unsigned DEFAULT NULL,
`ao_display` enum('simple','meta','value') COLLATE utf8_bin NOT NULL DEFAULT 'simple',
`ao_display` enum('simple','meta','value','hidden') COLLATE utf8_bin NOT NULL DEFAULT 'hidden',
PRIMARY KEY (`ao_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=14 ;
-- --------------------------------------------------------
@ -130,7 +132,7 @@ CREATE TABLE IF NOT EXISTS `ach_perk` (
`ap_value` int(10) unsigned NOT NULL,
PRIMARY KEY (`ap_id`),
UNIQUE KEY `ap_parent` (`ap_parent`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ;
-- --------------------------------------------------------
@ -156,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `ach_player_atom` (
`apa_player` bigint(20) unsigned NOT NULL,
`apa_date` bigint(20) unsigned NOT NULL,
`apa_expire` blob NOT NULL,
PRIMARY KEY (`apa_atom`,`apa_player`)
KEY `apa_atom` (`apa_atom`,`apa_player`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- --------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

View file

@ -0,0 +1,159 @@
-- phpMyAdmin SQL Dump
-- version 3.3.3
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 27. Mai 2012 um 21:06
-- Server Version: 5.1.46
-- PHP-Version: 5.3.2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `app_achievements`
--
--
-- Daten für Tabelle `ach_achievement`
--
INSERT INTO `ach_achievement` (`aa_id`, `aa_category`, `aa_parent`, `aa_tie_race`, `aa_tie_cult`, `aa_tie_civ`, `aa_image`) VALUES
(1, 1, NULL, NULL, NULL, NULL, ''),
(2, 1, NULL, NULL, NULL, NULL, ''),
(3, 1, NULL, NULL, NULL, NULL, ''),
(4, 1, NULL, NULL, NULL, NULL, '');
--
-- Daten für Tabelle `ach_achievement_lang`
--
INSERT INTO `ach_achievement_lang` (`aal_achievement`, `aal_lang`, `aal_name`) VALUES
(1, 'en', 'Kill the Bait'),
(2, 'en', 'Grill the Bill'),
(3, 'en', 'Killing Spree'),
(4, 'en', 'The Burning Desert');
--
-- Daten für Tabelle `ach_atom`
--
INSERT INTO `ach_atom` (`atom_id`, `atom_objective`, `atom_mandatory`, `atom_ruleset`, `atom_primary`) VALUES
(1, 13, 0, '', 0);
--
-- Daten für Tabelle `ach_category`
--
INSERT INTO `ach_category` (`ac_id`, `ac_parent`, `ac_order`, `ac_image`) VALUES
(1, NULL, 0, ''),
(2, NULL, 0, ''),
(3, 1, 0, ''),
(4, 1, 0, ''),
(5, 1, 0, '');
--
-- Daten für Tabelle `ach_category_lang`
--
INSERT INTO `ach_category_lang` (`acl_category`, `acl_lang`, `acl_name`) VALUES
(1, 'en', 'Exploration'),
(2, 'en', 'Occupations'),
(3, 'en', 'Aeden Aqueous'),
(4, 'en', 'Burning Desert'),
(5, 'en', 'Witherings');
--
-- Daten für Tabelle `ach_objective`
--
INSERT INTO `ach_objective` (`ao_id`, `ao_perk`, `ao_condition`, `ao_value`, `ao_display`) VALUES
(1, 1, 'all', NULL, 'simple'),
(2, 1, 'all', NULL, 'simple'),
(3, 1, 'all', NULL, 'simple'),
(4, 1, 'all', NULL, 'simple'),
(5, 1, 'all', NULL, 'simple'),
(6, 2, 'all', NULL, 'hidden'),
(7, 3, 'all', 30, 'value'),
(8, 4, 'all', NULL, 'meta'),
(9, 4, 'all', NULL, 'meta'),
(10, 4, 'all', NULL, 'meta'),
(11, 4, 'all', NULL, 'meta'),
(12, 4, 'all', NULL, 'meta'),
(13, 3, 'all', 30, 'value');
--
-- Daten für Tabelle `ach_objective_lang`
--
INSERT INTO `ach_objective_lang` (`aol_objective`, `aol_lang`, `aol_name`) VALUES
(1, 'en', 'Kill A'),
(2, 'en', 'Kill B'),
(3, 'en', 'Kill C'),
(4, 'en', 'Kill D'),
(5, 'en', 'Kill E'),
(7, 'en', 'Kill 30 random Yubos'),
(8, 'en', 'Meta A'),
(9, 'en', 'Meta B'),
(10, 'en', 'Meta C'),
(11, 'en', 'Meta D'),
(12, 'en', 'Meta E'),
(13, 'en', 'Kill 30 random Gingos');
--
-- Daten für Tabelle `ach_perk`
--
INSERT INTO `ach_perk` (`ap_id`, `ap_achievement`, `ap_parent`, `ap_value`) VALUES
(1, 1, NULL, 50),
(2, 2, NULL, 10),
(3, 3, NULL, 10),
(4, 4, NULL, 20),
(5, 2, NULL, 10),
(6, 2, NULL, 10);
--
-- Daten für Tabelle `ach_perk_lang`
--
INSERT INTO `ach_perk_lang` (`apl_perk`, `apl_lang`, `apl_name`) VALUES
(1, 'en', 'Murder every boss listed below'),
(2, 'en', 'Grill "Bill the Vile"'),
(3, 'en', 'Kill 30 of each mob type listed below'),
(4, 'en', 'Explore all regions of the Burning Desert'),
(5, 'en', 'Grill "Peter the Pan"'),
(6, 'en', 'Grill "Ivan the Slayer"');
--
-- Daten für Tabelle `ach_player_atom`
--
INSERT INTO `ach_player_atom` (`apa_atom`, `apa_player`, `apa_date`, `apa_expire`) VALUES
(1, 1, 0, '');
--
-- Daten für Tabelle `ach_player_objective`
--
INSERT INTO `ach_player_objective` (`apo_objective`, `apo_player`, `apo_date`) VALUES
(4, 1, 500),
(7, 1, 500),
(11, 1, 500);
--
-- Daten für Tabelle `ach_player_perk`
--
INSERT INTO `ach_player_perk` (`app_perk`, `app_player`, `app_date`) VALUES
(2, 1, 600),
(5, 1, 100);
--
-- Daten für Tabelle `ach_player_valuecache`
--

View file

@ -9,7 +9,7 @@
private $image;
private $name;
function AchAchievement(&$data,$lang) {
function AchAchievement(&$data,$lang,$user) {
global $db;
$this->id = $data['aa_id'];
@ -20,23 +20,33 @@
$this->tie_cult = $data['aa_tie_cult'];
$this->image = $data['aa_image'];
$this->name = $data['aal_name'];
$this->done = $data[''];
$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");
#echo $this->id;
$res = $db->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$lang."' AND apl_perk=ap_id) LEFT JOIN (ach_player_perk) ON (app_perk=ap_id AND app_player='".$user."') 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);
#echo "Z";
$tmp = new AchPerk($res[$i],$lang,$user);
$this->child_open[] = sizeof($this->nodes);
$this->nodes[] = $tmp;
/*if($res[$i]['']) {
#echo var_export($tmp,true);
if($tmp->isDone()) {
$this->child_done[] = sizeof($this->nodes);
}
else {
}*/
$this->child_open[] = sizeof($this->nodes);
}
$this->nodes[] = $tmp;
#MISSING: divide into groups -> open/done
}
#echo var_export($this->child_open,true);
#echo "X-".$this->hasOpen();
}
function getID() {
@ -67,12 +77,16 @@
return $this->name;
}
function getValue() {
function getValueDone() {
$val = 0;
foreach($this->child_done as $elem) {
$val += $this->nodes[$elem]->getValue();
}
return $val;
}
function getValueOpen() {
return $this->nodes[$this->child_open[0]]->getValue();
}
}
?>

View file

@ -2,16 +2,18 @@
class AchCategory extends AchList {
private $id = false;
function AchCategory($id,$lang = 'en') {
function AchCategory($id,$user = 0,$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");
$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 ORDER by aal_name ASC");
#MISSING: or parent is done
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$tmp = new AchAchievement($res[$i],$lang);
#echo "Y";
$tmp = new AchAchievement($res[$i],$lang,$user);
#echo var_export($tmp,true);
if($tmp->hasOpen()) {
$this->child_open[] = sizeof($this->nodes);
}

View file

@ -1,6 +1,6 @@
<?php
abstract class RenderNodeIterator {
private $nodes = array();
protected $nodes = array();
function getSize() {
return sizeof($this->nodes);
@ -20,8 +20,8 @@
}
abstract class AchList extends RenderNodeIterator {
private $child_done = array();
private $child_open = array();
protected $child_done = array();
protected $child_open = array();
function getDone() {
return $this->child_done;

View file

@ -1,22 +1,32 @@
<?php
class AchMenu extends RenderNodeIterator {
var $open;
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
$this->open = $open;
$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 ORDER by ac_order ASC, acl_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
}
}
function getCat() {
return $this->open;
}
}
class AchMenuNode extends RenderNodeIterator {
private $id = false;
private $parent = false;
private $name = null;
private $open = false;
private $id;
private $parent;
private $name;
private $open;
private $image;
private $order;
function AchMenuNode(&$data,$open,$lang) {
global $db;
@ -24,11 +34,12 @@
$this->id = $data['ac_id'];
$this->parent = $data['ac_parent'];
$this->name = $data['acl_name'];
$this->image = $data['ac_image'];
$this->order = $data['ac_order'];
$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
$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."' ORDER by ac_order ASC, acl_name ASC");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->nodes[] = new AchMenuNode($res[$i],$open,$lang);
@ -50,5 +61,13 @@
function isOpen() {
return $this->open;
}
function getImage() {
return $this->image;
}
function getOrder() {
return $this->order;
}
}
?>

View file

@ -6,14 +6,26 @@
private $value;
private $name;
private $display;
private $done;
private $progress;
function AchObjective(&$data,$lang,$user) {
global $db;
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'];
$this->done = $data['apo_date'];
$this->progress = $this->value;
if(!$this->isDone()) {
$res = $db->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."'");
$this->progress = $res[0]['anz'];
}
}
function getID() {
@ -32,6 +44,10 @@
return $this->value;
}
function getProgress() {
return $this->progress;
}
function getName() {
return $this->name;
}
@ -39,5 +55,13 @@
function getDisplay() {
return $this->display;
}
function isDone() {
return ($this->done > 0);
}
function getDone() {
return $this->done;
}
}
?>

View file

@ -5,8 +5,9 @@
private $achievement;
private $value;
private $name;
private $done;
function AchPerk(&$data,$lang) {
function AchPerk(&$data,$lang,$user) {
global $db;
$this->id = $data['ap_id'];
@ -14,11 +15,12 @@
$this->achievement = $data['ap_achievement'];
$this->value = $data['ap_value'];
$this->name = $data['apl_name'];
$this->done = $data['app_date'];
$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."'");
$res = $db->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$lang."' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player='".$user."') WHERE ao_perk='".$this->id."'");
$sz = sizeof($res);
for($i=0;$i<$sz;$i++) {
$this->nodes[] = new AchObjective($res[$i],$lang);
$this->nodes[] = new AchObjective($res[$i],$lang,$user);
}
}
@ -41,5 +43,22 @@
function getName() {
return $this->name;
}
function objDrawable() {
foreach($this->nodes as $elem) {
if($elem->getDisplay() != "hidden") {
return true;
}
}
return false;
}
function isDone() {
return ($this->done > 0);
}
function getDone() {
return $this->done;
}
}
?>

View file

@ -4,7 +4,7 @@
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");
$res = $db->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$lang."' AND aal_achievement=aa_id) WHERE aa_parent IS NULL");
#MISSING: or parent is done
#MISSING: player's status on achievement
$sz = sizeof($res);

View file

@ -1,21 +1,285 @@
<?php
function ach_render_box_done($content) {
return "<table bgcolor='#FFFFFF' cellspacing='1' cellpadding='0'>
<tr>
<td><table cellspacing='2' cellpadding='0' bgcolor='#B4B4B4'>
<tr>
<td><table cellspacing='1' cellpadding='0' bgcolor='#FFFFFF'>
<tr>
<td><table cellspacing='1' cellpadding='0' bgcolor='#B4B4B4'>
<tr>
<td width='450px' height='50px' align='center' valign='middle'>".$content."</td>
</tr>
</table></td>
</tr>
</table></td>
function ach_render_tiebar($cult = "neutral", $civ = "neutral") {
}
function ach_render_menu(&$menu,$sub = 0) {
$html = "<style>
.ach_menu {
display:block;
padding:2px;
border:1px solid #000000;
margin-bottom:2px;
color:#FFFFFF;
}
.ach_menu:hover {
color:orange;
}
.ach_mspan a {
text-decoration:none;
}
</style>";
$sz = $menu->getSize();
for($i=0;$i<$sz;$i++) {
$curr = $menu->getChild($i);
$html .= "<span class='ach_mspan'><a href=''><table class='ach_menu'>
<tr>
<td><img src='pic/menu/test.png' /></td>
<td style='font-size:".(20-$sub)."px;font-weight:bold;";
if($curr->isOpen()) {
$html .= "color:orange;";
}
$html .= "'>".$curr->getName()."</td>
</tr>
</table></a></span>
<div style='display:block;margin-left:25px;'>".ach_render_menu($curr,($sub+4))."</div>";
}
return $html;
}
function ach_render_category(&$cat) {
$html = "";
$tmp = $cat->getDone();
$sz = sizeof($tmp);
for($i=0;$i<$sz;$i++) {
#echo "A";
$html .= ach_render_achievement_done($cat->getChild($tmp[$i]));
}
$tmp = $cat->getOpen();
$sz = sizeof($tmp);
for($i=0;$i<$sz;$i++) {
#echo "B";
$html .= ach_render_achievement_open($cat->getChild($tmp[$i]));
}
return $html;
}
function ach_render_achievement_done(&$ach) {
$html = "";
$html .= '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="3px"><img src="pic/bar_done_ul.png"></td>
<td style="background-image: url(pic/bar_done_u.png);"></td>
<td width="3px"><img src="pic/bar_done_ur.png"></td>
</tr>
</table></td>
<tr>
<td style="background-image: url(pic/bar_done_l.png);"></td>
<td style="background-image: url(pic/bar_done_bg.png);">
<center><table width="100%" cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="2" valign="top"><img src="pic/icon/test.png"></td>
<td width="100%"><center><span style="font-weight:bold;font-size:24px;color:#000000;">'.$ach->getName().'</span></center></td>
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#000000;padding-right:10px;">
'.$ach->getValueDone().'<br><img src="pic/yubo_done.png">
</td>
</tr><tr><td align="center" valign="top">';
$html .= ach_render_perk_done($ach);
$html .= '</td></tr></tbody></table></center>
</td>
<td style="background-image: url(pic/bar_done_r.png);"></td>
</tr>
<tr>
<td><img src="pic/bar_done_bl.png"></td>
<td style="background-image: url(pic/bar_done_b.png);"></td>
<td><img src="pic/bar_done_br.png"></td>
</tr>
</tbody></table></div>';
return $html;
}
function ach_render_achievement_open(&$ach) {
$html = "";
$html .= '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="3px"><img src="pic/bar_pending_ul.png"></td>
<td style="background-image: url(pic/bar_pending_u.png);"></td>
<td width="3px"><img src="pic/bar_pending_ur.png"></td>
</tr>
<tr>
<td style="background-image: url(pic/bar_pending_l.png);"></td>
<td>
<center><table width="100%" cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="2" valign="top"><img src="pic/icon/test.png"></td>
<td width="100%"><center><span style="font-weight:bold;font-size:24px;color:#FFFFFF;">'.$ach->getName().'</span></center></td>
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#FFFFFF;padding-right:10px;">
'.$ach->getValueOpen().'<br><img src="pic/yubo_pending.png">
</td>
</tr><tr><td align="center" valign="top">';
$html .= ach_render_perk_open($ach);
$html .= '</td></tr></tbody></table></center>
</td>
<td style="background-image: url(pic/bar_pending_r.png);"></td>
</tr>
<tr>
<td><img src="pic/bar_pending_bl.png"></td>
<td style="background-image: url(pic/bar_pending_b.png);"></td>
<td><img src="pic/bar_pending_br.png"></td>
</tr>
</tbody></table></div>';
return $html;
}
function ach_render_perk_open(&$ach) {
#echo var_export($perk_list,true);
$html = "";
$perk_list = $ach->getOpen();
$perk = $ach->getChild($perk_list[0]);
$html .= "<span style='color:#999999;font-weight:bold;'>".$perk->getName()."</span>";
if($perk->objDrawable()) {
$html .= "<br>".ach_render_obj_list($perk->getChildren());
}
return $html;
}
function ach_render_perk_done(&$ach) {
$html = "";
$perk_list = $ach->getDone();
foreach($perk_list as $elem) {
$perk = $ach->getChild($elem);
$html .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$perk->getName()."</span> ( ".date('d.m.Y',$perk->getDone())." ) <img src='pic/yubo_done.png' width='15px' /> ".$perk->getValue()."</div>";
}
/*if($perk->objDrawable()) {
$html .= "<br>".ach_render_obj_list($perk->getChildren());
}*/
return $html;
}
function ach_render_obj_list(&$obj) {
$html = "<center><table width='90%'>";
$i = 0;
$skip = false;
foreach($obj as $elem) {
if(($i%2) == 0) {
$html .= "<tr>";
}
switch($elem->getDisplay()) {
case "meta":
$html .= "<td width='50%'>".ach_render_obj_meta($elem)."</td>";
break;
case "value":
if(($i%2) == 1) {
$html .= "</tr><tr>";
}
$html .= "<td colspan='2' width='100%'><center>".ach_render_obj_value($elem)."</center></td>";
$i++;
break;
case "simple":
$html .= "<td width='50%'>".ach_render_obj_simple($elem)."</td>";
break;
case "hidden":
default:
//do nothing
$skip = true;
break;
}
if(($i%2) == 1) {
$html .= "</tr>";
}
if(!$skip) {
$i++;
}
$skip = false;
}
if(($i%2) == 1) {
$html .= "</tr>";
}
$html .= "</table></center>";
return $html;
}
function ach_render_obj_simple(&$obj) {
$html = "";
if($obj->isdone()) {
$html .= "<img src='pic/check.png' height='10px' />&nbsp;<span style='color:#71BE02;'>";
}
else {
$html .= "<img src='pic/pending.png' height='10px' />&nbsp;<span style='color:#999999;'>";
}
$html .= $obj->getName()."</span>";
return $html;
}
function ach_render_obj_meta(&$obj) {
$html = "";
if($obj->isdone()) {
$col = "#71BE02";
$grey = "";
}
else {
$col = "#999999";
$grey = "grey/";
}
return "<table cellspacing='0' cellpadding='0'>
<tr>
<td><img src='pic/icon/".$grey."test.png' width='20px' /></td>
<td valign='middle'><span style='color:".$col.";'>&nbsp;".$obj->getName()."</span></td>
</tr>
</table>";
}
function ach_render_obj_value(&$obj) {
$html = "";
if($obj->isdone()) {
$col = "#71BE02";
}
else {
$col = "#999999";
}
$html .= "<div style='color:".$col.";display:block;'>".$obj->getName()."</span><div />";
$val = $obj->getValue();
$prog = $obj->getProgress();
$width = 350;
$left = floor($width*(100*($prog/$val))/100);
$html .= "
<table width='".$width."px' cellspacing='0' cellpadding='0' style='border:1px solid #FFFFFF;color:#000000;'>
<tr>
<td bgcolor='#66CC00' width='".$left."px' align='right'>";
if(($prog/$val) > 0.85) {
$html .= "&nbsp;".$prog." / ".$val."&nbsp;";
}
$html .= "</td>
<td align='left' style='color:#FFFFFF;'>";
if(($prog/$val) <= 0.85) {
$html .= "&nbsp;".$prog." / ".$val."&nbsp;";
}
$html .= "</td>
</tr>
</table>";
return $html;
}
?>

View file

@ -1,103 +1,41 @@
<?php
function ach_render_box_done($content) {
return '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="3px"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_ul.png"></td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_u.png);"></td>
<td width="3px"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_ur.png"></td>
</tr>
<tr>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_l.png);"></td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_bg.png);">
<center><table>
<tbody><tr>
<td rowspan="2"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/icon/13.png"></td>
<td height="35px" width="430px"><center><h2 style="margin: 0px;color:#000000;">'.$content.'</h2></center></td>
<td rowspan="2" style="font-weight: bold; text-align: center; font-size: 14px;color:#000000;">
50<br><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png">
</td>
</tr>
<tr id="ach_done_13">
<td><center><table width="350px"><tbody><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 50 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 100 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 150 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 200 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 250 jewels</center></td><td><b>03.01.2012</b></td></tr></tbody></table></center></td>
</tr>
</tbody></table></center>
</td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_r.png);"></td>
</tr>
<tr>
<td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_bl.png"></td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_b.png);"></td>
<td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_done_br.png"></td>
</tr>
</tbody></table></div>';
}
function ach_render_box_pending($name,$content) {
return '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="3px"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_ul.png"></td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_u.png);"></td>
<td width="3px"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_ur.png"></td>
</tr>
<tr>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_l.png);"></td>
<td>
<center><table>
<tbody><tr>
<td rowspan="2"><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/icon/13.png"></td>
<td height="35px" width="430px"><center><h2 style="margin: 0px;color:#FFFFFF;">'.$name.'</h2></center></td>
<td rowspan="2" style="font-weight: bold; text-align: center; font-size: 14px;color:#FFFFFF;">
50<br><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png">
</td>
</tr>
<tr id="ach_done_13">
<td><center><table width="350px"><tbody><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 50 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 100 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 150 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 200 jewels</center></td><td><b>03.01.2012</b></td></tr><tr><td><b>10</b></td><td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/yubo_done.png"></td><td width="100%"><center>Equip a full set of at least quality 250 jewels</center></td><td><b>03.01.2012</b></td></tr></tbody></table></center></td>
</tr>
</tbody></table></center>
</td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_r.png);"></td>
</tr>
<tr>
<td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_bl.png"></td>
<td style="background-image: url(http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_b.png);"></td>
<td><img src="http://www.3025-game.de/portal/ryzom/resource/pic/achievements/bar_pending_br.png"></td>
</tr>
</tbody></table></div>';
}
function ach_render_obj_list($list) {
//group
//columnize
//draw
}
function ach_render_obj_meta($obj) {
}
function ach_render_obj_simple($obj) {
return $obj->getName();
}
function ach_render_obj_value($obj) {
}
function ach_render_tiebar($cult = "neutral", $civ = "neutral") {
}
function ach_render_menu(&$menu) {
$html = "";
function ach_render_menu(&$menu,$sub = 0) {
$html = "<style>
.ach_menu {
display:block;
padding:2px;
border:1px solid #000000;
margin-bottom:2px;
color:#FFFFFF;
}
.ach_menu:hover {
color:orange;
}
.ach_mspan a {
text-decoration:none;
}
</style>";
$sz = $menu->getSize();
for($i=0;$i<$sz;$i++) {
$curr = $menu->getChild($i);
$html .= "<a href='' style='display:block;'></a><div style='display:block;margin-left:50px;'>".ach_render_menu($curr)."</div>";
$html .= "<span class='ach_mspan'><a href=''><table class='ach_menu'>
<tr>
<td><img src='pic/menu/test.png' /></td>
<td style='font-size:".(20-$sub)."px;font-weight:bold;";
if($curr->isOpen()) {
$html .= "color:orange;";
}
$html .= "'>".$curr->getName()."</td>
</tr>
</table></a></span>
<div style='display:block;margin-left:25px;'>".ach_render_menu($curr,($sub+4))."</div>";
}
return $html;
@ -109,12 +47,14 @@
$tmp = $cat->getDone();
$sz = sizeof($tmp);
for($i=0;$i<$sz;$i++) {
#echo "A";
$html .= ach_render_achievement_done($cat->getChild($tmp[$i]));
}
$tmp = $cat->getDone();
$tmp = $cat->getOpen();
$sz = sizeof($tmp);
for($i=0;$i<$sz;$i++) {
#echo "B";
$html .= ach_render_achievement_open($cat->getChild($tmp[$i]));
}
@ -122,7 +62,38 @@
}
function ach_render_achievement_done(&$ach) {
$html = "";
$html .= '<div style="display: block; margin-bottom: 5px;"><table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="3px"><img src="pic/bar_done_ul.png"></td>
<td style="background-image: url(pic/bar_done_u.png);"></td>
<td width="3px"><img src="pic/bar_done_ur.png"></td>
</tr>
<tr>
<td style="background-image: url(pic/bar_done_l.png);"></td>
<td style="background-image: url(pic/bar_done_bg.png);">
<center><table width="100%" cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="2" valign="top"><img src="pic/icon/test.png"></td>
<td width="100%"><center><span style="font-weight:bold;font-size:24px;color:#000000;">'.$ach->getName().'</span></center></td>
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#000000;padding-right:10px;">
'.$ach->getValueDone().'<br><img src="pic/yubo_done.png">
</td>
</tr><tr><td align="center" valign="top">';
$html .= ach_render_perk_done($ach);
$html .= '</td></tr></tbody></table></center>
</td>
<td style="background-image: url(pic/bar_done_r.png);"></td>
</tr>
<tr>
<td><img src="pic/bar_done_bl.png"></td>
<td style="background-image: url(pic/bar_done_b.png);"></td>
<td><img src="pic/bar_done_br.png"></td>
</tr>
</tbody></table></div>';
return $html;
}
function ach_render_achievement_open(&$ach) {
@ -137,16 +108,16 @@
<tr>
<td style="background-image: url(pic/bar_pending_l.png);"></td>
<td>
<center><table>
<center><table width="100%" cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="2"><img src="pic/icon/13.png"></td>
<td height="35px" width="430px"><center><h2 style="margin: 0px;color:#FFFFFF;">'.$ach->getName().'</h2></center></td>
<td rowspan="2" style="font-weight: bold; text-align: center; font-size: 14px;color:#FFFFFF;">
'.$ach->getValue().'<br><img src="pic/yubo_done.png">
<td rowspan="2" valign="top"><img src="pic/icon/test.png"></td>
<td width="100%"><center><span style="font-weight:bold;font-size:24px;color:#FFFFFF;">'.$ach->getName().'</span></center></td>
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#FFFFFF;padding-right:10px;">
'.$ach->getValueOpen().'<br><img src="pic/yubo_pending.png">
</td>
</tr>';
$html .= ach_render_perk_open($ach->getOpen());
$html .= '</tbody></table></center>
</tr><tr><td align="center" valign="top">';
$html .= ach_render_perk_open($ach);
$html .= '</td></tr></tbody></table></center>
</td>
<td style="background-image: url(pic/bar_pending_r.png);"></td>
</tr>
@ -160,28 +131,155 @@
return $html;
}
function ach_render_perk_open(&$perk_list) {
function ach_render_perk_open(&$ach) {
#echo var_export($perk_list,true);
$html = "";
$perk = $perk_list[0];
$perk_list = $ach->getOpen();
$html .= $perk->getName()."<br>";
$html .= ach_render_obj_list($perk->getChildren());
$perk = $ach->getChild($perk_list[0]);
return $html;
}
function ach_render_perk_done() {
}
function ach_render_obj_list(&$obj) {
$html = "";
foreach($obj as $elem) {
$html .= "-".$elem->getName()."<br>";
$html .= "<span style='color:#999999;font-weight:bold;'>".$perk->getName()."</span>";
if($perk->objDrawable()) {
$html .= "<br>".ach_render_obj_list($perk->getChildren());
}
return $html;
}
function ach_render_perk_done(&$ach) {
$html = "";
$perk_list = $ach->getDone();
foreach($perk_list as $elem) {
$perk = $ach->getChild($elem);
$html .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$perk->getName()."</span> ( ".date('d.m.Y',$perk->getDone())." ) <img src='pic/yubo_done.png' width='15px' /> ".$perk->getValue()."</div>";
}
/*if($perk->objDrawable()) {
$html .= "<br>".ach_render_obj_list($perk->getChildren());
}*/
return $html;
}
function ach_render_obj_list(&$obj) {
$html = "<center><table width='90%'>";
$i = 0;
$skip = false;
foreach($obj as $elem) {
if(($i%2) == 0) {
$html .= "<tr>";
}
switch($elem->getDisplay()) {
case "meta":
$html .= "<td width='50%'>".ach_render_obj_meta($elem)."</td>";
break;
case "value":
if(($i%2) == 1) {
$html .= "</tr><tr>";
}
$html .= "<td colspan='2' width='100%'><center>".ach_render_obj_value($elem)."</center></td>";
$i++;
break;
case "simple":
$html .= "<td width='50%'>".ach_render_obj_simple($elem)."</td>";
break;
case "hidden":
default:
//do nothing
$skip = true;
break;
}
if(($i%2) == 1) {
$html .= "</tr>";
}
if(!$skip) {
$i++;
}
$skip = false;
}
if(($i%2) == 1) {
$html .= "</tr>";
}
$html .= "</table></center>";
return $html;
}
function ach_render_obj_simple(&$obj) {
$html = "";
if($obj->isdone()) {
$html .= "<img src='pic/check.png' height='10px' />&nbsp;<span style='color:#71BE02;'>";
}
else {
$html .= "<img src='pic/pending.png' height='10px' />&nbsp;<span style='color:#999999;'>";
}
$html .= $obj->getName()."</span>";
return $html;
}
function ach_render_obj_meta(&$obj) {
$html = "";
if($obj->isdone()) {
$col = "#71BE02";
$grey = "";
}
else {
$col = "#999999";
$grey = "grey/";
}
return "<table cellspacing='0' cellpadding='0'>
<tr>
<td><img src='pic/icon/".$grey."test.png' width='20px' /></td>
<td valign='middle'><span style='color:".$col.";'>&nbsp;".$obj->getName()."</span></td>
</tr>
</table>";
}
function ach_render_obj_value(&$obj) {
$html = "";
if($obj->isdone()) {
$col = "#71BE02";
}
else {
$col = "#999999";
}
$html .= "<div style='color:".$col.";display:block;'>".$obj->getName()."</span><div />";
$val = $obj->getValue();
$prog = $obj->getProgress();
$width = 350;
$left = floor($width*(100*($prog/$val))/100);
$html .= "
<table width='".$width."px' cellspacing='0' cellpadding='0' style='border:1px solid #FFFFFF;color:#000000;'>
<tr>
<td bgcolor='#66CC00' width='".$left."px' align='right'>";
if(($prog/$val) > 0.85) {
$html .= "&nbsp;".$prog." / ".$val."&nbsp;";
}
$html .= "</td>
<td align='left' style='color:#FFFFFF;'>";
if(($prog/$val) <= 0.85) {
$html .= "&nbsp;".$prog." / ".$val."&nbsp;";
}
$html .= "</td>
</tr>
</table>";
return $html;
}
?>

View file

@ -1,14 +1,17 @@
<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors","1");
define('APP_NAME', 'app_achievements');
require_once('../webig/config.php');
include_once('../webig/lang.php');
require_once('../config.php');
include_once('../lang.php');
include_once('lang.php');
require_once('conf.php');
// Ask to authenticate user (using ingame or session method) and fill $user with all information
ryzom_app_authenticate($user, true);
ryzom_app_authenticate($user, false);
if($user['ig']) {
require_once("include/ach_render_ig.php");
@ -18,13 +21,19 @@ else {
}
require_once("include/ach_render_common.php");
require_once("include/AchCommon_class.php");
require_once("include/AchMenu_class.php");
require_once("include/AchSummary_class.php");
require_once("include/AchCategory_class.php");
require_once("include/AchCommon_class.php");
require_once("include/AchAchievement_class.php");
require_once("include/AchPerk_class.php");
require_once("include/AchObjective_class.php");
// Update user acces on Db
//$db = ryDB::getInstance(APP_NAME);
$db = ryDB::getInstance(APP_NAME);
/*$db->setDbDefs('test', array('id' => SQL_DEF_INT, 'num_access' => SQL_DEF_INT));
@ -37,29 +46,30 @@ else
// Content
$c = _t('access', $num_access['num_access']).'<br/>';*/
$c = var_export($user,true);
#$c = var_export($user,true);
$c .= "<center><table>
$c = "<center><table>
<tr>
<td valign='top'>";
<td valign='top'><div style='width:220px;font-weight:bold;font-size:14px;'>";
$_REQUEST['mid'] = 1;
$menu = new AchMenu($_REQUEST['mid'],$user['lang']);
$c .= ach_render_menu($menu);
$c .= "</td>
<td width='645px'>";
$c .= "</div></td>
<td width='645px' valign='top'>";
/*for($i=0;$i<15;$i++) {
$c .= ach_render_box_done("Bejeweled");
}*/
if($menu->isSelected()) {
$cat = new AchCategory($menu->getCat(),$user['lang']);
}
else {
$cat = new AchSummary(12,$user['lang']);
}
#if($menu->isSelected()) {
$cat = new AchCategory($menu->getCat(),1,$user['lang']);
#}
#else {
# $cat = new AchSummary(12,$user['lang']);
#}
$c .= ach_render_category($cat);

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 44 KiB