Exemple #1
0
 public function get_suit_config()
 {
     $configs = Cache_ItemFlag::getInstance()->get_item_flag_info();
     $out = array();
     if ($configs) {
         $arr_type = array();
         foreach ($configs as $key => $val) {
             if ($val['type'] == 'quality' && $val['equip_type'] == 1) {
                 $type = 1;
             } elseif ($val['type'] == 'strength' && $val['equip_type'] == 1) {
                 $type = 2;
             } elseif ($val['type'] == 'inlay' && $val['equip_type'] == 1) {
                 $type = 3;
             } elseif ($val['type'] == 'quality' && $val['equip_type'] == 2) {
                 $type = 4;
             } elseif ($val['type'] == 'strength' && $val['equip_type'] == 2) {
                 $type = 5;
             } else {
                 $type = 0;
             }
             $arr_type[$type]['type'] = $type;
             $arr_type[$type]['name'] = $val['type_name'];
             $arr_type[$type]['propertys'][] = $key;
         }
         foreach ($arr_type as $val) {
             $tmp = array('type' => $val['type'], 'name' => $val['name'], 'propertys' => array());
             foreach ($val['propertys'] as $key) {
                 $item = $configs[$key];
                 $flag = explode(":", $item['flag']);
                 $arr_condition = explode("|", $item['condition']);
                 $arr_cd = array();
                 foreach ($arr_condition as $con) {
                     if (!empty($con)) {
                         $ctmp = explode(":", $con);
                         $arr_cd[] = array('key' => Cache_ItemKey::getInstance()->get_item_key($ctmp[0]), 'value' => $ctmp[1]);
                     }
                 }
                 $attr = json_decode($item['attr'], true);
                 $arr_attr = array();
                 foreach ($attr as $k => $v) {
                     $arr_attr[] = array('key' => Cache_RoleKey::getInstance()->get_item_key($k), 'val' => $v['val']);
                 }
                 $tmp['propertys'][] = array('id' => $item['sid'], 'name' => $item['name'], 'num' => $flag[1], 'condition' => $arr_cd, 'attr' => $arr_attr);
             }
             $out[0][] = $tmp;
         }
     }
     return $out;
 }
Exemple #2
0
 public function get_enhanced_refine_info($player_id, $player_prop_id, $refine_attr_seq = 0)
 {
     #$this->get_game('PlayerFunc')->get_func_is_open($player_id, $this->func_id_enhanced_refine);
     $this->param_check_numeric(array($player_id));
     $player_equip_info = $this->get_data('PlayerProp')->get_player_prop_detail($player_id, $player_prop_id);
     if (!$player_equip_info) {
         $this->throw_error('80013');
         # 玩家没有该装备!
     }
     if (Com_Util::is_first_charge_item($player_equip_info['prop_id'])) {
         $this->throw_error('81105');
         # 首充装备不允许精练
     }
     $out_849 = array('player_prop_id' => $player_prop_id, 'refine_info_list' => array(), 'add_success_rate_cost' => "{$this->add_success_rate_cost_cur_type}:{$this->add_success_rate_cost_cur_value}", 'add_success_rate' => $this->add_success_rate, 'attr_perfection_avg' => 0, 'refine_attr_seq' => empty($refine_attr_seq) ? 1 : $refine_attr_seq);
     # --------------------------------------------------------------------
     # 获取装备洗练属性信息 + 计算精炼属性增量,成功率与货币消耗
     # --------------------------------------------------------------------
     $attr_perfection_sum = 0;
     if (!empty($player_equip_info['refine_info'])) {
         $refine_info_mod = $this->get_en_refine_success_rate_and_cost_currency($player_equip_info['refine_info']);
         foreach ($refine_info_mod['attr_info'] as $attr_seq => $attr_info) {
             $en_refine_attr_value_current_lv = $attr_info['en_refine_success_num'] * ceil($attr_info['attr_limit'] / $attr_info['attr_section']);
             if ($attr_info['en_refine_lv'] >= $player_equip_info['level'] && $en_refine_attr_value_current_lv >= $attr_info['attr_limit']) {
                 $en_refine_attr_delta = 0;
                 # 已满
             } else {
                 $en_refine_attr_delta = ceil($attr_info['attr_limit'] / $attr_info['attr_section']);
             }
             $out_849['refine_info_list'][] = array('attr_seq' => $attr_info['attr_seq'], 'attr_key' => Cache_RoleKey::getInstance()->get_item_key($attr_info['attr_key']), 'attr_value' => $attr_info['attr_value'], 'attr_limit' => $attr_info['refine_attr_value'] + $attr_info['attr_stint'], 'attr_perfection' => $attr_info['attr_ratio'], 'en_refine_attr_delta' => $en_refine_attr_delta, 'en_refine_success_rate' => $attr_info['en_refine_success_rate'], 'en_refine_cost_currency' => $attr_info['en_refine_cost_currency'], 'lock_status' => 0);
             $attr_perfection_sum += $attr_info['attr_ratio'];
         }
     }
     $out_849['refine_info_list'] = Struct_Prop::attr_sort_2($out_849['refine_info_list']);
     $out_849['attr_perfection_avg'] = ceil($attr_perfection_sum / 5);
     #var_export($out_849);
     return $out_849;
 }
Exemple #3
0
 public static function attr_sort_2($attr_list)
 {
     if (empty($attr_list)) {
         return $attr_list;
     }
     $attr_hash = array();
     foreach ($attr_list as $key => $val) {
         if (is_numeric($val['attr_key'])) {
             $val['attr_key_origin'] = Cache_RoleKey::getInstance()->get_attr_key_by_index($val['attr_key']);
         } else {
             $val['attr_key_origin'] = $val['attr_key'];
         }
         $val['sort_priority'] = self::$_sort_priority[$val['attr_key_origin']];
         $attr_hash[$key] = $val;
     }
     Com_Array::multisort($attr_hash, array('sort_priority' => 'asc'));
     foreach ($attr_hash as $attr_idx => $attr_val) {
         unset($attr_val['sort_priority']);
         unset($attr_val['attr_key_origin']);
         $attr_hash[$attr_idx] = $attr_val;
     }
     return $attr_hash;
 }
Exemple #4
0
 /**
  * 获取每一个套装的数据格式
  * @param $val
  * @param int $player_id
  * @return array
  */
 public function get_fashion_data($val, $player_id = 0, $timeliness = 0)
 {
     $attr_val = array();
     $fpower = 0;
     if ($val['attr_val']) {
         $attr = $this->parse_data($val['attr_val']);
         $fpower = Formula_Fpower::calc_fpower($attr);
         foreach ($attr as $key => $v) {
             $attr_val[] = array('key' => Cache_RoleKey::getInstance()->get_item_key($key), 'val' => $v);
         }
     }
     if ($val['material']) {
         $materials = $this->parse_data($val['material']);
         if (!empty($materials)) {
             list($key, $v) = each($materials);
             $material_id = $key;
             $material_num = $v;
         }
     } else {
         $material_id = 0;
         $material_num = 0;
     }
     return array('sid' => $val['sid'], 'name' => $val['name'], 'type' => $val['type'], 'icon' => $val['icon'], 'attr' => $attr_val, 'times' => $timeliness, 'avatar' => $val['equip_view'], 'sign' => $val['label'], 'signTime' => $val['label_time'], 'player_id' => $player_id, 'material_id' => $material_id, 'material_num' => $material_num, 'material_desc' => $val['material_desc'], 'career_type' => $val['career_type'], 'level' => $val['level'], 'obtain_desc' => $val['obtain_desc'], 'fpower' => $fpower);
 }