private function get_dps_reward($base_reward, $dedicate, $dps, $vip_special_level, $dps_list = null) { if (is_null($dps_list)) { $dps_list = Cache_UnionBoss::getInstance()->get_dps_reward(); } if (empty($dps_list)) { return false; } $count = count($dps_list); $base = $base_reward / $count; #基数 $myper = $dps * 100 / $base_reward; #我的比例 $dedicate_base = $dedicate / $count; #贡献基数 if (!empty($dps_list)) { $total = 0; $dedicate_total = 0; foreach ($dps_list as &$val) { if ($val['boss_hp'] <= $myper) { $total += $base * $val['reward_per'] / 100; $dedicate_total += $dedicate_base * $val['crystal_per'] / 100; } } $res = array(); $totals = intval($total / 2); $dedicate_total = intval($dedicate_total / 2); $res['exp'] = array('type' => 'exp', 'item_id' => 1, 'item_num' => $totals * (1 + $vip_special_level / 10000)); $res['crystal'] = array('item_num' => $dedicate_total); return $res; } else { $this->throw_error('10222', 2010140); } }
public function get_build_type($npc_sid) { $list = Cache_UnionBoss::getInstance()->get_union_build_list(); if (!empty($list)) { foreach ($list as $v) { if ($v['npc_sid'] == $npc_sid) { return $v['build_type']; } } } $this->throw_error('10222'); }
private function get_base_level($level) { $list = Cache_UnionBoss::getInstance()->get_base_list(); if (!empty($list)) { foreach ($list as $v) { if ($v['union_level'] == $level) { return $v; } } } return array(); }