public function get_open_sid() { $list = $this->get_data('RankList')->get_sort_list('level'); #var_export($list); $grabmine_info_list = Cache_GrabMine::getInstance()->get_all_base_info(); if (empty($grabmine_info_list)) { return 0; } $open_sid_list = array(); # 开启的活动ID列表 $open_cond_list = array(); # 开启条件列表 foreach ($grabmine_info_list as $val) { if ($val['open_num'] >= 0) { $open_cond_list[$val['sid']] = array('open_level' => $val['open_level'], 'open_num' => $val['open_num']); } else { $open_sid_list[$val['sid']] = 1; } } $meet_cond_list = array(); # 条件统计列表 if (!empty($list)) { foreach ($open_cond_list as $sid => $cond) { foreach ($list as $pinfo) { if ($pinfo['level'] >= $cond['open_level']) { $meet_cond_list[$sid] += 1; } } } } foreach ($open_cond_list as $sid => $cond) { if (isset($meet_cond_list[$sid]) && $meet_cond_list[$sid] >= $cond['open_num']) { $open_sid_list[$sid] = 1; } } return max(array_keys($open_sid_list)); }
private function sort_hall_list($res_hall, $level, $union_info, $pre_view_group) { $res = array(); $datetime = time(); $date = date('Y-m-d'); $res_0 = array(); $res_1 = array(); $res_2 = array(); $res_3 = array(); $world_boss_base = Cache_WorldBoss::getInstance()->get_worldboss_set(); if (empty($res_hall)) { return $res; } $rank_list = $this->get_data('RankList')->get_sort_list('level'); foreach ($res_hall as $v) { $temp = array(); $start = strtotime($date . ' ' . $v['start_time']); $end = strtotime($date . ' ' . $v['end_time']); $status = 0; #0:结束,1:进行中,2:即将开始,3:等级未达到,4服务器开启条件未达到,5非公会成员 $lefttime = 0; #倒计时 #1:进行中 if ($start <= $datetime && $datetime <= $end) { $status = 1; $lefttime = $end - $datetime; } #2:即将开始 if ($start > $datetime) { $status = 2; $lefttime = $start - $datetime; } #0:结束 if ($end < $datetime) { $status = 0; $lefttime = $datetime - $end; } #提前结束 if ($status == 1 && $v['category'] == 1) { $check_over = $this->get_data('WorldBoss')->check_is_over(); if ($check_over) { $status = 0; } } if ($level < $v['join_min_lvl']) { $status = 3; } $joined = 0; if (!$v['category'] != 1 && $status == 1) { $joined = 1; } #判断世界boss加入条件 if ($this->check_in_world_boss($v['id'], $world_boss_base) && $status == 1) { $joined = 1; } if ($joined == 0 && $status == 1) { $status = 3; } #判断是否为公会活动 if ($v['category'] == 5 || $v['category'] == 6) { if (empty($union_info)) { $status = 5; } else { if ($v['category'] == 5) { $u_type = 1; } else { $u_type = 2; } foreach ($union_info as $union) { if ($union[1] == $u_type) { if ($union[13] == 1) { $status = 1; } else { $status = 0; } } } } } $temp['activity_id'] = $v['sid']; $temp['status'] = $status; $temp['lefttime'] = $lefttime; $temp['joined'] = $joined; $temp['tid'] = $v['id']; $temp['join_lvl'] = $v['join_min_lvl']; $temp['open_level'] = 0; $temp['open_num'] = 0; $temp['nums'] = 0; $temp['start_time'] = $start; $temp['end_time'] = $end; if (0 == $status) { array_push($res_0, $temp); } else { if (1 == $status) { array_push($res_1, $temp); } else { if (2 == $status) { array_push($res_2, $temp); } else { if (3 == $status || 5 == $status) { array_push($res_3, $temp); } } } } } $this->sort_by_time($res_0, 'lefttime', 'asc'); $this->sort_by_time($res_1, 'lefttime'); $this->sort_by_time($res_2, 'lefttime'); $this->sort_by_time($res_3, 'lefttime'); if (!empty($res_1)) { foreach ($res_1 as $v) { # array_push($res,$v); $res[] = $v; } } if (!empty($res_2)) { foreach ($res_2 as $v) { $res[] = $v; } } if (!empty($res_0)) { foreach ($res_0 as $v) { $res[] = $v; } } if (empty($pre_view_group)) { return $res; } $res_4 = array(); if (!empty($res_3)) { foreach ($res_3 as $v) { if ($v['join_lvl'] <= $level) { if (!$pre_view_group['worldboss']['open'] && $v['category'] == 1) { #世界boss $world_set = Cache_WorldBoss::getInstance()->get_worldboss_set($v['id']); $v['status'] = 4; #服务器未开启 $v['open_level'] = $world_set['level']; $v['open_num'] = $world_set['level_num']; $v['nums'] = $this->get_open_level_num($world_set['level'], $rank_list); } if (!$pre_view_group['athena']['open'] && $v['category'] == 2) { #守护女神 $athena_set = Cache_Athena::getInstance()->get_athena_set($v['id']); $v['status'] = 4; $v['open_level'] = $athena_set['open_level']; $v['open_num'] = $athena_set['open_num']; $v['nums'] = $this->get_open_level_num($athena_set['open_level'], $rank_list); } if (!$pre_view_group['trial']['open'] && $v['category'] == 10) { #神之试炼 $trial_set = Cache_Trial::getInstance()->get_trial_set($v['id']); $v['status'] = 4; $v['open_level'] = $trial_set['open_level']; $v['open_num'] = $trial_set['open_num']; $v['nums'] = $this->get_open_level_num($trial_set['open_level'], $rank_list); } if (!$pre_view_group['grab']['open'] && $v['category'] == 4) { #水晶争夺 $trial_set = Cache_GrabMine::getInstance()->get_base_info($v['id']); $v['status'] = 4; $v['open_level'] = $trial_set['open_level']; $v['open_num'] = $trial_set['open_num']; $v['nums'] = $this->get_open_level_num($trial_set['open_level'], $rank_list); } $res[] = $v; } else { $res_4[] = $v; } } } if (!empty($res_4)) { foreach ($res_4 as $v) { $res[] = $v; } } foreach ($pre_view_group as $key => $pre_list) { if (empty($pre_list['list'])) { continue; } foreach ($pre_list['list'] as $v) { switch ($key) { case "athena": $set = Cache_Athena::getInstance()->get_athena_set($v['id']); break; case 'worldboss': $set_boss = Cache_WorldBoss::getInstance()->get_worldboss_set($v['id']); $set['open_level'] = $set_boss['level']; $set['open_num'] = $set_boss['level_num']; break; case 'trial': $set = Cache_Trial::getInstance()->get_trial_set($v['id']); break; case 'grab': $set = Cache_GrabMine::getInstance()->get_base_info($v['id']); break; } $start = strtotime($date . ' ' . $v['start_time']); $end = strtotime($date . ' ' . $v['end_time']); $temp = array(); $temp['activity_id'] = $v['sid']; $temp['status'] = 4; $temp['lefttime'] = 0; $temp['joined'] = 0; $temp['tid'] = $v['id']; $temp['join_lvl'] = $v['join_min_lvl']; $temp['open_level'] = $set['open_level']; $temp['open_num'] = $set['open_num']; $temp['nums'] = $this->get_open_level_num($set['open_level'], $rank_list); $temp['start_time'] = $start; $temp['end_time'] = $end; $res[] = $temp; } } return $res; }
public function get_grabmine_reward($player_id, $player_info = null, $map_id = 4041, $rank = 15, $is_throw_error = 0) { if (empty($player_info)) { $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'vip', 'privilege_level')); } # 获取排名奖励列表,已按排名排好序 $rank_reward_list = Cache_GrabMine::getInstance()->get_rank_reward_list($map_id); if (empty($rank_reward_list)) { if ($is_throw_error) { $this->throw_error('180003'); # 抢矿副本排位奖励信息配置错误 } else { return array(); } } $rank_reward_omit = $rank_reward_list[count($rank_reward_list) - 1]; # 超过已配置最大排位的奖励,使用最大排位计算 $rank_reward_info = empty($rank_reward_list[$rank - 1]) ? $rank_reward_omit : $rank_reward_list[$rank - 1]; # 获取vip对奖励的加成信息,只加成非道具奖励 $vip_add_coeff = Com_Util::get_vip_special_reward_add_coeff(10036, $player_info['vip'], $player_info['privilege_level'], $player_id); # 获取基础奖励信息 $base_reward_info = Cache_GrabMine::getInstance()->get_base_reward_info($player_info['level']); if (empty($base_reward_info) || empty($base_reward_info['base_reward'])) { if ($is_throw_error) { $this->throw_error('180005'); # 抢矿副本基础奖励信息配置错误 } else { return array(); } } $reward = array(); $reward_detail_base = $this->get_game('Reward')->get_reward_detail_other_way($base_reward_info['base_reward'], $rank_reward_info['reward_add'], 1); $this->get_game('Reward')->gen_reward_array($reward_detail_base, $reward, 1 + $vip_add_coeff); $reward_detail_rank = $this->get_game('Reward')->get_reward_detail($rank_reward_info['reward_item'], 1); $this->get_game('Reward')->gen_reward_array($reward_detail_rank, $reward); return $reward; }