示例#1
0
 /**
  * @Purpose:
  * 获取玩家精灵列表
  * @Method Name: get_player_fairy_list()
  * @Parameter: $player_id 玩家ID
  * @Return: mixed 玩家精灵列表
  */
 public function get_player_fairy_list($player_id)
 {
     $data = array();
     $arr_player_fairy_id = $this->get_player_fairy_id($player_id);
     if (Com_Array::is_good_arr($arr_player_fairy_id)) {
         foreach ($arr_player_fairy_id as $id => $val) {
             $data[$id] = $this->Redis->hash_get($this->getKeys($this->keyPrefix, array('fairy_id' => $id)));
             $data[$id]['attr_lib_list'] = json_decode($data[$id]['attr_lib_list'], true);
             $data[$id]['combination_list'] = json_decode($data[$id]['combination_list'], true);
             $data[$id]['train_attr'] = json_decode($data[$id]['train_attr'], true);
         }
         return $data;
     } else {
         /*
         $cache_data = $this->build_cache($player_id);
         
         foreach ($cache_data as $key => $value)
         {
         	$value['attr_lib_list'] = $value['attr_lib_list'] ? json_decode($value['attr_lib_list'], true) : $value['attr_lib_list'];
         	$value['combination_list'] = $value['combination_list'] ? json_decode($value['combination_list'], true) : $value['combination_list'];
         	$data[$value['fairy_id']] = $value;
         }
         */
         return $data;
     }
 }
示例#2
0
 /**
  * 活动结算弹出面板清数据
  * @param unknown $player_id
  * @param unknown $union_id
  * @param unknown $total_exp
  * @return multitype:unknown number
  */
 public function total_bonfire_exp($player_id, $union_id, $rewards)
 {
     $err_code = 1;
     $union_id = intval($union_id);
     if (Com_Array::is_good_arr($rewards)) {
         /* $objPlayerData = $this->get_data('Player');
         			$player_union_id = $objPlayerData->get_player_info($player_id,"union_id");
         			if($player_union_id == $union_id){ */
         $objUnionBonfireData = $this->get_data('UnionBonfire');
         $unionBonfireInfo = $objUnionBonfireData->get_union_bonfire($union_id);
         $objUnionBonfireData->del_union_bonfire($union_id);
         foreach ($rewards as $val) {
             $role_id = $val[0];
             $total_exp = $val[1];
             $is_in_guild_territory = $val[2];
             $objUnionBonfireData->clear_bonfire_cd($role_id, 1);
             $objUnionBonfireData->clear_bonfire_cd($role_id, 2);
             $objUnionBonfireData->clear_bonfire_cd($role_id, 3);
             if ($is_in_guild_territory) {
                 $prop = array(1, intval($unionBonfireInfo['total_exp']));
                 Protocol::input($role_id, 8, 17, 1747, array($prop));
             }
         }
         $err_code = 0;
         //}
     }
     return array($err_code, $union_id);
 }
示例#3
0
 public function do_sys_msg($data)
 {
     if (empty($data)) {
         return;
     }
     $data = json_decode($data, true);
     $player_id = $data['player_id'];
     $content = $data['content'];
     $location = $data['location'];
     $location_type = $data['location_type'];
     $type = intval($data['type']);
     $value = intval($data['value']);
     $type2 = intval($data['type2']);
     $value2 = intval($data['value2']);
     $game_manager = $this->get_data('PlayerFriend')->get_game_manager();
     if (Com_Array::is_good_arr($game_manager)) {
         if (isset($game_manager[$player_id])) {
             return false;
         }
     }
     if ($type == 1 && $location_type == 7) {
         if ($player_id == 0) {
             return;
         }
         $player_info = $this->get_data('Player')->get_player_info($player_id, array('gm', 'union_id'));
         $value = $player_info['union_id'];
     }
     Protocol::input($player_id, 7, 4, 441, array($player_id, $location_type, $type, $value, $type2, $value2, $content, $location));
     if (!IS_FRONT) {
         Protocol::out();
     }
 }
示例#4
0
 public function get_gold_special($player_id, $field = null)
 {
     $data = $this->redis()->hash_get($this->get_adcache_key($player_id), $field);
     if (is_array($field) || empty($field)) {
         if (Com_Array::is_good_arr($data)) {
             foreach ($data as $key => $val) {
                 if (in_array($key, $this->_field)) {
                     if (is_array($this->_field[$key])) {
                         if ($data[$key]) {
                             $data[$key] = json_decode($data[$key], true);
                         } else {
                             $data[$key] = array();
                         }
                     }
                 }
             }
         }
     } else {
         if (!empty($field)) {
             if (in_array($field, $this->_field)) {
                 $data = json_decode($data, true);
             }
         }
     }
     return $data;
 }
示例#5
0
 /**
  * @Purpose:
  * 通知C++新一天的优先公会活动
  */
 public function refresh_new_union_activities_p2c()
 {
     #获取公会ID列表
     $union_id_list = $this->get_data('UnionInfo')->get_all_union_id();
     if (Com_Array::is_good_arr($union_id_list)) {
         foreach ($union_id_list as $union_id => $val) {
             #同步活动数据到C++
             $this->get_game('Union')->Sync_Union_msg($union_id, 0);
             Protocol::out();
         }
     }
 }
示例#6
0
 public function get_assistant_list()
 {
     $data = $this->get_data("Assistant")->get_assistant_list();
     $out = array();
     if (Com_Array::is_good_arr($data)) {
         foreach ($data as $val) {
             $item['id'] = $val['id'];
             $item['type'] = $val['type'];
             $item['content'] = $val['content'];
             $out[] = $item;
         }
     }
     return $out;
 }
示例#7
0
 /**
  * 公会勋章
  * @param unknown $player_id
  * @return multitype:number
  */
 public function get_union_medal($player_id)
 {
     $objPlayerData = $this->get_data('Player');
     $playerInfo = $objPlayerData->get_player_info($player_id, array("union_id"));
     $union_id = intval($playerInfo['union_id']);
     if ($union_id == 0) {
         $this->throw_error('171001');
         //该玩家未加入该公会
     }
     //已激活的勋章
     $objUnionInfoData = $this->get_data('UnionInfo');
     $union_medal = $objUnionInfoData->get_union_info($union_id, "union_medal");
     $union_medal = $union_medal ? $union_medal : array(1);
     //临时
     $medal_list = Cache_UnionMedal::getInstance()->get_union_medal_info();
     $data['medal_list'] = array();
     if (Com_Array::is_good_arr($medal_list)) {
         foreach ($medal_list as $val) {
             $item['sid'] = $val['sid'];
             $item['name'] = $val['name'];
             $status = 0;
             $progress_num = 0;
             $achieve_list = Cache_UnionAchieve::getInstance()->get_union_achieve_info(array("medal_id" => $val['sid']));
             if ($union_medal && in_array($val['sid'], $union_medal)) {
                 $status = 1;
                 $progress_num = count($achieve_list);
             } else {
                 foreach ($achieve_list as $achieve_val) {
                     $achieve_info = $this->get_data('UnionAchieve')->get_union_achieve_list($union_id, $achieve_val['sid']);
                     if ($achieve_info) {
                         if ($achieve_info['state'] == 1) {
                             $progress_num++;
                         }
                     }
                 }
             }
             $item['status'] = $status;
             $item['atk_min'] = $val['atk_min'];
             $item['hp'] = $val['max_hp'];
             $item['arm'] = $val['arm'];
             $item['progress_num'] = $progress_num;
             $item['total_num'] = count($achieve_list);
             $data['medal_list'][] = $item;
         }
     }
     $data['last_medal_id'] = array_pop($union_medal);
     //die(var_dump($data));
     return $data;
 }
 public function get_resource_fight_prop_loot($player_level = 0)
 {
     $common_drop = 0;
     $sql = "select * from {$this->table_name}";
     $list = $this->select_all($sql, $this->get_cache_key(array('resource_fight_prop_loot' => 'resource_fight_prop_loot')));
     if (Com_Array::is_good_arr($list)) {
         foreach ($list as $val) {
             if ($player_level < $val['level']) {
                 break;
             }
             $common_drop = $val['common_drop'];
         }
     }
     return $common_drop;
 }
