コード例 #1
0
ファイル: EquipRefine.php プロジェクト: bluefan/phpsource
 public function get_en_refine_success_rate_and_cost_currency($refine_info)
 {
     if (empty($refine_info)) {
         return $refine_info;
     }
     #echo "</br>===========$cost_cur_id:$cost_cur_val===========</br>";
     foreach ($refine_info['attr_info'] as $attr_seq => $attr_info) {
         # --------------------------------------------------------------------
         # 获取配置信息[精炼]--用当前精炼等级获取
         # --------------------------------------------------------------------
         $en_refine_conf = Cache_Refine::getInstance()->get_equip_enhanced_refine_base_info($attr_info['en_refine_lv']);
         if (empty($en_refine_conf)) {
             $this->throw_error('81005');
             # 获取精炼基础配置信息失败
         }
         list($cost_cur_id, $cost_cur_val) = explode(":", $en_refine_conf['cost_currency']);
         #echo "</br>==========={$attr_info['en_refine_success_num']}===========</br>";
         $revise_info_1 = Cache_Refine::getInstance()->get_equip_enhanced_refine_revise_info_1($attr_info['en_refine_success_num'], 1);
         $revise_info_2 = Cache_Refine::getInstance()->get_equip_enhanced_refine_revise_info_2($attr_info['attr_ratio'], 1);
         #var_export($revise_info_1);
         #var_export($revise_info_2);
         $cost_cur_val *= $revise_info_1['cost_currency_revise'] / 10000;
         $cost_cur_val *= $revise_info_2['cost_currency_revise'] / 10000;
         $cost_cur_val *= 1 - $attr_info['en_refine_failed_cont'] * $this->failed_minus_cur_cost_rate / 10000;
         #echo "</br>==========={$cost_cur_val}===========</br>";
         $en_refine_success_rate = $en_refine_conf['success_rate'] - $attr_info['en_refine_success_num'] * $en_refine_conf['weaken_rate'] + $attr_info['en_refine_failed_cont'] * $this->failed_add_success_rate;
         $refine_info['attr_info'][$attr_seq]['en_refine_success_rate'] = intval($en_refine_success_rate);
         $refine_info['attr_info'][$attr_seq]['en_refine_cost_currency'] = $cost_cur_id . ":" . intval($cost_cur_val);
     }
     return $refine_info;
 }
コード例 #2
0
ファイル: EquipInherit.php プロジェクト: bluefan/phpsource
 private function inherit_handle_for_refine($pp_detail, $pp_inherit_detail, &$update_fields_for_inherit)
 {
     $is_inherit = false;
     # 是否有继承,默认否
     if (!empty($pp_detail['refine_info'])) {
         $refine_lv_stint = $this->get_game('EquipRefine')->get_refine_lv_stint($pp_inherit_detail['level']);
         $en_refine_lv_stint = $this->get_game('EquipRefine')->get_en_refine_lv_stint($pp_inherit_detail['level']);
         # 获取洗练属性基础值
         $attr_value_info_refine = Cache_Refine::getInstance()->get_attr_value_info_refine($refine_lv_stint);
         $attr_value_info_inherit = Cache_Refine::getInstance()->get_attr_value_info($en_refine_lv_stint);
         if (empty($attr_value_info_inherit) || empty($attr_value_info_refine)) {
             $this->throw_error('81011');
             # 获取洗练属性值配置失败
         }
         if (!empty($pp_inherit_detail['refine_info'])) {
             $attr_ratio_sum = 0;
             $attr_ratio_sum_inherit = 0;
             foreach ($pp_detail['refine_info']['attr_info'] as $attr_seq => $attr_info) {
                 $attr_ratio_sum += $attr_info['attr_ratio'];
             }
             foreach ($pp_inherit_detail['refine_info']['attr_info'] as $attr_seq => $attr_info) {
                 $attr_ratio_sum_inherit += $attr_info['attr_ratio'];
             }
             if ($attr_ratio_sum > $attr_ratio_sum_inherit) {
                 # 传承装备总的属性完美度 > 继承装备总的属性完美度,则覆盖
                 $update_fields_for_inherit['refine_attr'] = $pp_detail['refine_attr'];
                 $update_fields_for_inherit['refine_info'] = $pp_detail['refine_info'];
                 foreach ($update_fields_for_inherit['refine_info']['attr_info'] as $attr_seq => $attr_info) {
                     $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_stint'] = ceil($attr_value_info_inherit[$attr_info['attr_key']] * ($attr_info['attr_ratio'] / 10000));
                     $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] = ceil($attr_value_info_refine[$attr_info['attr_key']] * ($attr_info['attr_ratio'] / 10000));
                     $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_value'] = $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] + $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['en_refine_attr_value'];
                     $update_fields_for_inherit['refine_attr'][$attr_seq][$attr_info['attr_key']] = $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_value'];
                 }
                 $is_inherit = true;
             }
         } else {
             $update_fields_for_inherit['refine_attr'] = $pp_detail['refine_attr'];
             $update_fields_for_inherit['refine_info'] = $pp_detail['refine_info'];
             foreach ($update_fields_for_inherit['refine_info']['attr_info'] as $attr_seq => $attr_info) {
                 $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_stint'] = ceil($attr_value_info_inherit[$attr_info['attr_key']] * ($attr_info['attr_ratio'] / 10000));
                 $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] = ceil($attr_value_info_refine[$attr_info['attr_key']] * ($attr_info['attr_ratio'] / 10000));
                 $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_value'] = $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] + $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['en_refine_attr_value'];
                 $update_fields_for_inherit['refine_attr'][$attr_seq][$attr_info['attr_key']] = $update_fields_for_inherit['refine_info']['attr_info'][$attr_seq]['attr_value'];
             }
             $is_inherit = true;
         }
     }
     return $is_inherit;
 }
