79 lines
4.5 KiB
PHP
79 lines
4.5 KiB
PHP
<?php
|
|
class skilltree{
|
|
public static function generate($class){
|
|
if(!player_classes::is($class)){
|
|
return 'Choose a Class first!';}
|
|
$vars = \DBD\TALENT_TREE::Q1(array($class));
|
|
$res = \DBD\TALENT_TREE_ICON::QA(array($class));
|
|
$vars['tree1'] = $vars['tree2'] = $vars['tree3'] = '';
|
|
$count = 0;
|
|
for($t=1;$t<=3;$t++){
|
|
for($r=1;$r<=7; $r++){
|
|
for($c=1;$c<=4;$c++){
|
|
$id = 't'.$t.'r'.$r.'c'.$c;
|
|
$tree = 'tree'.$t;
|
|
|
|
if($c == 1){
|
|
$vars[$tree] .= '<div class="treerowspacer" t="'.$t.'" r="'.$r.'">';}
|
|
|
|
if( count($res) > $count &&
|
|
$res[$count]['tree'] == $t &&
|
|
$res[$count]['row'] == $r &&
|
|
$res[$count]['column'] == $c){
|
|
|
|
if($r == 1){
|
|
$max_text = $res[$count]['parent_row'] ? '' : '0/'.$res[$count]['max'];
|
|
$text_color = 'icon_text_green';
|
|
$style = !$res[$count]['parent_row'] ?
|
|
($res[$count]['icon'] ? 'background: url(./api.php?call=files&cat=skilltree_skills&id='.$res[$count]['icon'].') 50% 50% no-repeat;' : 'visibility:visible;') :
|
|
($res[$count]['icon'] ? 'background: url(./api.php?call=files&cat=skilltree_skills_grey&id='.$res[$count]['icon'].') 50% 50% no-repeat;' : 'visibility:visible;') ;
|
|
} else {
|
|
$max_text = '';
|
|
$text_color = '';
|
|
$style = $res[$count]['icon'] ? 'background: url(./api.php?call=files&cat=skilltree_skills_grey&id='.$res[$count]['icon'].') 50% 50% no-repeat;' : 'visibility:visible;';
|
|
}
|
|
|
|
$vars[$tree] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PAPI(),'char/tpl/skilltree_icon.tpl'),
|
|
array( 'id' => $id,
|
|
'style' => $style,
|
|
'type' => $res[$count]['type'],
|
|
'border' => $res[$count]['border'],
|
|
'text_color' => $text_color,
|
|
'max_text' => $max_text,
|
|
'max' => $res[$count]['max'],
|
|
'tree' => $t,
|
|
'row' => $r,
|
|
'column' => $c,
|
|
'icon' => $res[$count]['icon'],
|
|
'parent_row' => $res[$count]['parent_row'],
|
|
'parent_column' => $res[$count]['parent_column']));
|
|
|
|
$count++;
|
|
} else {
|
|
//empty
|
|
$vars[$tree] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PAPI(),'char/tpl/skilltree_icon.tpl'),
|
|
array( 'id' => $id,
|
|
'style' => 'visibility:hidden;',
|
|
'type' => 'talent_icon icon_empty',
|
|
'border' => '',
|
|
'text_color' => '',
|
|
'max_text' => '',
|
|
'max' => 0,
|
|
'tree' => $t,
|
|
'row' => $r,
|
|
'column' => $c,
|
|
'icon' => '',
|
|
'parent_row' => 0,
|
|
'parent_column' => 0));
|
|
}
|
|
|
|
if($c == 4){
|
|
$vars[$tree] .= '</div>';}
|
|
}
|
|
}
|
|
}
|
|
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PAPI(),'char/tpl/skilltree.tpl'), $vars);
|
|
}
|
|
}
|
|
|