示例#9
0
 public function receive_blue_diamond_package($player_id, $sid)
 {
     $sid = intval($sid);
     $this->blue_info = $this->get_blue_info($player_id);
     if ($this->blue_info['blue_vip_level'] < 1) {
         $this->throw_error('2328003', 5010067);
     }
     $package_config = Cache_TencentBlueSpecial::getInstance()->get_blue_item_by_sid($sid);
     if (!Com_Array::is_good_arr($package_config)) {
         $this->throw_error('10222', 5010069);
     }
     $player_info = $this->get_data('Player')->get_player_info($player_id, array('gold', 'level', 'vip', 'privilege_level', 'qq_blue_points'));
     if ($package_config['type'] == 1) {
         #每日礼包
         $receive_daily_reward = $this->get_data("PlayerDailyTime")->get_player_used_time($player_id, 'receive_blue_package_times');
         if ($receive_daily_reward) {
             $this->throw_error('2328001', 5010074);
         }
     } else {
         #积分礼包
         if (intval($player_info['qq_blue_points']) < $package_config['points']) {
             $this->throw_error('2328002', 5010079);
         }
     }
     $this->start_trans();
     $reward = $this->get_format_reward($package_config['reward']);
     $result = $this->get_game('Reward')->send_reward($player_id, $reward, array('cmd_id' => '2328'));
     if ($result !== true) {
         $this->throw_error($result);
     }
     #领取过每日礼包
     if ($package_config['type'] == 1) {
         $re = $this->get_data("PlayerDailyTime")->add_used_time($player_id, 'receive_blue_package_times', 1);
         $this->write_check($re, 5010104);
     } else {
         #扣蓝钻积分
         $cost_currency_value = $package_config['points'];
         $cost_currency_key = "qq_blue_points";
         $arr_consume = array();
         $this->get_data('Player')->check_player_resource($player_id, $player_info, '-', $cost_currency_key, $cost_currency_value);
         $re = $this->get_data('Player')->update_player_resource($player_id, $player_info, '2328', array(), $arr_consume);
         $this->write_check($re, 5010108);
     }
     $this->commit();
     $this->get_game('Reward')->add_reward_log();
     $out = array($sid, 1, intval($player_info['qq_blue_points']));
     return $out;
 }
示例#10
0
 /**
  * @Purpose:
  * 获取玩家英雄列表
  * @Method Name: get_player_hero_list()
  * @Parameter: $player_id 玩家ID
  * * @Parameter: $is_decode 是否进行字符串转数组操作
  * @Return: mixed 玩家英雄列表
  */
 public function get_player_hero_list($player_id, $is_decode = false)
 {
     $data = $this->get_player_hero_id($player_id);
     if ($is_decode) {
         if (Com_Array::is_good_arr($data)) {
             foreach ($data as $id => $val) {
                 if (!$val) {
                     unset($data[$id]);
                     continue;
                 }
                 //英雄数据格式转换
                 $data[$id] = json_decode($val, true);
             }
         }
     }
     return $data;
 }
示例#11
0
 /**
  * @Purpose:
  * 获取公会引导信息
  * @Param $player_id 玩家ID
  */
 public function get_union_guide_info($player_id)
 {
     $player_id = intval($player_id);
     #获取玩家公会ID,验证公会信息
     $union_id = $this->get_data('Player')->get_player_info($player_id, 'union_id');
     if ($union_id > 0) {
         #获取引导配置表
         $guide_table = $this->get_cache_table_data('guide_table', null);
         if (Com_Array::is_good_arr($guide_table)) {
             #获取玩家公会引导天数据
             $ug_data = $this->get_data('UnionGuide')->get_union_guide_info($player_id, 'ug', 'day');
             foreach ($guide_table as $guide) {
                 $rtn_data[] = array(intval($guide['type']), intval($guide['sub_type']), $guide['explain'], intval($ug_data[$guide['type'] . $guide['sub_type']]), intval($guide['func_jump']), intval($guide['npc_id']));
             }
         }
     }
     return $rtn_data ? $rtn_data : array();
 }
示例#12
0
 /**
  *
  * @param unknown $instant_ntf 0:提前通知 1:到点通知
  * @param unknown $type_id 活动id
  * @param unknown $category 玩法类型
  */
 public function activity_send_notice($player_id, $instant_ntf, $sid)
 {
     $player_id = intval($player_id);
     $instant_ntf = intval($instant_ntf);
     $sid = intval($sid);
     #{活动名}活动10分钟后开启,请广大玩家做好准备,海量丰厚奖励等着你!
     #{活动名}活动开启了,立刻参与,活动奖励轻松获得!
     $activity_info = Cache_ActivityHall::getInstance()->get_activity_info($sid);
     if (!Com_Array::is_good_arr($activity_info)) {
         return false;
     }
     $code = $activity_info['func_id'];
     $arrPushConfig = Cache_PushUpgrade::getInstance()->get_upgrade_info($code, $instant_ntf + 1);
     if (!Com_Array::is_good_arr($arrPushConfig)) {
         return false;
     }
     $replace_info = array();
     $replace_info[] = array('rep_type' => 7, 'txt' => $activity_info['name']);
     if ($arrPushConfig['go_name']) {
         $replace_info[] = array('rep_type' => 1, 'rep_val' => $code, 'txt' => strval($arrPushConfig['go_name']));
     } else {
         $replace_info[] = array('rep_type' => 7, 'txt' => '');
     }
     $msg = Language_Message::make_message($arrPushConfig['code'], $replace_info, 0, '', true);
     $this->get_game('SystemNotice')->send_system_msg($player_id, $msg, $arrPushConfig['need_broadcas'], 1, 2, $sid);
 }