コード例 #3
0
ファイル: PlayerProp.php プロジェクト: bluefan/phpsource
 private function _forward_compatibility_for_refine(&$prop_detail)
 {
     if (empty($prop_detail) || !is_array($prop_detail)) {
         return;
     }
     if ($prop_detail['type'] != 1) {
         return;
     }
     if (empty($prop_detail['refine_attr']) || empty($prop_detail['refine_info'])) {
         if (Com_Util::is_first_charge_item($prop_detail['prop_id'])) {
             return;
         }
         list($refine_attr, $refine_info) = $this->get_game('EquipRefine')->extend_refine($prop_detail['sub_type'], $prop_detail['level']);
         $prop_detail['refine_attr'] = $refine_attr;
         $prop_detail['refine_info'] = $refine_info;
     } else {
         if (Com_Util::is_first_charge_item($prop_detail['prop_id'])) {
             unset($prop_detail['refine_attr']);
             unset($prop_detail['refine_info']);
             return;
         }
         if (intval($prop_detail['refine_version']) < 10) {
             #var_export($prop_detail['refine_info']);
             $refine_lv_stint = $this->get_game('EquipRefine')->get_refine_lv_stint($prop_detail['level']);
             $en_refine_lv_init = $this->get_game('EquipRefine')->get_en_refine_lv_init();
             $en_refine_lv_stint = $this->get_game('EquipRefine')->get_en_refine_lv_stint($prop_detail['level']);
             $attr_value_info_refine = Cache_Refine::getInstance()->get_attr_value_info_refine($refine_lv_stint);
             if ($prop_detail['level'] > $en_refine_lv_init) {
                 $attr_value_info_en_refine = Cache_Refine::getInstance()->get_attr_value_info($prop_detail['level'] - 10);
                 # 可能获得空值
             } else {
                 $attr_value_info_en_refine = array();
                 # 小于初始精炼等级的装备上一精炼等级属性值置空
             }
             $attr_value_info_en_refine_stint = Cache_Refine::getInstance()->get_attr_value_info($en_refine_lv_stint);
             foreach ($prop_detail['refine_info']['attr_info'] as $attr_seq => $attr_info) {
                 $attr_key = $attr_info['attr_key'];
                 $attr_ratio = $attr_info['attr_ratio'];
                 $en_refine_lv = $en_refine_lv_stint;
                 # 当前精炼等级
                 $en_refine_conf = Cache_Refine::getInstance()->get_equip_enhanced_refine_base_info($en_refine_lv);
                 $refine_attr_value = ceil($attr_value_info_refine[$attr_key] * ($attr_ratio / 10000));
                 # 修正洗练属性值
                 $attr_limit = ceil(($attr_value_info_en_refine_stint[$attr_key] - $attr_value_info_en_refine[$attr_key]) * ($attr_ratio / 10000));
                 # 修正当前精炼等级下的精炼属性上限
                 $attr_stint = ceil($attr_value_info_en_refine_stint[$attr_key] * ($attr_ratio / 10000));
                 # 修正最高精炼等级对应的精炼属性上限
                 $attr_section = $en_refine_conf['section'] ? $en_refine_conf['section'] : 10;
                 # 修正当前精炼等级下的精炼分段
                 $en_refine_attr_value = ceil($attr_value_info_en_refine[$attr_key] * $attr_ratio / 10000) + $attr_info['en_refine_success_num'] * ceil($attr_limit / $attr_section);
                 # 修正当前精炼属性值
                 if ($en_refine_attr_value > $attr_stint) {
                     $en_refine_attr_value = $attr_stint;
                 }
                 $attr_value = $refine_attr_value + $en_refine_attr_value;
                 $attr_info_mod = array('attr_seq' => $attr_seq, 'attr_key' => $attr_key, 'attr_value' => $attr_value, 'refine_attr_value' => $refine_attr_value, 'attr_ratio' => $attr_ratio, 'en_refine_lv' => $en_refine_lv, 'en_refine_attr_value' => $en_refine_attr_value, 'attr_limit' => $attr_limit, 'attr_stint' => $attr_stint, 'attr_section' => $attr_section, 'en_refine_success_num' => intval($attr_info['en_refine_success_num']), 'en_refine_failed_cont' => intval($attr_info['en_refine_failed_cont']));
                 $prop_detail['refine_info']['attr_info'][$attr_seq] = $attr_info_mod;
                 $prop_detail['refine_attr'][$attr_seq] = array($attr_key => $prop_detail['refine_info']['attr_info'][$attr_seq]['attr_value']);
             }
             #var_export($prop_detail['refine_info']);
         }
     }
 }