public function get_free_reward_gain_stint($plm_id, $plm_conf = null) { if (empty($plm_conf)) { $plm_conf = Cache_MagicParliament::getInstance()->get_parliament_conf($plm_id); } # 特权累积免费奖励次数 if ($plm_id == $this->sage_plm_id) { $free_reward_num_acc = $this->get_cross('PlayerDailyTime')->get_global_used_time($this->get_redis_key($this->daily_free_reward_num_acc_prefix, $plm_conf['plm_id'])); } else { $free_reward_num_acc = $this->get_data('PlayerDailyTime')->get_global_used_time($this->get_redis_key($this->daily_free_reward_num_acc_prefix, $plm_conf['plm_id'])); } $free_reward_gain_stint = min($free_reward_num_acc, $plm_conf['free_reward_stint']); return $free_reward_gain_stint; }
/** * 获取进入游戏的初始化数据 * @param $player_id * @return mixed */ public function get_player_init_info($player_id, &$playerInfo = null, $calc_buff_attr = false) { $playerInfo = $this->get_data('Player')->get_player_info($player_id); if (empty($playerInfo)) { return array(); } $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id); $objPlayerAttr = $this->get_game('PlayerAttr'); $objPlayerAttr->set_player_item($playerInfo); $objPlayerAttr->set_player_detail_item($player_detail); $syndata = $objPlayerAttr->get_player_attr($player_id, $calc_buff_attr); $objPlayerAttr->clear(); //$syndata = $objPlayerAttr->get_player_attr($player_detail); $syndata['dower_info'] = $player_detail['dower_info']; $skill_infos = $this->get_game('PlayerSkill')->skill_list($player_id, $playerInfo, $player_detail); $syndata['skill_infos'] = $skill_infos['skill_infos']; $syndata['fairy_info'] = $skill_infos['fairy_info']; $syndata['hook_settings'] = $player_detail['hook_settings']; if (empty($syndata['hook_settings'])) { $syndata['hook_settings'] = $this->init_onhook_settings(); } // $equip = $this->get_game('Prop')->get_player_equip($player_id); $player_prop = $this->get_player_prop_info($player_id, $playerInfo['level']); $syndata['potion_dh_cnt'] = $player_prop['potion_dh_cnt']; $syndata['potion_hot_cnt'] = $player_prop['potion_hot_cnt']; $syndata['mp_potion_cnt'] = $player_prop['mp_potion_cnt']; $equip = $player_prop['equit']; $syndata['equip_skill'] = array(); if (!empty($equip)) { $syndata['equip'] = array(); foreach ($equip as $key => $prop) { if (!empty($prop['equip_view'])) { if (is_string($prop['equip_view'])) { $syndata['equip'][$key] = $prop['equip_view']; } else { $syndata['equip'][$key] = implode(':', $prop['equip_view']); } if ($syndata['equip'][$key] == '0:0:0:0' || $syndata['equip'][$key] == '0:0:0') { $syndata['equip'][$key] = ''; } // $prop_config = Cache_Prop::getInstance()->get_prop_info($prop['prop_id']); //// $syndata['equip'][$key] = '0:0:0:0'; // $syndata['equip'][$key] = $prop_config['equip_views']; } //装备技能 if (!empty($prop['star_map_desc'])) { if (is_string($prop['star_map_desc'])) { $prop['star_map_desc'] = json_decode($prop['star_map_desc'], true); } if (isset($prop['star_map_desc']['activate']['skill'])) { $syndata['equip_skill'][$key] = $prop['star_map_desc']['activate']['skill']; } } } } //套装更新了 衣服的equip_view $fashion_fit = $player_detail['fashion_fit']; $fashion_info = $player_detail['fashion_info']; if ($fashion_fit) { $meditation_flag = isset($player_detail['player_settings'][34]) ? $player_detail['player_settings'][34] : 0; $fashions = Cache_Fashion::getInstance()->get_fashion(array_values($fashion_fit)); $now = time(); if ($meditation_flag == 0) { if (isset($fashion_fit[1])) { if ($fashion_info[$fashion_fit[1]]['timeliness'] > 0) { $timeliness = $fashion_info[$fashion_fit[1]]['timeliness'] - $now; if ($timeliness) { $syndata['equip'][3] = $fashions[$fashion_fit[1]]['equip_view']; } } else { $syndata['equip'][3] = $fashions[$fashion_fit[1]]['equip_view']; } } if (isset($fashion_fit[2])) { if ($fashion_info[$fashion_fit[2]]['timeliness'] > 0) { $timeliness = $fashion_info[$fashion_fit[2]]['timeliness'] - $now; if ($timeliness) { $syndata['equip'][0] = $fashions[$fashion_fit[2]]['equip_view']; } } else { $syndata['equip'][0] = $fashions[$fashion_fit[2]]['equip_view']; } } } } #获取泳装 $syndata['swim_suit'] = Cache_UnionSwim::getInstance()->get_swim_suit($playerInfo['career_type'], 0 + intval($playerInfo['vip'])); if ($playerInfo['level'] > 15) { #减轻玩家刚激活时候的压力 $hero_list = $this->get_data('PlayerHero')->get_fight_hero($player_id); if ($hero_list) { list($hero_id1, $hero_code1) = each($hero_list); if ($hero_id1) { $hero_info = $this->get_game('Hero')->get_player_hero_attr($player_id, $hero_id1); $syndata['hero_info'] = $hero_info; $syndata['hero_code'] = $hero_code1; $syndata['hero_state'] = 1; $syndata['hero_level'] = $hero_info['hero_level']; $syndata['hero_fit_level'] = $hero_info['fit']; } else { $syndata['hero_code'] = 0; $syndata['hero_state'] = 0; $syndata['hero_info'] = array(); $syndata['hero_fit_level'] = 0; } } list($hero_id2, $hero_code2) = each($hero_list); if ($hero_id2) { $after_hero_info = $this->get_game('Hero')->get_player_hero_attr($player_id, $hero_id2); $syndata['hero2_info'] = $after_hero_info; $syndata['hero2_code'] = $hero_code2; $syndata['hero2_state'] = 1; $syndata['hero2_level'] = $after_hero_info['hero_level']; $syndata['hero2_fit_level'] = $after_hero_info['fit']; } else { $syndata['hero2_code'] = 0; $syndata['hero2_state'] = 0; $syndata['hero2_info'] = array(); $syndata['hero2_fit_level'] = 0; } } else { $syndata['hero_code'] = 0; $syndata['hero_state'] = 0; $syndata['hero_info'] = array(); $syndata['hero_fit_level'] = 0; $syndata['hero2_code'] = 0; $syndata['hero2_state'] = 0; $syndata['hero2_info'] = array(); $syndata['hero2_fit_level'] = 0; } //竞技场信息 if ($playerInfo['level'] > 22) { #减轻玩家刚激活时候的压力 $my_arena_info = $this->get_data('KFArena')->get_kf_arena_info($player_id); } else { $my_arena_info = array(); } if (!empty($my_arena_info)) { $syndata['dw'] = $my_arena_info['dw']; $syndata['dw_lv'] = $my_arena_info['dw_lv']; $syndata['score'] = $my_arena_info['score']; $syndata['dw_star'] = $my_arena_info['dw_star']; } $syndata['city_id'] = empty($playerInfo['city_id']) ? 2100 : $playerInfo['city_id']; $syndata['city_x'] = empty($playerInfo['city_x']) ? 3382 : $playerInfo['city_x']; $syndata['city_y'] = empty($playerInfo['city_y']) ? 3538 : $playerInfo['city_y']; $task_data = $this->get_data('PlayerTask')->get_task_info($player_id); if ($task_data['main_val']) { list($task_id, $task_info) = each($task_data['main_val']); if ($task_info['target']) { $tar = reset($task_info['target']); $syndata['city_escort_map_sid'] = $tar['city_id']; $syndata['city_escort_target_x'] = $tar['pro_addr_x']; $syndata['city_escort_target_y'] = $tar['pro_addr_y']; $pro_npc = explode("|", $tar['pro_npc']); $syndata['city_escort_npc_sid'] = $pro_npc[0]; } $syndata['task_id'] = $task_id; $syndata['task_step'] = $task_info['step']; if ($task_info['task_status'] == 1) { $syndata['task_start_status'] = 1; } else { $syndata['task_start_status'] = 0; } } else { $syndata['city_escort_map_sid'] = 0; $syndata['city_escort_target_x'] = 0; $syndata['city_escort_target_y'] = 0; $syndata['city_escort_npc_sid'] = 0; } if ($player_detail['equip_wing'] && isset($player_detail['wing_info'][$player_detail['equip_wing']])) { $wing_table_task = Cache_PlayerWing::getInstance()->get_player_wing_data(array('id' => $player_detail['wing_info'][$player_detail['equip_wing']]['id'], 'level' => $player_detail['wing_info'][$player_detail['equip_wing']]['lvl'])); #$wing_table_task = $this->get_game('PlayerWing')->get_cache_table_data('player_wing_table', array('id' => $player_detail['wing_info'][$player_detail['equip_wing']]['id'], 'level' => $player_detail['wing_info'][$player_detail['equip_wing']]['lvl'])); $syndata['wing'] = $wing_table_task['avatar']; $syndata['wing_skill_id'] = intval($player_detail['wing_info'][$player_detail['equip_wing']]['skill_id'][0]); $syndata['wing_skill_id2'] = intval($player_detail['wing_info'][$player_detail['equip_wing']]['skill_id'][1]); $syndata['wing_skill_id3'] = intval($player_detail['wing_info'][$player_detail['equip_wing']]['skill_id'][2]); } else { $syndata['wing'] = ''; $syndata['wing_skill_id'] = 0; $syndata['wing_skill_id2'] = 0; $syndata['wing_skill_id3'] = 0; } $syndata['title_id'] = $playerInfo['title_id']; $player_settings = $player_detail['player_settings']; if (isset($player_settings[37]) && $player_settings[37] == 1) { $syndata['meditation_status'] = 1; } elseif (isset($player_settings[38]) && $player_settings[38] == 1) { $syndata['meditation_status'] = 2; } else { $syndata['meditation_status'] = 0; } $syndata['medal_id'] = intval($playerInfo['medal_id']); $syndata['like_times'] = intval($playerInfo['like_times']); $syndata['flowers'] = intval($playerInfo['flowers']); $syndata['union_id'] = intval($playerInfo['union_id']); $syndata['union_name'] = $playerInfo['union_name']; $syndata['union_job'] = $playerInfo['union_job']; $syndata['min_attack_interval'] = 0; //默认给0就好了 if ($playerInfo['level'] > 28) { $set = Cache_ActivityHall::getInstance()->get_Activity_set(4001); if (!empty($set)) { $used_athena_count = $this->get_game('Athena')->get_athena_remaining_count($player_id, 4001); #同步雅典娜次数给c++ $left_athena_num = $set[0]['max_times'] - $used_athena_count; if ($left_athena_num < 0) { $left_athena_num = 0; } $syndata['athena_remaining_count'] = $left_athena_num; } else { $syndata['athena_remaining_count'] = 0; } $set = Cache_ActivityHall::getInstance()->get_Activity_set(4011); if (!empty($set)) { $used_num = 0 + $this->get_data("PlayerDailyTime")->get_player_used_time($player_id, "world_boss_count"); #同步世界boss次数给c++ $left_worldboss_num = $set[0]['max_times'] - $used_num; if ($left_worldboss_num < 0) { $left_worldboss_num = 0; } $syndata['worldboss_remaining_count'] = $left_worldboss_num; } else { $syndata['worldboss_remaining_count'] = 0; } #神之试炼当前剩余次数 $syndata['trial_of_god_remaining_cnt'] = $this->get_game('Trial')->get_left_times($player_id); #抢矿当前剩余次数 $syndata['mineral_remaining_count'] = $this->get_game('GrabMine')->get_grabmine_remain_involved_num($player_id); #跨服切磋次数 $syndata['kf_3vs3_remaining_count'] = $this->get_game('KFDuel')->get_left_times($player_id); #毁灭奥克兰次数 $syndata['count_boss_oakland'] = 0 + $this->get_data("PlayerDailyTime")->get_player_used_time($player_id, "count_boss_oakland"); $syndata['count_monsters_oakland'] = 0 + $this->get_data("PlayerDailyTime")->get_player_used_time($player_id, "count_monsters_oakland"); $syndata['count_chest_oakland'] = 0 + $this->get_data("PlayerDailyTime")->get_player_used_time($player_id, "count_chest_oakland"); } else { $syndata['athena_remaining_count'] = 2; $syndata['worldboss_remaining_count'] = 2; $syndata['trial_of_god_remaining_cnt'] = 1; $syndata['mineral_remaining_count'] = 1; $syndata['kf_3vs3_remaining_count'] = 1; $syndata['count_boss_oakland'] = 0; $syndata['count_monsters_oakland'] = 0; $syndata['count_chest_oakland'] = 0; } if ($playerInfo['vip']) { $vip_info = $this->get_data('VipReward')->get_reward_log($player_id); $syndata['is_hidden_vip'] = isset($vip_info['is_hidden_vip']) ? $vip_info['is_hidden_vip'] : 0; } else { $syndata['is_hidden_vip'] = 0; } if ($playerInfo['privilege_level']) { #vip特权倒计时 $syndata['privilege_left_time'] = $this->get_game('VipSpecial')->get_left_time($player_id); } #已开启翅膀 $syndata['had_on_swings'] = $this->get_game('PlayerWing')->get_activation_wing_interface($player_id, $player_detail['wing_info']); // $syndata['wing'] = ""; // $syndata['wing_skill_id'] = 0; // var_dump($player_detail['wing_info']); # 魔法议会称号 $magic_plm_title_id = $this->get_game('MagicParliament')->get_magic_parliament_title_id($player_id); if (!empty($magic_plm_title_id)) { $title_conf = Cache_MagicParliament::getInstance()->get_title_conf($magic_plm_title_id); $syndata['magic_plm_title_buff_id'] = $title_conf['buff_id']; $syndata['magic_plm_title_buff_expire_time'] = $this->get_game('MagicParliament')->get_magic_parliamen_flush_time(); } else { $syndata['magic_plm_title_buff_id'] = 0; $syndata['magic_plm_title_buff_expire_time'] = 0; } $syndata['show_title'] = SHOW_TITLE; return $syndata; }