示例#13
0
 public function doAction()
 {
     $userInfo_json = base64_decode($_POST['data']);
     $userInfo_array = json_decode($userInfo_json, true);
     $activity = $userInfo_array['activity'];
     //#处理倍率活动
     if (isset($activity['ratio'])) {
         #防止活动ID 冲突
         $status = true;
         // 			$event_master_info=array();
         // 			$event_master_info["event_id"] = $activity['id']+100000;
         // 			#
         // 			$event_master_info["event_type"]=1;
         // 			$event_master_info["event_topic"]=0;
         // 			$event_master_info["event_tag"]=2;#倍率活动2
         // 			$event_master_info["event_template"]=0;
         // 			$event_master_info["event_importance"]=0;
         // 			$event_master_info["event_recommend_flag"]=0;
         // 			$event_master_info["event_priority"]=0;
         // 			$event_master_info["event_reward_cycle"]=0;
         // 			$event_master_info["event_reward_stint"]=0;
         // 			$event_master_info["event_status"]=1;#1表示上线
         // 			$event_master_info["week_frequency"]=0;
         // 			$event_master_info["announce_date_head"]=strtotime($activity['start_time_str']);
         // 			$event_master_info["open_date_head"]=0;
         // 			$event_master_info["open_date_tail"]=0;
         // 			$event_master_info["announce_date_tail"]=strtotime($activity['end_time_str']);
         // 			$event_master_info["reward_date_head"]=0;
         // 			$event_master_info["reward_date_tail"]=0;
         // 			$event_master_info["reg_date"]=time();
         // 			$event_master_info["mod_date"]=time();
         // 			$event_master_info["event_jump_btn_type"]=0;
         // 			$event_master_info["event_jump_btn_target"]=0;
         // 			$event_master_info["event_jump_btn_res"]=0;
         // 			$event_master_info["event_title"]="";
         // 			$event_master_info["event_comment"]="";
         // 			$event_master_info["event_desc"]="";
         // 			$event_master_info["event_desc_res"]="";
         // 			$event_master_info["event_title_res"]="";
         // 			$event_master_info["event_title_bg_res"]="";
         // 			$event_master_info["event_ad_res"]="";
         // 			$event_master_info["event_reward_info"]="";
         // 			$result = $this->get_data('Event')->replace_into_event_master($event_master_info);
         // 			if(!$result){
         // 				$status = false;
         // 			}
         #插入倍率表
         $event_ratio_info = array();
         $event_ratio_info["event_id"] = $activity["activity_a_id"];
         $event_ratio_info["ratio_type"] = 1;
         $event_ratio_info["relate_cmd2"] = $activity['activity_action_id'];
         $ratio_arr = explode("|", $activity['ratio']);
         foreach ($ratio_arr as $ra) {
             $ra_t = explode(":", $ra);
             $ra_r[] = $ra_t[1];
             #资源
             $ra_v = $ra_t[2];
             #赔率
         }
         $event_ratio_info["relate_item_id"] = implode(":", $ra_r);
         $vip_arr = range($activity['vip_start_level'], $activity['vip_end_level']);
         foreach (range(0, 10) as $k) {
             if (in_array($k, $vip_arr)) {
                 $vip_t[] = $k . ":" . $ra_v * 10000;
             } else {
                 $vip_t[] = $k . ":10000";
             }
         }
         // 			foreach (range($activity['vip_start_level'],$activity['vip_end_level']) as $k){
         // 				$vip_t[] = $k.":".($ra_v*10000);
         // 			}
         $event_ratio_info["relate_ratio"] = implode("|", $vip_t);
         #
         $result = $this->get_data('Event')->replace_into_event_ratio($event_ratio_info);
         if (!$result) {
             $status = false;
         }
         if ($status) {
             echo json_encode(array('status' => 1, 'data' => "success"));
         } else {
             echo json_encode(array('status' => 0, 'data' => 'fail'));
         }
         return true;
     }
     //奖励
     $reward = Com_Array::is_good_arr($userInfo_array['activity']['reward']) ? $userInfo_array['activity']['reward'] : array();
     $tmp_reward_id = array();
     $status = true;
     foreach ($reward as $r_item) {
         $event_reward_master_info = array();
         $event_reward_master_info["reward_id"] = $r_item['id'];
         $tmp_reward_id[] = $r_item['id'];
         #活动中用
         $event_reward_master_info["activity_id"] = $activity['id'];
         $event_reward_master_info["reward_type"] = $r_item['button_type'];
         $event_reward_master_info["reward_priority"] = 0;
         # 奖励优先度级别,排序用
         $event_reward_master_info["reward_billing_cycle"] = 0;
         #需要计算reward_type,type_value
         $event_reward_master_info["reward_gain_cycle"] = $r_item['type_value'];
         #重复计算的
         $event_reward_master_info["reward_gain_stint"] = $r_item['type_times'];
         $event_reward_master_info["valid_date_head"] = !empty($r_item['start_time']) ? $r_item['start_time'] : 0;
         $event_reward_master_info["valid_date_tail"] = !empty($r_item['end_time']) ? $r_item['end_time'] : 0;
         $event_reward_master_info["valid_date_head"] = $this->changetime($event_reward_master_info["valid_date_head"]);
         $event_reward_master_info["valid_date_tail"] = $this->changetime($event_reward_master_info["valid_date_tail"]);
         if (!empty($activity['type_value'])) {
             $event_reward_master_info["valid_date_flag"] = 1;
             $r_item['reward_type'] = 0;
             $event_reward_master_info["valid_date_head"] = (int) (date('H', $event_reward_master_info["valid_date_head"]) * 3600) + (int) (date('i', $event_reward_master_info["valid_date_head"]) * 60) + (int) date('s', $event_reward_master_info["valid_date_head"]);
             $event_reward_master_info["valid_date_tail"] = (int) (date('H', $event_reward_master_info["valid_date_tail"]) * 3600) + (int) (date('i', $event_reward_master_info["valid_date_tail"]) * 60) + (int) date('s', $event_reward_master_info["valid_date_tail"]);
         } else {
             $event_reward_master_info["valid_date_flag"] = 0;
         }
         if ($r_item['reward_type'] == 0) {
             $event_reward_master_info["reward_gain_cycle"] = $event_reward_master_info["valid_date_tail"] - $event_reward_master_info["valid_date_head"];
         }
         if ($r_item['reward_type'] == 1) {
             // 			$event_master_info["event_reward_stint"] =86400;
             $event_reward_master_info["reward_gain_cycle"] = 86400;
         }
         if ($r_item['reward_type'] == 2) {
             $event_reward_master_info["reward_gain_cycle"] = 7 * 86400;
         }
         $event_reward_master_info["cond_func_relation"] = $r_item['relation'];
         foreach ($event_reward_master_info as $k => $v) {
             if (empty($event_reward_master_info[$k])) {
                 $event_reward_master_info[$k] = 0;
             }
         }
         //转换函数格式
         $tmp_func_content = explode(",", $r_item['func_content']);
         $tmp_func_content_arr = array();
         foreach ($tmp_func_content as $v) {
             $tmp_func_content_t = "";
             $tmp_func_content_t = str_replace("#", ":", $v);
             $tmp_func_content_t = str_replace("|", ",", $tmp_func_content_t);
             $tmp_func_content_arr[] = $tmp_func_content_t;
         }
         $event_reward_master_info["cond_func"] = implode("|", $tmp_func_content_arr);
         $event_reward_master_info["cond_desc"] = $r_item['cond_desc'];
         #处理奖励中的魔晶
         $tmp_reward_arr = explode("|", $r_item['reward']);
         $tmp_reward_arr = empty($tmp_reward_arr) ? array() : $tmp_reward_arr;
         for ($i = 0; $i < count($tmp_reward_arr); $i++) {
             $tmp_r_arr = explode(":", $tmp_reward_arr[$i]);
             if ($tmp_r_arr[0] == 15) {
                 $tmp_r_arr[0] = 13;
             }
             if ($tmp_r_arr[0] == 16) {
                 $tmp_r_arr[0] = 14;
             }
             $tmp_reward_arr[$i] = implode(":", $tmp_r_arr);
         }
         $r_item['reward'] = implode("|", $tmp_reward_arr);
         #
         #处理奖励中的魔晶
         $tmp_cost_arr = explode("|", $r_item['cost']);
         $tmp_cost_arr = empty($tmp_cost_arr) ? array() : $tmp_cost_arr;
         for ($i = 0; $i < count($tmp_cost_arr); $i++) {
             $tmp_r_arr = explode(":", $tmp_cost_arr[$i]);
             if (isset($tmp_r_arr[2])) {
                 unset($tmp_r_arr[2]);
             }
             if ($tmp_r_arr[0] == 15) {
                 $tmp_r_arr[0] = 13;
             }
             if ($tmp_r_arr[0] == 16) {
                 $tmp_r_arr[0] = 14;
             }
             $tmp_cost_arr[$i] = implode(":", $tmp_r_arr);
         }
         $r_item['cost'] = implode("|", $tmp_cost_arr);
         #
         $event_reward_master_info["reward_info"] = $r_item['reward'];
         $event_reward_master_info["consume_info"] = $r_item['cost'];
         $event_reward_master_info["announce_content"] = $r_item['send_msg'];
         foreach ($event_reward_master_info as $k => $v) {
             $event_reward_master_info[$k] = addslashes($v);
         }
         $result = $this->get_data('Event')->replace_into_event_reward_master($event_reward_master_info);
         if (!$result) {
             $status = false;
         }
     }
     $event_master_info = array();
     $event_master_info["week_frequency"] = 0;
     #type_value
     if (!empty($activity['type_value'])) {
         $type_value_arr = explode(",", $activity['type_value']);
         $tmp_week = "";
         for ($i = 1; $i < 7; $i++) {
             if (in_array($i, $type_value_arr)) {
                 $tmp_week .= "1";
             } else {
                 $tmp_week .= "0";
             }
         }
         if (in_array(7, $type_value_arr)) {
             $tmp_week = "1" . $tmp_week;
         } else {
             $tmp_week = "0" . $tmp_week;
         }
         $event_master_info["week_frequency"] = $tmp_week;
     }
     $event_master_info["event_id"] = $activity['id'];
     $o_event = $this->get_data("Event")->get_event_info($activity['id']);
     if (!empty($o_event)) {
         $event_master_info["reg_date"] = $o_event["reg_date"];
     } else {
         $event_master_info["reg_date"] = time();
     }
     $event_master_info["event_type"] = $activity['activity_type'];
     $event_master_info["event_topic"] = $activity['activity_group_id'];
     $event_master_info["event_tag"] = $activity['activity_tag'];
     #新建字段
     $event_master_info["event_template"] = $activity['tpl_id'];
     $event_master_info["event_importance"] = !empty($activity['hot']) ? (int) $activity['hot'] - 1 : 0;
     $event_master_info["event_recommend_flag"] = (int) $activity['hot'];
     $event_master_info["event_priority"] = $activity['sort'];
     #和event_importance有争议
     $event_master_info["event_reward_cycle"] = 0;
     #需要计算reward_type,type_value
     $event_master_info["event_billing_cycle"] = 0;
     #需要计算reward_type,type_value
     $event_master_info["event_status"] = $activity['status'];
     $event_master_info["announce_date_head"] = !empty($activity['panel_stime']) ? $activity['panel_stime'] : 0;
     $event_master_info["open_date_head"] = !empty($activity['start_time']) ? $activity['start_time'] : 0;
     $event_master_info["open_date_tail"] = !empty($activity['end_time']) ? $activity['end_time'] : 0;
     $event_master_info["announce_date_tail"] = !empty($activity['panel_etime']) ? $activity['panel_etime'] : 0;
     $event_master_info["reward_date_head"] = !empty($activity['start_get_time']) ? $activity['start_get_time'] : 0;
     $event_master_info["reward_date_tail"] = !empty($activity['end_get_time']) ? $activity['end_get_time'] : 0;
     $event_master_info["announce_date_head"] = $this->changetime($event_master_info["announce_date_head"]);
     $event_master_info["open_date_head"] = $this->changetime($event_master_info["open_date_head"]);
     $event_master_info["open_date_tail"] = $this->changetime($event_master_info["open_date_tail"]);
     $event_master_info["announce_date_tail"] = $this->changetime($event_master_info["announce_date_tail"]);
     $event_master_info["reward_date_head"] = $this->changetime($event_master_info["reward_date_head"]);
     $event_master_info["reward_date_tail"] = $this->changetime($event_master_info["reward_date_tail"]);
     if (!empty($activity['type_value'])) {
         #周期活动
         $event_master_info["announce_date_head"] = (int) (date('H', $event_master_info["announce_date_head"]) * 3600) + (int) (date('i', $event_master_info["announce_date_head"]) * 60) + (int) date('s', $event_master_info["announce_date_head"]);
         $event_master_info["open_date_head"] = (int) (date('H', $event_master_info["open_date_head"]) * 3600) + (int) (date('i', $event_master_info["open_date_head"]) * 60) + (int) date('s', $event_master_info["open_date_head"]);
         $event_master_info["open_date_tail"] = (int) (date('H', $event_master_info["open_date_tail"]) * 3600) + (int) (date('i', $event_master_info["open_date_tail"]) * 60) + (int) date('s', $event_master_info["open_date_tail"]);
         $event_master_info["announce_date_tail"] = (int) (date('H', $event_master_info["announce_date_tail"]) * 3600) + (int) (date('i', $event_master_info["announce_date_tail"]) * 60) + (int) date('s', $event_master_info["announce_date_tail"]);
         $event_master_info["reward_date_head"] = (int) (date('H', $event_master_info["reward_date_head"]) * 3600) + (int) (date('i', $event_master_info["reward_date_head"]) * 60) + (int) date('s', $event_master_info["reward_date_head"]);
         $event_master_info["reward_date_tail"] = (int) (date('H', $event_master_info["reward_date_tail"]) * 3600) + (int) (date('i', $event_master_info["reward_date_tail"]) * 60) + (int) date('s', $event_master_info["reward_date_tail"]);
         $activity['reward_type'] = 0;
     }
     //领奖周期和次数
     if ($activity['reward_type'] == 0) {
         $event_master_info["event_reward_cycle"] = $event_master_info["reward_date_tail"] - $event_master_info["reward_date_head"];
     }
     if ($activity['reward_type'] == 1) {
         // 			$event_master_info["event_reward_stint"] =86400;
         $event_master_info["event_reward_cycle"] = 86400;
     }
     if ($activity['reward_type'] == 2) {
         $event_master_info["event_reward_cycle"] = 7 * 86400;
     }
     $event_master_info["event_reward_stint"] = (int) $activity['type_times'];
     //领奖周期
     $event_master_info["mod_date"] = time();
     $event_master_info["event_jump_btn_type"] = $activity['url_type'];
     foreach ($event_master_info as $k => $v) {
         if (empty($event_master_info[$k])) {
             $event_master_info[$k] = 0;
         }
     }
     $event_master_info["event_jump_btn_target"] = $activity['target_id'];
     $event_master_info["event_jump_btn_res"] = $activity['button_pic'];
     $event_master_info["event_title"] = $activity['name'];
     $event_master_info["event_desc"] = $activity['desc_info'];
     $event_master_info["event_desc_res"] = $activity['ad_large_pic1'];
     #活动内容图片
     $event_master_info["event_title_res"] = $activity['title_pic'];
     $event_master_info["event_title_bg_res"] = $activity['title_bg_pic'];
     #标题背景图
     if ($event_master_info["event_importance"] == 1) {
         $event_master_info["event_ad_res"] = $activity['ad_large_pic'];
         #广告大小图
     } else {
         $event_master_info["event_ad_res"] = $activity['ad_small_pic'];
         #广告大小图
     }
     $event_master_info["event_reward_info"] = implode(":", $tmp_reward_id);
     $event_master_info["event_comment"] = $activity['activity_comment'];
     foreach ($event_master_info as $k => $v) {
         $event_master_info[$k] = addslashes($v);
     }
     $result = $this->get_data('Event')->replace_into_event_master($event_master_info);
     if (!$result) {
         $status = false;
     }
     if ($status) {
         echo json_encode(array('status' => 1, 'data' => "success"));
     } else {
         echo json_encode(array('status' => 0, 'data' => 'fail'));
     }
 }
