public function getAncient()
{
if($this->ancient > 0){
if(!in_array($this->ancient, [5,6,20])){
$stamina = 10;
} else{
$stamina = 5;
}
if($this->type < 5){
$this->stamina = '<div class="item_light_blue item_size_12 item_font_family">' . __('Increase Strength') . ' +' . $stamina . '</div>';
} else{
$this->stamina = '<div class="item_light_blue item_size_12 item_font_family">' . __('Increase Stamina') . ' +' . $stamina . '</div>';
}
$options = $this->ancientOptions();
if($options != false){
$this->ancopt = '<div class="item_yellow">'.__('Set Item Option Info').'</div><br /><div class="item_grey">';
$this->ancopt .= $options . '<br />';
$this->ancopt .= '</div>';
}
}
}
private function ancientOptions()
{
$set_type = $this->serverfile->item_set_type()->get('item_set_type');
if(is_array($set_type)){
$this->set_options = $this->serverfile->item_set_option()->get('item_set_option');
$this->set_options_text = $this->serverfile->item_set_option_text()->get('item_set_option_text');
if(array_key_exists($this->type, $set_type)){
if(array_key_exists($this->id, $set_type[$this->type])){
if($this->ancient == 5 || $this->ancient == 9){
$set = 'typeA';
}
if($this->ancient == 6 || $this->ancient == 10){
$set = 'set2';
if($set_type[$this->type][$this->id][$set] == 0){
$set = 'typeA';
}
}
if($this->ancient == 20|| $this->ancient == 24){
$set = 'typeB';
if($set_type[$this->type][$this->id][$set] == 0){
$set = 'set2';
}
}
return (isset($set)) ? $this->findAncientOption($set_type[$this->type][$this->id][$set]) : '';
}
}
}
return false;
}
private function findAncientOption($set)
{
if(isset($this->set_options[$set])){
$this->anc_prefix = $this->set_options[$set]['name'];
$options = '<div class="item_light_green item_size_12 item_font_family">'.__('2Set Effect').'</div>';
if($this->set_options[$set]['opt_1_1'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_1'], $this->set_options[$set]['opt_1_1_val']);
}
if($this->set_options[$set]['opt_2_1'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_1'], $this->set_options[$set]['opt_2_1_val']);
}
$options .= '<div class="item_light_green item_size_12 item_font_family">'.__('3Set Effect').'</div>';
if($this->set_options[$set]['opt_1_2'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_2'], $this->set_options[$set]['opt_1_2_val']);
}
if($this->set_options[$set]['opt_2_2'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_2'], $this->set_options[$set]['opt_2_2_val']);
}
$options .= '<div class="item_light_green item_size_12 item_font_family">'.__('4Set Effect').'</div>';
if($this->set_options[$set]['opt_1_3'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_3'], $this->set_options[$set]['opt_1_3_val']);
}
if($this->set_options[$set]['opt_2_3'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_3'], $this->set_options[$set]['opt_2_3_val']);
}
if($this->set_options[$set]['opt_1_4'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_4'], $this->set_options[$set]['opt_1_4_val']);
}
if($this->set_options[$set]['opt_2_4'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_4'], $this->set_options[$set]['opt_2_4_val']);
}
if($this->set_options[$set]['opt_1_5'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_5'], $this->set_options[$set]['opt_1_5_val']);
}
if($this->set_options[$set]['opt_2_5'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_5'], $this->set_options[$set]['opt_2_5_val']);
}
if($this->set_options[$set]['opt_1_6'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_1_6'], $this->set_options[$set]['opt_1_6_val']);
}
if($this->set_options[$set]['opt_2_6'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['opt_2_6'], $this->set_options[$set]['opt_2_6_val']);
}
if($this->set_options[$set]['fopt_1'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_1'], $this->set_options[$set]['fopt_val1']);
}
if($this->set_options[$set]['fopt_2'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_2'], $this->set_options[$set]['fopt_val2']);
}
if($this->set_options[$set]['fopt_3'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_3'], $this->set_options[$set]['fopt_val3']);
}
if($this->set_options[$set]['fopt_4'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_4'], $this->set_options[$set]['fopt_val4']);
}
if($this->set_options[$set]['fopt_5'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_5'], $this->set_options[$set]['fopt_val5']);
}
if($this->set_options[$set]['fopt_6'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_6'], $this->set_options[$set]['fopt_val6']);
}
if($this->set_options[$set]['fopt_7'] != -1){
$options .= $this->findAncientOptionText($this->set_options[$set]['fopt_7'], $this->set_options[$set]['fopt_val7']);
}
}
return $options;
}
private function findAncientOptionText($index, $val)
{
foreach($this->set_options_text AS $key => $value){
if($value[1] == $index){
$sign = '';
if($value[3] == 2){
$sign = '%';
}
return $value[2] . ' +' . $val . $sign . '<br />';
break;
}
}
}