示例#14
0
 /**
  * @Purpose:
  * 格式化配置表字段,拆分指定格式数据
  * @Param $field 数据字段
  * @Return 返回数组
  */
 private function format_table_field($field)
 {
     $rtn_data = array();
     $data = explode("|", $field);
     if (Com_Array::is_good_arr($data)) {
         foreach ($data as $second_layer) {
             list($type, $value) = explode(":", $second_layer);
             $rtn_data[$type] = $value;
         }
     } else {
         list($type, $value) = explode(":", $data);
         $rtn_data[$type] = $value;
     }
     return $rtn_data;
 }
示例#15
0
 /**
  * @Purpose:
  * 数据修复检测
  */
 public function data_repair($player_id, &$fb_data)
 {
     if (!empty($fb_data)) {
         if ($fb_data['repair_flag'] == 0) {
             if (!empty($fb_data['chapter_star']) && Com_Array::is_good_arr($fb_data['chapter_star'])) {
                 $star_num = array_sum($fb_data['chapter_star']);
                 if ($star_num > 0) {
                     $this->get_data('RankList')->update_main_dungeon_rank($player_id, $star_num);
                 }
             }
             $fb_data['repair_flag'] = 1;
         }
     }
 }
示例#16
0
 public function get_allow_join_union_list($limit = 18, $scoreMin = 26, $scoreMax = 999)
 {
     $limit = intval($limit) > 50 ? 50 : $limit;
     $nowtime = time();
     $data = array("player_list" => array(), "now_time" => $nowtime);
     $start = 1;
     for ($start = 1; $start <= 5; $start++) {
         #等级范围内的玩家
         $level_list = $this->get_data("Player")->get_no_union_player($scoreMin, $scoreMax, $start, $limit);
         if (Com_Array::is_good_arr($level_list)) {
             foreach ($level_list as $player_id) {
                 #无公会玩家
                 $player_info = $this->get_data("Player")->get_player_info($player_id, array("vip", "union_id", "player_id", "name", "level", "is_online", "login_time", "career_type", "sum_fpower"));
                 if (intval($player_info['union_id']) == 0) {
                     $is_hidden_vip = 0;
                     if (intval($player_info['vip']) > 0) {
                         $vip_info = $this->get_data('VipReward')->get_reward_log($player_id);
                         $is_hidden_vip = $vip_info['is_hidden_vip'];
                     }
                     $data['player_list'][$player_id] = array("player_id" => $player_info["player_id"], "name" => $player_info["name"], "level" => $player_info["level"], "is_online" => $player_info["is_online"], "login_time" => $player_info["login_time"], "career_type" => $player_info["career_type"], "sum_fpower" => $player_info["sum_fpower"], "vip" => intval($player_info["vip"]), "is_hidden_vip" => $is_hidden_vip);
                 }
                 if (count($data['player_list']) >= $limit) {
                     break;
                 }
             }
         }
     }
     return $data;
 }
示例#17
0
 /**
  * 备份一周排行
  */
 public function sync_week_rank()
 {
     $pub_day = $this->get_data('NewServerActivity')->get_server_day();
     if ($pub_day == 8) {
         //Com_Log::write('zzzzwang','week_rank:'.date('Y-m-d H:i:s'));
         for ($i = 1; $i <= 3; $i++) {
             $data = $this->get_now_rank($i);
             if (Com_Array::is_good_arr($data["rank_list"])) {
                 $this->get_data("NewServerActivity")->update_rank_server_week($i, $data["rank_list"]);
             }
         }
     }
 }
示例#18
0
 public static function get_hero_potential_panel_struct($data)
 {
     if (Com_Array::is_good_arr($data['potential_info'])) {
         //格式化技能信息列表
         foreach ($data['potential_info'] as $key => $val) {
             $data['potential_info'][$key] = self::get_hero_potential_info_struct($val);
         }
     }
     return array(0 => intval($data['potential_level']), 1 => intval($data['level_max']), 2 => intval($data['potential_per']), 3 => $data['potential_info'] ? $data['potential_info'] : array());
 }
示例#19
0
 /**
  * 获取专属英雄
  * @param unknown $player_id
  * @param unknown $func_id
  */
 public function get_gold_special($player_id, $type = 0)
 {
     $this->yellow_info = $this->get_yellow_info($player_id);
     $yellow_vip_level = $this->yellow_info['yellow_vip_level'];
     $type = intval($type);
     $special_config = Cache_GoldSpecial::getInstance()->get_gold_special_by_type($type);
     if (!Com_Array::is_good_arr($special_config)) {
         $this->throw_error('10222', 5010208);
     }
     $is_allow_receive = 0;
     $title_info = array();
     if ($yellow_vip_level > 0) {
         if ($type == $this->_special_hero_type) {
             #英雄是否已领取
             $is_allow_receive = 1;
             $is_receive_hero = $this->get_data("GoldSpecial")->get_gold_special($player_id, 'is_receive_hero');
             if ($is_receive_hero) {
                 $is_allow_receive = 2;
             }
         } else {
             $this->throw_error('10222', 5010221);
         }
     }
     $out = array("reward" => $special_config[0]['reward'], "is_allow_receive" => $is_allow_receive, "vip_level" => $special_config[0]['vip_level'], "type" => $type);
     return $out;
 }
示例#20
0
 /**
  * C++服务器向PHP服务器发送玩家副本通关奖励请求,
  * PHP服务器根据地图ID和评价分数给予相对应的奖励
  */
 public function CMD2_404()
 {
     $time_start = microtime(true);
     #计算时间
     if ($this->get_game('PlayerPVE')->is_pve_fb($this->_param[5])) {
         //挑战副本
         $res = array();
         $player_id = $this->_param[0][0];
         if ($this->_param[3] == 1) {
             //通关更新
             $res['type'] = 1;
             //通关成功
             $data = $this->get_game('PlayerPVE')->update_pev_passed($player_id, $this->_param[5], $this->_param[6], $this->_param[4], $this->_param[7], $this->_param[8], $this->_param[9]);
             #$reward=array();
             $reward = $data['exp_reward'];
             if (isset($this->_param[6]) && is_array($this->_param[6]) && count($this->_param[6]) > 0) {
                 //有邀请好友
                 $rewards = $this->get_game('PlayerPVE')->share_reward($player_id, $this->_param[6][0], $reward);
                 if (count($rewards)) {
                     //发送奖励
                     $result = $this->get_game('Reward')->send_reward($player_id, $rewards['player'], array('cmd_id' => '4042'), 1);
                     if ($result) {
                         $this->get_game('Reward')->add_reward_log();
                         //记录日志
                         $prop_log = $this->get_game('Reward')->get_prop_log();
                         $res['reward'] = $this->get_game('PlayerPVE')->reset_reward($reward, $prop_log, $player_id);
                     } else {
                         $res['type'] = 0;
                         //通关成功
                     }
                 }
             } else {
                 $result = $this->get_game('Reward')->send_reward($player_id, $reward, array('cmd_id' => '4042'), 1);
                 if ($result === true) {
                     $this->get_game('Reward')->add_reward_log();
                     //记录日志
                     $prop_log = $this->get_game('Reward')->get_prop_log();
                     $res['reward'] = $this->get_game('PlayerPVE')->reset_reward($reward, $prop_log, $player_id);
                 } else {
                     $res['type'] = 0;
                     //通关失败
                 }
             }
         } else {
             $res['type'] = 0;
             //通关失败
         }
         Protocol::input($player_id, 8, 8, 836, $res);
         //回给C++的空数据,以免报错
         Protocol::input($player_id, 5, 4, 404, $c_data);
     } else {
         if ($this->get_game('UnionWanted')->is_wanted_fb($this->_param[5])) {
             $data = $this->get_game('UnionWanted')->fb_reward($this->_param[0], $this->_param[3], $this->_param[5]);
             if ($data) {
                 Protocol::input($this->_param[0][0], 8, 17, 1760, $data);
             }
             Protocol::input($this->_authuser['player_id'], 5, 4, 404, $c_data);
         } else {
             if ($this->get_game('PlayerFB')->is_egg_active_fb($this->_param[5])) {
                 #$this->_param[0] = array($this->_param[0]);$this->_param[1] = array($this->_param[1]);
                 $data = $this->get_game('PlayerFB')->egg_fb_reward($this->_param[0][0], $this->_param[1][0], $this->_param[2][0], $this->_param[3], $this->_param[5]);
                 if (!empty($data)) {
                     Protocol::input($this->_param[0][0], 8, 11, 1138, $data);
                 }
                 Protocol::input($this->_authuser['player_id'], 5, 4, 404, $c_data);
             } else {
                 if ($this->get_game('TaskHandler')->is_daily_task_fb($this->_param[5])) {
                     $result = array('result' => $this->_param[3]);
                     Protocol::input($this->_param[0][0], 8, 10, 1017, $result);
                     # 回给C++的空数据,以免报错
                     Protocol::input($player_id, 5, 4, 404, $c_data);
                 } else {
                     if ($this->get_game('PlayerFB')->is_random_fb($this->_param[5])) {
                         if ($this->_param[3] == 1) {
                             $this->get_game('PlayerFB')->update_task($this->_param[0][0], $this->_param[5]);
                         }
                         $result = array('result' => $this->_param[3]);
                         Protocol::input($this->_param[0][0], 8, 10, 1017, $result);
                         # 回给C++的空数据,以免报错
                         Protocol::input($player_id, 5, 4, 404, $c_data);
                     } else {
                         #$this->_param[0] = array($this->_param[0]);$this->_param[1] = array($this->_param[1]);
                         //主线副本
                         $data = $this->get_game('PlayerFB')->fb_reward_req_s2p($this->_param[0], $this->_param[1], $this->_param[2], $this->_param[3], $this->_param[4], $this->_param[5]);
                         if (is_array($this->_param[0])) {
                             if (Com_Array::is_good_arr($data)) {
                                 foreach ($data as $keys => $val) {
                                     Protocol::input($val[0], 8, 8, 811, $val);
                                 }
                             }
                             //回给C++的空数据,以免报错
                             Protocol::input($this->_authuser['player_id'], 5, 4, 404, $c_data);
                         }
                     }
                 }
             }
         }
     }
     $cost_time = microtime(true) - $time_start;
     file_put_contents(LOG_PATH . "/cmd2_404", "cost_time:{$cost_time}" . var_export($this->_param, true) . " \n", FILE_APPEND);
     $player_info = $this->get_data('Player')->get_player_info($this->_param[0][0], array('level', 'vip', 'ad_info', 'career_type'));
 }
示例#21
0
 /**
  * 获取玩家基础属性
  *
  * @param unknown_type $player_id
  * @return unknown
  */
 protected function get_player_base_attr($player_id, $calc_buff_attr)
 {
     if (is_null($this->_playerItem)) {
         $this->_playerItem = $this->get_data('Player')->get_player_info($player_id);
     }
     $this->_player = $this->_playerItem;
     if (empty($this->_player)) {
         //玩家不存在
         $this->_player = '20001';
         return false;
     }
     if (empty($this->_playerDetailItem)) {
         $this->_playerDetailItem = $this->get_data('PlayerDetail')->get_player_detail($this->_player['player_id']);
     }
     //基础属性
     //        $baseAttrData = $this->_playerDetailItem['base_attr'];
     //        if(isset($baseAttrData['base_attr'])) $baseAttrData=$baseAttrData['base_attr']; //先这样写有的数据错了等可以清空数据库了 删除
     //        if (is_array($baseAttrData)) {
     //            foreach ($baseAttrData as $key=>$value) {
     //                $this->_player[$key] += $value;
     //            }
     //        }
     $baseAttrData = $this->getInitPlayerAttrData($this->_player['career_type']);
     if (is_array($baseAttrData)) {
         foreach ($baseAttrData as $key => $value) {
             $this->_player[$key] += $value;
             //                    if($key == 'atk_min'){
             //                        Com_Log::write('player_attr_atk_'.$this->_player['player_id'],"base {$value}");
             //                    }
         }
     }
     $this->_player['atk_min'] = $this->_player['atk_max'] = Formula_Player::get_upgrade_atk($this->_player['atk_min'], $this->_player['level']);
     //        Com_Log::write('player_attr_atk_'.$this->_player['player_id'],"atk_min {$this->_player['atk_min']}");
     $this->_player['arm'] = $this->_player['arm'] = Formula_Player::get_upgrade_arm($this->_player['arm'], $this->_player['level']);
     $this->_player['hp'] = $this->_player['hp'] = Formula_Player::get_upgrade_hp($this->_player['hp'], $this->_player['level']);
     if ($this->_player['map_id'] == 2100) {
         $this->_player['atk_min'] += 500;
         #策划要求序章攻击加500
     }
     $equip_move_speed = 0;
     if (!empty($this->_playerDetailItem['equip_attr'])) {
         foreach ($this->_playerDetailItem['equip_attr'] as $key => $value) {
             if ($key == 'move_speed') {
                 $equip_move_speed = $value;
             } else {
                 $this->_player[$key] += $value;
             }
         }
     }
     if (!empty($this->_playerDetailItem['fairy_attr_1'])) {
         foreach ($this->_playerDetailItem['fairy_attr_1'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['fairy_attr_2'])) {
         foreach ($this->_playerDetailItem['fairy_attr_2'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['fashion_attr'])) {
         foreach ($this->_playerDetailItem['fashion_attr'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['union_achieve_attr'])) {
         foreach ($this->_playerDetailItem['union_achieve_attr'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['achieve_attr_1'])) {
         foreach ($this->_playerDetailItem['achieve_attr_1'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['achieve_attr_2'])) {
         foreach ($this->_playerDetailItem['achieve_attr_2'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     # 培养属性加成
     if (!empty($this->_playerDetailItem['train_attr_info']) && is_array($this->_playerDetailItem['train_attr_info'])) {
         foreach ($this->_playerDetailItem['train_attr_info'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     # --------------------------------------------------------------------
     # 培养套装激活效果计算
     # --------------------------------------------------------------------
     $train_set_attr_addition = $this->get_game('Train')->get_player_train_set_attr_addition($this->_player['player_id'], $this->_playerItem, $this->_playerDetailItem);
     # 培养套装加成信息
     if (!empty($train_set_attr_addition)) {
         foreach ($train_set_attr_addition as $attr_key => $attr_val) {
             if (!is_numeric($attr_key)) {
                 # 忽略技能等级的加成
                 $this->_player[$attr_key] += $attr_val;
             }
         }
     }
     # --------------------------------------------------------------------
     #---------------------------------------------------------------------
     #翅膀属性
     #---------------------------------------------------------------------
     if (!empty($this->_playerDetailItem['equip_wing'])) {
         $wing_attr = $this->_playerDetailItem['wing_info'][$this->_playerDetailItem['equip_wing']];
         $addition = 0;
         $attr_addition = array();
         if ($this->_playerDetailItem['equip_wing'] == 7) {
             if (isset($this->_playerDetailItem['wing_info'][8]) && $this->_playerDetailItem['wing_info'][8]['activation'] == 2) {
                 $add_config = Cache_WingAddition::getInstance()->get_wing_addition($this->_playerDetailItem['wing_info'][8]['lvl']);
                 $addition = $add_config['addition'] / 10000;
                 $attr_addition = $this->_playerDetailItem['wing_info'][8]['attr'];
                 if (!empty($this->_playerDetailItem['wing_info'][8]['equip_attr']) && Com_Array::is_good_arr($this->_playerDetailItem['wing_info'][8]['equip_attr'])) {
                     foreach ($this->_playerDetailItem['wing_info'][8]['equip_attr'] as $attr_type => $attr_val) {
                         $attr_addition[$attr_type] += ceil($attr_val);
                     }
                 }
                 foreach ($attr_addition as $attr_type => $attr_val) {
                     $attr_addition[$attr_type] = $attr_val * $addition;
                 }
             }
         }
         if ($this->_playerDetailItem['equip_wing'] == 8) {
             if (isset($this->_playerDetailItem['wing_info'][7]) && $this->_playerDetailItem['wing_info'][7]['activation'] == 2) {
                 $add_config = Cache_WingAddition::getInstance()->get_wing_addition($this->_playerDetailItem['wing_info'][7]['lvl']);
                 $addition = $add_config['addition'] / 10000;
                 $attr_addition = $this->_playerDetailItem['wing_info'][7]['attr'];
                 if (!empty($this->_playerDetailItem['wing_info'][7]['equip_attr']) && Com_Array::is_good_arr($this->_playerDetailItem['wing_info'][7]['equip_attr'])) {
                     foreach ($this->_playerDetailItem['wing_info'][7]['equip_attr'] as $attr_type => $attr_val) {
                         $attr_addition[$attr_type] += ceil($attr_val);
                     }
                 }
                 foreach ($attr_addition as $attr_type => $attr_val) {
                     $attr_addition[$attr_type] = $attr_val * $addition;
                 }
             }
         }
         $w_attr = array();
         if (!empty($wing_attr['attr'])) {
             foreach ($wing_attr['attr'] as $key => $value) {
                 $w_attr[$key] += $value;
             }
         }
         if (!empty($wing_attr['equip_attr'])) {
             foreach ($wing_attr['equip_attr'] as $key => $value) {
                 $w_attr[$key] += $value;
             }
         }
         if (!empty($attr_addition)) {
             foreach ($attr_addition as $key => $value) {
                 $w_attr[$key] += $value;
             }
         }
         if (!empty($w_attr)) {
             foreach ($w_attr as $key => $value) {
                 $this->_player[$key] += $value;
             }
         }
     }
     #---------------------------------------------------------------------
     #文斌的属性
     #---------------------------------------------------------------------
     if (!empty($this->_playerDetailItem['player_grade_attr'])) {
         foreach ($this->_playerDetailItem['player_grade_attr'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     #---------------------------------------------------------------------
     #帮会的属性
     #---------------------------------------------------------------------
     if (!empty($this->_playerDetailItem['union_player_attr'])) {
         foreach ($this->_playerDetailItem['union_player_attr'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     #---------------------------------------------------------------------
     #声望的属性
     #---------------------------------------------------------------------
     if (!empty($this->_playerDetailItem['fame_attr'])) {
         foreach ($this->_playerDetailItem['fame_attr'] as $key => $value) {
             $this->_player[$key] += $value;
         }
     }
     if (!empty($this->_playerDetailItem['vip_special_attr'])) {
         foreach ($this->_playerDetailItem['vip_special_attr'] as $key => $value) {
             $this->_player[$key] += $this->_player[$key] * ($value / 10000);
         }
     }
     if ($calc_buff_attr) {
         #TODO:看这个参数是不是要算buff属性 现在是排行查看的时候要计算 登陆的时候获取人物帐数据的的时候不用
         if (!empty($this->_playerDetailItem['dower_info'])) {
             $arr_buff = array();
             foreach ($this->_playerDetailItem['dower_info'] as $val) {
                 $dower = Cache_Dower::getInstance()->get_dower_info($val['dower_id'], $val['dower_lv']);
                 if (!empty($dower)) {
                     $skillPassive = Cache_SkillPassive::getInstance()->get_skill_passive_info(array('sid' => $dower['skill_id'], 'level' => $val['dower_lv']));
                     if (!empty($skillPassive['buff_id1'])) {
                         $arr_buff[] = $skillPassive['buff_id1'];
                     }
                     if (!empty($skillPassive['buff_id2'])) {
                         $arr_buff[] = $skillPassive['buff_id2'];
                     }
                 }
             }
             if ($arr_buff) {
                 $buff_data = Cache_SkillBuff::getInstance()->get_buff_data($arr_buff);
                 if ($buff_data) {
                     foreach ($buff_data as $val) {
                         $attr_key = $this->get_game('BuffData')->get_attr_by_buff_type($val['param1']);
                         if ($val['buff_type'] == 'mod_fight_attr') {
                             $this->_playerDetailItem['buff_attr'][$attr_key] += $val['param2'];
                         }
                         if ($val['buff_type'] == 'mod_fight_attr_%') {
                             $this->_playerDetailItem['buff_attr_per'][$attr_key] += $val['param2'];
                         }
                     }
                 }
             }
         }
         #---------------------------------------------------------------------
         #buff属性
         #---------------------------------------------------------------------
         if (!empty($this->_playerDetailItem['buff_attr'])) {
             foreach ($this->_playerDetailItem['buff_attr'] as $key => $value) {
                 if ($key == 'hp' || $key == 'atk_min' || $key == 'arm') {
                     $this->_player[$key] += intval($this->_player[$key] * ($value / 10000));
                 }
             }
         }
         #---------------------------------------------------------------------
         #buff百分比属性
         #---------------------------------------------------------------------
         if (!empty($this->_playerDetailItem['buff_attr_per'])) {
             foreach ($this->_playerDetailItem['buff_attr_per'] as $key => $value) {
                 if ($key == 'hp' || $key == 'atk_min' || $key == 'arm') {
                     $this->_player[$key] += intval($this->_player[$key] * ($value / 100));
                 }
             }
         }
     }
     //        #vip特权加成  vip升级的时候挪到
     //
     //        $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10066);
     //
     //        if($vip_level_config){
     //            $this->_player['hp'] += $this->_player['hp'] * ($vip_level_config['max_times']/10000);
     //        }
     //        $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10067);
     //        if($vip_level_config){
     //            $this->_player['atk_min'] += $this->_player['atk_min'] * ($vip_level_config['max_times']/10000);
     //        }
     //        $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10068);
     //        if($vip_level_config){
     //            $this->_player['arm'] += $this->_player['arm'] * ($vip_level_config['max_times']/10000);
     //        }
     if ($equip_move_speed > 0) {
         $this->_player['move_speed'] = $this->_player['move_speed'] * (1 + $equip_move_speed / 10000);
     }
     ###统一向上取整
     foreach (Cache_AttrConfig::get_attr() as $key) {
         $this->_player[$key] = intval($this->_player[$key]);
     }
     return $this->_player;
 }
示例#22
0
 /**
  * 挂机领取奖励
  * @param unknown $add_exp
  * @param unknown $arr_item_id
  * @param unknown $arr_item_num
  */
 public function auto_pve_add_reward($player_id, $add_exp, $arr_item_id, $arr_item_num)
 {
     $reward = array();
     if (Com_Array::is_good_arr($arr_item_id)) {
         foreach ($arr_item_id as $key => $item_id) {
             $item_num = $arr_item_num[$key];
             if ($item_num > 0) {
                 $reward[] = array('type' => Cache_FbLoot::getInstance()->get_item_key($item_id), 'item_id' => $item_id, 'item_num' => $item_num);
             }
         }
     }
     if ($add_exp) {
         $reward[] = array('type' => Cache_FbLoot::getInstance()->get_item_key(1), 'item_id' => 1, 'item_num' => $add_exp);
     }
     if (!empty($reward)) {
         $result = $this->get_game('Reward')->send_reward($player_id, $reward, array('cmd_id' => '771'));
         if ($result !== true) {
             $attachment = array();
             foreach ($reward as $prop) {
                 $attachment[] = array("prop_id" => $prop['item_id'], "prop_num" => $prop['item_num']);
             }
             $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info(11);
             $this->get_game('Mail')->async_trigger_mail($player_id, $phrase_config['title'], $phrase_config['content'], $attachment, $phrase_config['sender'], 1, 771);
             Com_Log::debug_write('auto_pve_add_reward', "player_id={$player_id},fail=" . json_encode($reward));
             $this->throw_error(80034);
             return false;
         }
         Com_Log::debug_write('auto_pve_add_reward', "player_id={$player_id},sucess=" . json_encode($reward));
         $this->get_game('Reward')->add_reward_log(true);
     }
 }
示例#23
0
 /**
  * @Purpose:
  * 平台礼包领取
  * @Param $player_id 玩家ID
  * @Param $type 礼包类型(1:360加速球2:360游戏大厅)
  */
 public function receive_platform_bag($player_id, $type)
 {
     $player_id = intval($player_id);
     $type = intval($type);
     $operator_id = OPERATOR_ID;
     #获取玩家微端礼包信息;
     $data = $this->get_data('PlayerDetail')->get_player_detail($player_id, 'platform_bag_info');
     if (empty($data) || !isset($data[$operator_id][$type]) || $data[$operator_id][$type] != 2) {
         #获取平台礼包配置表
         $platformbag_table = Cache_PlatformBag::getInstance()->get_platform_bag_info(array('platform' => $operator_id, 'type' => $type));
         if (empty($platformbag_table)) {
             $this->throw_error('10109');
             #配置表读取错误
         }
         #领奖时间验证
         $start_time = Com_FmtData::format_table_time($platformbag_table['start_time']);
         $over_time = Com_FmtData::format_table_time($platformbag_table['over_time']);
         if (time() < $start_time || $over_time <= time()) {
             $this->throw_error('21001');
             #非领奖时间
         }
         if ($data[$operator_id][$type] == 2) {
             $this->throw_error('6010063');
             #奖励领取过
         }
         if ($platformbag_table['is_activate'] == 1 && $data[$operator_id][$type] != 1) {
             $this->throw_error('21002');
             #礼包未激活
         }
         $prop_list = Com_FmtData::format_table_prop($platformbag_table['prop_info']);
         $prop_info = Com_FmtData::format_send_prop($prop_list);
         $data[$operator_id][$type] = 2;
         $this->start_trans();
         $update_res = $this->get_data('PlayerDetail')->update_player_detail($player_id, array('platform_bag_info' => $data));
         if (!$update_res) {
             $this->throw_error('10104');
         }
         #道具发送
         if (Com_Array::is_good_arr($prop_info)) {
             $result = $this->get_game('Reward')->send_reward($player_id, $prop_info, array('cmd_id' => '2105', 'bind_flag' => 0), 1);
             if ($result !== true) {
                 $this->throw_error('10104');
             }
         }
         $this->commit();
         $this->get_game('Reward')->add_reward_log();
         $fun_id = 0;
         if ($type == 1) {
             $fun_id = 91101;
         } else {
             if ($type == 2) {
                 $fun_id = 91102;
             }
         }
         if ($fun_id > 0) {
             #礼包全部领完后,通知前端隐藏ICON
             $func_data = array();
             $func_data[0][$fun_id] = array('operate' => 2, 'func_id' => $fun_id, 'open' => 0, 'guide' => 0, 'cd' => 0, 'tip' => array());
             Protocol::input($player_id, 8, 7, 741, $func_data);
         }
         return array(intval($data[$operator_id][$type]), $type);
     }
 }
示例#24
0
 /**
  * @Purpose:
  * 数据修复检测
  */
 public function hero_repair($player_id)
 {
     //获取玩家所有英雄
     $data = $this->get_data('PlayerHero')->get_player_hero_list($player_id);
     #获取英雄公会科技属性加成
     $union_attr = $this->get_data('PlayerDetail')->get_player_detail($player_id, 'union_hero_attr');
     $union_attr = Com_FmtData::cus_json_decode($union_attr);
     if (!empty($data) && Com_Array::is_good_arr($data)) {
         $this->start_trans();
         foreach ($data as $key => $val) {
             $val = Com_FmtData::cus_json_decode($val);
             if (!empty($val) && isset($val['hero_id']) && !empty($val['hero_id'])) {
                 $is_update = false;
                 if (!isset($val['repair_flag']) || $val['repair_flag'] < 1) {
                     //获取升级增加的属性
                     $add_attr = $this->get_upgrade_add_attr($val['hero_code'], $val['level'], $val['fit_grow']);
                     $val['life'] = $add_attr['life'];
                     $val['attack'] = $add_attr['attack'];
                     $val['def'] = $add_attr['def'];
                     //战斗力计算
                     $val['fight'] = $this->calc_fight($val['player_id'], $val, $val['fit'], $val['rune_hole_list'], $val['star_add_attr_per'], $val['skill_list'], $union_attr);
                     $is_update = true;
                 }
                 if ($is_update) {
                     $val['repair_flag'] = $this->repair_flag;
                     //更新redis,sql数据
                     $update_res = $this->update_db($val['player_id'], array('fight', 'life', 'attack', 'def', 'repair_flag'), $val, 504);
                     if (!$update_res) {
                         $this->throw_error('10104');
                     }
                 }
             }
         }
         $this->commit();
     }
 }
示例#25
0
 /**
  * @Purpose:
  * 获取缓存配置表数据(通用函数)
  * @param $cacheKeyPrefix 缓存关键字
  * @param $db_name 配置表名
  * @param $array 查询条件
  * @param $many_times 是否获取符合条件的所有数据
  */
 protected function get_cache_config_table($cacheKeyPrefix, $db_name, $array = array(), $many_times = false)
 {
     $index = '';
     if (!empty($cacheKeyPrefix) && !empty($db_name)) {
         if (empty($array)) {
             if (empty($this->temporary_data['all'])) {
                 $sql = "select * from {$db_name}";
                 $data = $this->select_all($sql, $cacheKeyPrefix . '|' . $db_name . '_all');
                 if (Com_Array::is_good_arr($data)) {
                     $this->temporary_data['all'] = $data;
                 }
             }
             $index = 'all';
         } else {
             if (is_array($array)) {
                 $key = '';
                 $conditions = '';
                 //查询条件组合
                 foreach ($array as $keys => $val) {
                     if (is_string($val)) {
                         $conditions .= ($conditions ? "and" : "") . " {$keys} = '{$val}' ";
                     } else {
                         $conditions .= ($conditions ? "and" : "") . " {$keys} = {$val} ";
                     }
                     $keys .= ($keys ? "&" : "") . $val;
                     $key .= $keys . $many_times;
                 }
                 $select_func = '';
                 if (empty($this->temporary_data[$key])) {
                     if ($many_times) {
                         $select_func = 'select_all';
                     } else {
                         $select_func = 'select_one';
                     }
                     $sql = "select * from {$db_name} where {$conditions}";
                     $data = $this->{$select_func}($sql, $this->get_cache_key(array($db_name => $key), $cacheKeyPrefix));
                     if (Com_Array::is_good_arr($data)) {
                         $this->temporary_data[$key] = $data;
                     }
                 }
                 $index = $key;
             }
         }
     }
     return empty($index) ? array() : $this->temporary_data[$index];
 }
示例#26
0
 public function crontab_kf_player_info($is_sync_grab_treasure_data = 0)
 {
     $keys = $this->get_data('Account')->get_player_ids();
     #Com_AdCache::factory('player')->keys("data|player:*");
     if (!empty($keys)) {
         foreach ($keys as $key) {
             $player_info = $this->get_data('Player')->get_player_info($key['player_id'], array("player_id", "sum_fpower", "level", "name", "is_dummy", "career_type", "privilege_level"));
             $player_id = $player_info['player_id'];
             #同步玩家战力
             $player_info['server_id'] = SERVER_ID;
             $this->get_cross("GrabTreasure")->sync_kf_player_base_info($player_info);
             echo json_encode($player_info) . "\n";
             #同步夺宝老数据
             if ($is_sync_grab_treasure_data == 1) {
                 #同步夺宝碎片数据
                 $grab_treasure_info = $this->get_data("GrabTreasure")->get_grab_treasure_his($player_id);
                 if (Com_Array::is_good_arr($grab_treasure_info)) {
                     $this->get_cross("GrabTreasure")->update_grab_treasure($player_id, $grab_treasure_info);
                     echo "----------------grab_treasure_info--------------------\n";
                     echo json_encode($grab_treasure_info) . "\n";
                 }
                 #同步受保护时间
                 $safe_remain_cd = $this->get_data("GrabTreasure")->get_safe_remain_cd_his($player_id);
                 if ($safe_remain_cd) {
                     $this->get_cross("GrabTreasure")->clear_safe_remain_cd($player_id);
                     $this->get_cross("GrabTreasure")->add_safe_remain_cd($player_id, $safe_remain_cd);
                     echo "----------------add_safe_remain_cd--------------------\n";
                     echo "{$player_id}:{$safe_remain_cd}\n";
                 }
             }
         }
     }
 }
示例#27
0
 /**
  * 公会排行列表
  * type类型    2、建筑等级 3、公会战力 
  */
 public function get_union_rank($type)
 {
     switch ($type) {
         case 2:
             $data = $this->get_union_build_rank_list();
             break;
         case 3:
             $data = $this->get_data('UnionInfo')->get_union_sum_fpower_rank_list(1, 100);
             break;
     }
     $union_list = array();
     if (Com_Array::is_good_arr($data)) {
         Com_Array::multisort($data, array('val' => 'desc', 'player_num' => 'desc', 'union_level' => 'desc', 'union_exp' => 'desc'));
         foreach ($data as $key => $val) {
             $item = array();
             $item['rank'] = $key + 1;
             $item['union_name'] = $val['union_name'];
             $item['union_id'] = $val['union_id'];
             $item['create_player_id'] = $val['create_player_id'];
             $item['create_player_name'] = $val['create_player_name'];
             $item['union_player_num'] = $val['player_num'];
             $item['val'] = $val['val'];
             $union_list[] = $item;
             if ($item['rank'] >= 100) {
                 break;
             }
         }
     }
     return $union_list;
 }
示例#28
0
 /**
  *	扣除玩家道具
  * @param $player_id
  * @param $player_info player表里的信息  里面至少包含 player_id level vip $cur_key对应的字段
  */
 public function dedcut_player_prop($player_id, $player_info, $cmd_id)
 {
     if (!empty($this->_deduct_prop_list) && Com_Array::is_good_arr($this->_deduct_prop_list)) {
         foreach ($this->_deduct_prop_list as $id => $num) {
             if ($num > 0) {
                 $log_param = array('cmd_id' => $cmd_id, 'level' => $player_info['level'], 'vip' => $player_info['vip']);
                 $this->deduct_prop_by_prop_id($player_id, $id, $num, $log, 1, $log_param);
             }
         }
     }
 }
示例#29
0
 /**
  * 获取引导任务格式化
  * @param $task_guide_config
  * @return array
  */
 public function get_guide_target_val($task_guide_config, $player_id)
 {
     $target = array();
     switch ($task_guide_config['type']) {
         case 1:
             $param = explode(":", $task_guide_config['content']);
             $cur_num = 0;
             #取出技能符文数
             $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array('skill_info', 'skill_rune_info'));
             if (Com_Array::is_good_arr($player_detail['skill_info'])) {
                 foreach ($player_detail['skill_info'] as $skill_id => $skill_info) {
                     if ($skill_info['keyboard'] == $param[0]) {
                         if (isset($player_detail['skill_rune_info'][$skill_id])) {
                             $cur_num = count($player_detail['skill_rune_info'][$skill_id]);
                         }
                     }
                 }
             }
             $target = array('guide_id' => $task_guide_config['guide_id'], 'type' => $task_guide_config['type'], 'target_type' => $param[0], 'cur_num' => $cur_num, 'max_num' => $param[1]);
             break;
         case 3:
             $data = $this->get_data('Fairy')->get_player_fairy_list($player_id);
             $param = explode(":", $task_guide_config['content']);
             if (!empty($data)) {
                 foreach ($data as $fairy) {
                     if ($fairy['type'] == $param[0]) {
                         $cur_num = $fairy['level'];
                         break;
                     }
                 }
             } else {
                 $cur_num = 0;
             }
             $target = array('guide_id' => $task_guide_config['guide_id'], 'type' => $task_guide_config['type'], 'target_type' => $param[0], 'cur_num' => $cur_num, 'max_num' => $param[1]);
             break;
         case 8:
             $player_info = $this->get_data('Player')->get_player_info($player_id, array('union_id'));
             if (!empty($player_info['union_id'])) {
                 $cur_num = 1;
             } else {
                 $cur_num = 0;
             }
             $target = array('guide_id' => $task_guide_config['guide_id'], 'type' => $task_guide_config['type'], 'target_type' => 0, 'cur_num' => $cur_num, 'max_num' => $task_guide_config['content']);
             break;
         default:
             $target = array('guide_id' => $task_guide_config['guide_id'], 'type' => $task_guide_config['type'], 'target_type' => 0, 'cur_num' => 0, 'max_num' => $task_guide_config['content']);
             break;
     }
     return $target;
 }
示例#30
0
 public function fix_hero_data()
 {
     $player_ids = $this->redis()->keys("data|player_hero:*");
     foreach ($player_ids as $key) {
         /*
         if ($key != "data|player_hero:10464")
         {
         	continue;
         }
         */
         list($keys, $player_id) = explode(":", $key);
         $is_update = false;
         $info = $this->redis()->hash_get($key);
         foreach ($info as $hero_id => $hero_info) {
             if (!empty($hero_info)) {
                 if (is_string($hero_info)) {
                     $hero_info = json_decode($hero_info, true);
                 }
                 $hero_fit_type = $hero_info['fit_type'];
                 $quality_3 = $this->get_data('PlayerHero')->get_player_hero_id_by_quality($player_id, 3);
                 $quality_4 = $this->get_data('PlayerHero')->get_player_hero_id_by_quality($player_id, 4);
                 $is_quality = false;
                 if (Com_Array::is_good_arr($quality_3)) {
                     if (array_key_exists($hero_id, $quality_3)) {
                         $is_quality = true;
                     }
                 }
                 if (!$is_quality && Com_Array::is_good_arr($quality_4)) {
                     if (array_key_exists($hero_id, $quality_4)) {
                         $is_quality = true;
                     }
                 }
                 if ($is_quality) {
                     $hero_data = $this->get_data('PlayerHero')->get_player_hero_info($player_id, $hero_id);
                     if (empty($hero_data)) {
                         $this->redis()->hash_set('data|hero:' . $hero_id, $hero_info);
                     }
                     continue;
                 }
                 $fight_hero = $this->get_data('PlayerHero')->get_fight_hero($player_id);
                 if ($fight_hero && $fight_hero['hero_id'] && $fight_hero['hero_id'] == $hero_id) {
                     $this->get_data('PlayerHero')->del_fight_hero($player_id);
                 }
                 $after_fight_hero = $this->get_data('PlayerHero')->get_after_fight_hero($player_id);
                 if ($after_fight_hero && Com_Array::is_good_arr($after_fight_hero)) {
                     if (in_array($hero_id, $after_fight_hero)) {
                         $this->get_data('PlayerHero')->del_after_fight_hero($player_id, $hero_id);
                     }
                 }
                 $hero_culture = $this->get_data('PlayerHero')->get_player_hero_culture_list($player_id);
                 if ($hero_culture) {
                     if (is_string($hero_culture['hero_list'])) {
                         $hero_culture['hero_list'] = json_decode($hero_culture['hero_list'], true);
                     }
                     $hero_culture['hero_list'][$hero_fit_type] = 0;
                     $hero_culture['hero_list'] = json_encode($hero_culture['hero_list']);
                     $this->get_data('PlayerHero')->update_hero_culture($player_id, $hero_culture['hero_list']);
                 }
                 unset($info[$hero_id]);
                 $this->redis()->hash_delete($key, $hero_id);
             }
         }
     }
 }