public function run() { $objAccount = TenYear::getInstance('Data_Account'); $objPlayerInitGame = TenYear::getInstance('Game_PlayerInit'); for ($i = 1; $i <= 10; $i++) { $strUserAccount = "ggmmhg100" . $i; $playerid = $objAccount->get_pid_byaccount($strUserAccount); $player_character = Cache_PlayerRole::getInstance()->get_player_role(); if (!$playerid) { $name = $strUserAccount; $playerid = $objAccount->add_account($strUserAccount, $name); // $character = ($i%4)+1; $character = rand(3, 4); $arrCharacter = $player_character[$character]; $arrData = array(); $arrData['player_id'] = $playerid; $arrData['user_account'] = $strUserAccount; $arrData['name'] = $name; $arrData['career_type'] = $arrCharacter['career_type']; $arrData['avatar'] = $arrCharacter['avatar']; $arrData['sex'] = $arrCharacter['sex']; $arrData['ad_info'] = ''; $arrData['client_ip'] = '127.0.0.1'; $arrData['exec'] = 1; $affectedRows = $objPlayerInitGame->active($arrData); if ($affectedRows) { $sql = "replace into test_account (player_id,user_account,career_type) values ('{$playerid}','{$strUserAccount}','{$arrCharacter['career_type']}')"; $result = $this->query($sql); if ($result) { echo "{$strUserAccount}\n"; } } } } }
public function achieve_repair($player_id) { # 修复一下符文成就相关的数据[NOTE:刷新成就相关脏数据用] TenYear::getInstance(TenYear::game_name('PlayerSkill'))->handle_rune_refer_achieve($player_id); # 修复一下天赋成就相关的数据[NOTE:刷新成就相关脏数据用] TenYear::getInstance(TenYear::game_name('PlayerSkill'))->handle_dower_refer_achieve($player_id); echo $player_id . "sync suc \n"; }
public function doAction() { $userInfo_json = base64_decode($_POST['data']); $userInfo_array = json_decode($userInfo_json, true); $state = isset($userInfo_array['state']) ? $userInfo_array['state'] : ""; $ips = isset($userInfo_array['ips']) ? $userInfo_array['ips'] : ""; $data = array(); $res = array(); if (!empty($state) && !in_array($state, $this->state)) { $data['status'] = 8; exit; } else { $data['status'] = 0; } if ($state == 'open') { #开服 #Protocol::input(0, 7, 4, 514, array('type_id'=>1,'role_id'=>0)); #Protocol::out(); $res['status'] = 1; if ($this->get_data('Online')->set_server_state($res)) { $data['status'] = 1; } else { $data['status'] = 0; } } elseif ($state == 'close') { #关服维护 Protocol::input(0, 7, 4, 514, array('type_id' => 1, 'role_id' => 0)); Protocol::out(); $res['status'] = 0; if ($this->get_data('Online')->set_server_state($res)) { $data['status'] = 1; TenYear::getInstance(); $objSession = TenYear::getInstance('session'); $objSession->del_all_session(); } else { $data['status'] = 0; } } elseif ('write_ip' == $state) { #白名单 $res['write_ip'] = $ips; if ($this->get_data('Online')->set_server_state($res)) { $data['status'] = 1; } else { $data['status'] = 0; } } elseif ('black_id' == $state) { #黑名单 $res['black_id'] = $ips; if ($this->get_data('Online')->set_server_state($res)) { $data['status'] = 1; } else { $data['status'] = 0; } } echo json_encode($data); return; }
protected function get_cross($name, $isOne = false) { $className = TenYear::cross_name($name); if ($isOne) { return new $className(); } $this->_objData[$className]++; return TenYear::getInstance($className); }
public function handle_dirty_data() { $player_id_list = $this->get_whole_player_list(); if (empty($player_id_list)) { return false; } foreach ($player_id_list as $player_id) { $player_info = TenYear::getInstance('Data_Player')->get_player_info($player_id); $arr_player_detail = TenYear::getInstance('Data_PlayerDetail')->get_player_detail($player_id, array('skill_info', 'skill_rune_info')); $skill_list_all = Cache_Skill::getInstance()->get_skill_list($player_info['career_type']); $skill_list_distinct = Cache_Skill::getInstance()->get_distinct_skill_list($player_info['career_type']); if (empty($skill_list_distinct)) { echo "Warning: player_id={$player_id}|career_type=" . $player_info['career_type'] . "\n"; continue; #$this->throw_error('60022'); # 没有符合玩家职业的技能配置信息 } # 该步操作除了获取hash结构外,重置了每个技能的max_level为有效信息 $skill_hash_all = TenYear::getInstance('Game_PlayerSkill')->convert_skill_list_to_hash($skill_list_all); $exception_flag = 0; # 0无异常 >1异常 foreach ($skill_list_distinct as $val) { if ($val['display'] == 0) { continue; } $skill_id = $val['sid']; # 问题玩家 if (isset($arr_player_detail['skill_info'][$skill_id]) && $arr_player_detail['skill_info'][$skill_id]['level'] > $skill_hash_all[$skill_id][1]['max_level']) { echo "Warning: player_id={$player_id}|skill_id={$skill_id}|origin_level=" . $arr_player_detail['skill_info'][$skill_id]['level'] . "|max_level=" . $skill_hash_all[$skill_id][1]['max_level'] . "\n"; $arr_player_detail['skill_info'][$skill_id]['level'] = $skill_hash_all[$skill_id][1]['max_level']; $exception_flag += 1; } if (isset($arr_player_detail['skill_rune_info'][$skill_id])) { # 重置每个技能的符文为最大等级的激活状态 $rune_list_all = Cache_SkillRune::getInstance()->get_skill_rune_list_by_skill_id($skill_id); $rune_hash_all = TenYear::getInstance('Game_PlayerSkill')->convert_rune_list_to_hash($rune_list_all); foreach ($rune_hash_all as $rune_id => $rune_lv_info) { if (isset($arr_player_detail['skill_rune_info'][$skill_id][$rune_id]) && $arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] > $rune_lv_info[1]['max_level']) { echo "Warning: player_id={$player_id}|skill_id={$skill_id}|rune_id={$rune_id}|origin_level=" . $arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] . "|max_level=" . $rune_lv_info[1]['max_level'] . "\n"; $arr_player_detail['skill_rune_info'][$skill_id][$rune_id]['level'] = $rune_lv_info[1]['max_level']; $exception_flag += 1; } } } } if (!empty($exception_flag)) { # 修正等级 /** TenYear::getInstance('Data_PlayerDetail')->update_player_detail( $player_id, array('skill_info'=>$arr_player_detail['skill_info'], 'skill_rune_info' => $arr_player_detail['skill_rune_info']) ); **/ } } echo "End ...\n"; }
public function add_unions($player_id, $friend_id) { try { $objdata = TenYear::getInstance(TenYear::game_name('PlayerFriend')); $objdata->add_unions($player_id, $friend_id); echo "send success {$player_id}"; } catch (Exception $e) { $error = "Exception: " . $e->getFile() . " line:" . $e->getLine() . " " . $e->getMessage(); echo $error; } }
public function fb() { $sql = "select * from test_account"; $this->query($sql); $arr_player = array(); while ($this->next_record()) { $player_id = $this->get_field('player_id'); $arr_player[] = $player_id; } foreach ($arr_player as $player_id) { $obj = TenYear::getInstance(TenYear::game_name('PlayerFB')); $obj->get_chapter_fb_info($player_id, 0, 0); echo "player:{$player_id} suc\n"; } }
public static function get_search_list($data) { $ret = array(); if ($data) { foreach ($data as $key => $val) { $is_hidden_vip = 0; if (intval($val['vip']) > 0) { $vip_info = TenYear::getInstance('Data_VipReward')->get_reward_log(intval($val['player_id'])); $is_hidden_vip = intval($vip_info['is_hidden_vip']); } $ret[$key] = array(0 => intval($val['player_id']), 1 => $val['name'], 2 => intval($val['level']), 3 => intval($val['sum_fpower']), 4 => $val['avatar'], 5 => intval($val['vip']), 6 => intval($val['is_friend']), 7 => intval($val['type']), 8 => $is_hidden_vip); } } return $ret; }
public function run() { $keys = Com_AdCache::factory('player')->keys("data|player:*"); if (!empty($keys)) { foreach ($keys as $key) { $player_info = $this->redis()->hash_get($key, array('player_id', 'level', 'union_id')); if (intval($player_info['player_id']) <= 0) { continue; } if (intval($player_info['level']) < 20) { continue; } $objPlayerProp = TenYear::getInstance(TenYear::data_name('PlayerProp')); $player_props = $objPlayerProp->get_player_all_prop($player_info['player_id']); foreach ($player_props as $prop) { if (isset($prop['intensive_level'])) { echo "player_id={$player_info['player_id']}|player_prop_id={$prop['player_prop_id']}\n"; $objPlayerAchieve = TenYear::getInstance(TenYear::game_name('PlayerAchieve')); $objPlayerAchieve->async_trigger_achieve_target($player_info['player_id'], 6, "1:" . $prop['quality'] . ":" . $prop['star_level'] . ":" . intval($prop['intensive_level']) . ":{$prop['player_prop_id']}", 4); } } } } }
private function handle_fashion_for_dummy($player_id, $fashion_id) { $arr_list = explode('|', $fashion_id); if (!empty($arr_list)) { $arr_fashion_fit = array(); $arr_fashion_info = array(); $arr_fashion_attr = array(); foreach ($arr_list as $fid) { $fashion = Cache_Fashion::getInstance()->get_fashion($fid); $arr_fashion_fit[$fashion['type']] = $fid; $arr_fashion_info[$fid] = array('type' => $fashion['type']); $attrs = explode("|", $fashion['attr_val']); if ($attrs) { foreach ($attrs as $attr) { $val = explode(":", $attr); $arr_fashion_attr[$val[0]] += $val[1]; } } } TenYear::getInstance('Data_PlayerDetail')->update_player_detail($player_id, array('fashion_info' => $arr_fashion_info, 'fashion_fit' => $arr_fashion_fit, 'fashion_attr' => $arr_fashion_attr)); } }
/** * 获取前三 * @return int */ public function get_top_three($settle_date) { //$data = $this->redis()->get($this->_cacheKeyKfDuelTopList);//取缓存数据 //if($data){ // $out = json_decode($data,true); // return $out; //}else{ $data = $this->get_rank_list_by_multisort($settle_date, 10); if ($data) { $rank = 1; $out = array(); $objApi = TenYear::getInstance('Com_Uzapi'); foreach ($data as $cross_player_info) { if ($rank > 3) { break; } $avatar = $this->get_game('KFArena')->get_player_avatar($cross_player_info['player_id'], 0, $cross_player_info['career_type']); /* if(SERVER_ID == $cross_player_info['server_id']){ $avatar = $this->get_game('KFArena')->get_player_avatar($cross_player_info['player_id'],0,$cross_player_info['career_type']); }else{ $avatar = array(); $param = array( "action"=>"PlayerInfo", "command"=>"get_player_avatar", "player_id"=>$cross_player_info['player_id'], 'career_type'=>$cross_player_info['career_type'] ); $objApi->setReqData($param); $ip = $this->get_cross('Base')->get_server_ip($cross_player_info['server_id']); $objApi->setServerUrl($ip); $response = $objApi->sendRequest(); if(!empty($response['return'])){ $avatar = $response['return']; } else { $avatar = array(); } }*/ $out[] = array('player_id' => $cross_player_info['player_id'], 'name' => $cross_player_info['player_name'], 'power' => $cross_player_info['sum_fpower'], 'rank' => $rank, 'avatar' => $avatar, 'server_id' => $cross_player_info['server_id']); $rank++; } //$this->redis()->set($this->_cacheKeyKfDuelTopList, json_encode($out), 300); return $out; } //} return array(); }
/** * 人 物面板信息 * @param unknown $player_id * @param unknown $friend_id */ public function get_player_panel_info($player_id, $friend_id, $server_id = SERVER_ID) { // Com_Log::write("get_player_panel_info.".$player_id,var_export($server_id,true)); $is_friend = 0; //陌生人 $server_id = SERVER_ID; #竞技场排行不跨服了默认==当前服id吧 if ($server_id == SERVER_ID || empty($server_id)) { if ($player_id == $friend_id) { $is_friend = 2; //自己 } else { $objfrined = $this->get_data('PlayerFriend'); $player_data = $objfrined->get_player_friend($player_id, array('follow')); if (isset($player_data['follow']['info'][$friend_id])) { $is_friend = 1; //已是好友 } } $base_info = $this->get_game('PlayerBase')->get_player_other_player_info($friend_id); $bag_info = $this->get_game('PlayerBag')->get_player_item($friend_id, 3); $data = $this->get_game('PlayerFashion')->get_player_fashion($friend_id); $fashion_info = $data['curDress']; $train_info = $this->get_game('Train')->get_player_train_detail($friend_id); return array($friend_id, $is_friend, $base_info, $bag_info[3], $fashion_info, $train_info); } else { $objApi = TenYear::getInstance('Com_Uzapi'); $objApi->setReqData(array("action" => "PlayerInfo", "command" => "get_player_panel_info", "player_id" => $friend_id)); $ip = $this->get_cross('Base')->get_server_ip($server_id); $objApi->setServerUrl($ip); $response = $objApi->sendRequest(); if (!empty($response['return'])) { return $response['return']; } else { return array($friend_id, 1, array(), array(), array(), array()); } } }
/** * 获取挑战双方战斗信息 * @param unknown $player_id * @param unknown $opponent_player_id 对手玩家ID * @return multitype:number */ public function grab_treasure_battle($player_id, $opponent_player_id, $need_pieces_id, $battle_log_id = 0) { $opponent_player_id = intval($opponent_player_id); $battle_log_id = intval($battle_log_id); $opponent_player_info = $this->get_cross("GrabTreasure")->get_player_info($opponent_player_id, array("player_id", "is_dummy", "server_id")); if (empty($opponent_player_info)) { $opponent_player_info = $this->get_data("Player")->get_player_info($opponent_player_id, array("player_id", "is_dummy", "server_id")); if (empty($opponent_player_info)) { $this->throw_error('20002'); #获取玩家信息失败 } $opponent_player_info['server_id'] = SERVER_ID; } list($prop_id, $pieces_index) = explode("_", $need_pieces_id); $pieceConfig = Cache_GrabTreasurePiece::getInstance()->get_grab_treasure_piece($need_pieces_id); if (empty($pieceConfig)) { $this->throw_error('80003', "5010905{$prop_id}{$pieces_index}"); } $grab_prop_config = Cache_GrabTreasureBase::getInstance()->get_grab_treasure_id($prop_id); if (empty($grab_prop_config)) { $this->throw_error('80003', "5010900{$prop_id}"); //游戏配置出错,请联系客服! } #限制挑战玩家在推荐列表中或抢回日志列表中 if ($battle_log_id == 2) { $recommend_player_list = $this->get_cross("GrabTreasure")->get_grab_treasure($player_id, "recommend_player_list"); #操作不符法 if (empty($recommend_player_list) || !in_array($opponent_player_id, $recommend_player_list)) { $this->throw_error('173702', "5010916"); } } else { $log_data = $this->get_game("GrabTreasure")->grab_treasure_log($player_id, 1, 100); if (empty($log_data['list'])) { $this->throw_error('173702', "5010923"); } $is_allow_grab = 0; foreach ($log_data['list'] as $val) { if ($val["is_allow_grab"] == 1 && $val['grab_player_id'] == $opponent_player_id) { $is_allow_grab = 1; break; } } if ($is_allow_grab == 0) { $this->throw_error('173702', "5010932"); } } $quality = $grab_prop_config['quality']; # 当天剩余可用挑战次数验证 $buy_times_info = Cache_BuyTimes::getInstance()->get_buy_times_info($this->grab_treasure_battle_buy_type, 1); $battle_times = $this->get_data('PlayerDailyTime')->get_player_used_time($player_id, 'grab_treasure_battle_times'); $battle_buy_times = $this->get_data('PlayerDailyTime')->get_player_used_time($player_id, 'grab_treasure_battle_buy_times'); if (empty($battle_times)) { $battle_times = 0; } if (empty($battle_buy_times)) { $battle_buy_times = 0; } $battle_times_max = $battle_buy_times * $buy_times_info['per_num'] + $this->grab_treasure_max_times; if ($battle_times >= $battle_times_max) { $this->throw_error('113706'); # 剩余可用挑战次数不足 } $cd_acc_lock = $this->get_data('GrabTreasure')->get_battle_cd_acc_lock($player_id); # 获取挑战CD时间累计锁状态 $battle_remain_cd = $this->get_data('GrabTreasure')->get_battle_remain_cd($player_id); # 获取:挑战剩余cd时间 $safe_remain_cd = $this->get_cross('GrabTreasure')->get_safe_remain_cd($player_id); # 获取保护时间 $allow_battle = 1; if (!empty($cd_acc_lock)) { # CD时间累计锁打开,不再允许CD累计 if ($battle_remain_cd > 0) { $allow_battle = 0; } } else { # CD时间累计锁关闭,允许CD累计 if ($battle_remain_cd >= $this->grab_treasure_battle_cd_stint) { $allow_battle = 0; } } if ($allow_battle == 0) { $this->throw_error('122201'); # 夺宝战斗CD中[上次超过上限后CD尚未清零,CD累计锁尚未关闭] } #对手是否挑战中 $is_in_battle = $this->get_cross("GrabTreasure")->get_battle_lock($opponent_player_id); if ($is_in_battle) { $this->throw_error("122203"); } $player_info = $this->get_data('Player')->get_player_info($player_id, array("is_online", "privilege_level")); $is_online = $player_info["is_online"]; #对方在线保护状态不可挑战 $safe_remain_cd = $this->get_cross('GrabTreasure')->get_safe_remain_cd($opponent_player_id); # 获取保护时间 if ($safe_remain_cd > 0) { #离线玩家没有开启保护模式 if ($is_online) { $this->throw_error('122202'); } } #验证对手是否存在该碎片 if ($opponent_player_info['is_dummy'] == 0) { $grab_treasure_info = $this->get_cross("GrabTreasure")->get_grab_treasure($opponent_player_id); if ($grab_treasure_info) { if (!isset($grab_treasure_info['quality_piece_ids'][$quality]) || empty($grab_treasure_info['quality_piece_ids'][$quality])) { if ($battle_log_id > 0) { $log_data = $this->get_cross('GrabTreasureLog')->get_grab_treasure_log($player_id, $battle_log_id); if (!empty($log_data)) { $log_data['is_allow_grab'] = 0; $this->get_cross('GrabTreasureLog')->update_grab_treasure_info($player_id, $battle_log_id, $log_data); } } $this->throw_error('122801'); #碎片已被其它玩家抢光 } } } $player_data = $this->get_game('PlayerBase')->get_player_whole_attr($player_id); if (SERVER_ID == $opponent_player_info['server_id']) { $opponent_player_data = $this->get_game('PlayerBase')->get_player_whole_attr($opponent_player_id); } else { $param = array("action" => "PlayerInfo", "command" => "get_player_whole_attr", "player_id" => $opponent_player_id); $objApi = TenYear::getInstance('Com_Uzapi'); $objApi->setReqData($param); $ip = $this->get_cross('Base')->get_server_ip($opponent_player_info['server_id']); $objApi->setServerUrl($ip); $response = $objApi->sendRequest(); if (!empty($response['return'])) { $opponent_player_data = $response['return']; } else { $opponent_player_data = array(); } } SynPlayer::set_syn_data($player_data); $synPlayerData = SynPlayer::get_data(); SynPlayer::set_syn_data($opponent_player_data); $synTgtPlayerData = SynPlayer::get_data(); $data = array('ladder_id' => 0, 'role_id_0' => $player_data['player_id'], 'role_name_0' => $player_data['name'], 'career_type_0' => $player_data['career_type'], 'masks_0' => $synPlayerData['m'], 'values_0' => $synPlayerData['u'], 'role_id_1' => $opponent_player_data['player_id'], 'role_name_1' => $opponent_player_data['name'], 'career_type_1' => $opponent_player_data['career_type'], 'masks_1' => $synTgtPlayerData['m'], 'values_1' => $synTgtPlayerData['u']); # 获取唯一的战斗序列号 $battle_seq = $this->get_cross('GrabTreasure')->get_new_grab_treasure_battle_seq(); $data['ladder_id'] = $battle_seq; $this->start_trans(); $is_add_battle_cd = 1; #特权免CD if ($player_info['privilege_level'] > 0) { $left_cd = $this->get_game('VipSpecial')->get_left_time($player_id); if ($left_cd > 0) { $vip_info = Cache_VipLevelLimit::getInstance()->get_limit_info_unrelated_to_vip_level(10080); if (!empty($vip_info)) { if ($player_info['privilege_level'] >= $vip_info['vip_level']) { $is_add_battle_cd = 0; } } } } if ($is_add_battle_cd) { $re = $this->get_data('GrabTreasure')->add_battle_cd($player_id, $this->grab_treasure_battle_cd_time); $this->write_check($re, 5010726); } # 更新挑战次数 $re = $this->get_data('PlayerDailyTime')->add_used_time($player_id, 'grab_treasure_battle_times', 1); $this->write_check($re, 5010731); #对手挑战中 if ($opponent_player_info['is_dummy'] == 0) { $re = $this->get_cross("GrabTreasure")->add_battle_lock($opponent_player_id); $this->write_check($re, 5010765); } $update_data["battle_need_piece_id"] = $need_pieces_id; $update_data["battle_piece_quality"] = $quality; $update_data["battle_log_id"] = $battle_log_id; $re = $this->get_cross('GrabTreasure')->update_grab_treasure($player_id, $update_data); $this->write_check($re, 5010787); $this->commit(); $battle_id_info = array('player_id' => $player_id, 'opponent_player_id' => $opponent_player_id); $this->get_data("GrabTreasure")->add_battle_id_info($battle_seq, $battle_id_info); #一旦掠夺其他玩家的保护,会取消自己的保护时间 $this->get_cross("GrabTreasure")->clear_safe_remain_cd($player_id); # 推送C++战斗双方属性信息 Protocol::input($player_id, 7, 4, 540, $data); unset($data['masks_0'], $data['values_0'], $data['masks_1'], $data['values_1']); $data_json = json_encode($data); Com_Log::debug_write('xgame.grab_treasure', "{$player_id}\t" . "grab_treasure_battle\t" . "{$data_json}\t"); $out = array('result' => 1); #夺宝N次添加引导任务 $this->get_game('TaskTrigger')->async_trigger_guide_task($player_id, 35, 1); $this->get_game('DailyBoon')->async_trigger_daily_boon_task($player_id, 3016, 1); return $out; }
$ad_info = $strAdInfo > 0 ? 1 : 0; Com_DataCenter::getInstance()->publish_data($player_id, 'est', array('ad_info' => $ad_info, 'step' => 'create', 'time' => time())); $log_data = array('player_id' => $player_id, 'channel' => 1, 'client_ip' => $strIp, 'game_client_ip' => $client_ip, 'reg_time' => time(), 'ad_info' => $strAdInfo, 'player_level' => 1); #Log_Login::getInstance()->add_log($log_data); Log_Common::getInstance()->add_log($log_data, 'day'); $arr_cache = array('player_id' => $player_id, 'name' => $arrData["name"], 'user_account' => $strUserAccount, 'ad_info' => $arrData['ad_Info'], 'reg_time' => time(), 'career_type' => $arrData['career_type'], 'first_load' => 0); $objPlayer = TenYear::getInstance('Data_Player'); $objPlayer->set_rookie_loading_cache($player_id, $arr_cache); #广告系统用户推送激活 $activelog = Com_System::send_request(array('user_account' => $arrData['user_account']), 'active'); #广告系统用户推送每天首次登陆 $activelog = Com_System::send_request(array('user_account' => $arrData['user_account']), 'login'); #记录登陆登出信息 TenYear::getInstance('Data_Online')->set_online_list($player_id, array('login_time' => time(), 'logout_time' => time())); Com_DataCenter::getInstance()->publish_data($player_id, 'login', array('ad_info' => $ad_info, 'status' => 'on', 'keep_time' => 0, 'time' => time())); TenYear::getInstance('Game_DailySign')->init_daily_sign_info($player_id); #TenYear::getInstance('Game_PackageCode')->async_send_old_account_login_reward($player_id, $arrData['user_account'], $_SESSION['sid']); $rurl = $webUrl . '/index.php'; if ($bAjax) { echo "result=1&msg=" . urlencode($rurl); } else { echo "<meta http-equiv=refresh content='0; url=" . $rurl . "'>"; } } else { //激活用户失败 if ($bAjax) { echo "result=0&msg=" . $arrLanguage["10218"]['content']; } else { Com_System::url_redirect($strTenYearUrl); } }
private function flush_sum_fpower_for_dummy($player_id) { $objFpowerCalc = TenYear::getInstance(TenYear::game_name('FpowerCalc')); $fpower_arr = $objFpowerCalc->calc_player_fpower($player_id); # 人物模块战力 $equip_fpower = $objFpowerCalc->calc_equip_fpower($player_id); # 装备模块战力 $sq_fpower = $objFpowerCalc->calc_sq_fpower($player_id); # 圣器模块战力 $fairy_fpower = $objFpowerCalc->calc_fairy_fpower($player_id); # 女神模块战力 $hero_fpower = $objFpowerCalc->calc_hero_fpower($player_id); # 英雄模块战力 $skill_fpower = $objFpowerCalc->calc_skill_fpower($player_id); # 技能模块战力 $wing_fpower = $objFpowerCalc->calc_wing_fpower($player_id); # 翅膀模块战力 #var_export($fpower); $fpower = $fpower_arr['fpower'] + $sq_fpower + $skill_fpower + $equip_fpower; $sum_fpower = $fpower + $hero_fpower + $fairy_fpower + $wing_fpower; #echo "fpower:{$fpower} sq_fpower:{$sq_fpower} equip_fpower:{$equip_fpower} skill_fpower:{$skill_fpower} wing_fpower:{$wing_fpower} hero_fpower:{$hero_fpower} fairy_fpower:{$fairy_fpower}\n"; #echo "sum_fpower:{$sum_fpower}\n"; TenYear::getInstance('Data_Player')->update_player_info($player_id, array('fpower' => $fpower, 'sum_fpower' => $sum_fpower)); }
</style> <script type="text/javascript" src="<?php echo MEDIA_SERVER_HOST; ?> /swfobject.js"></script> <?php if (!$_SESSION['player_flash_ver_flag']) { ?> <script type="text/javascript" src="<?php echo MEDIA_SERVER_HOST; ?> /jquery-1.4.2.min.js"></script> <?php } if (OPERATOR_ID == 82) { $app_id = TenYear::getInstance(TenYear::game_name('Tencent'))->appid; ?> <script type="text/javascript" charset="utf-8" src="http://fusion.qq.com/fusion_loader?appid=<?php echo $app_id; ?> &platform=<?php echo $_SESSION['platform']; ?> "> </script> <?php } if (OPERATOR_ID == 69) { ?> <script src="http://ext.1360.com/pumper.js?c=game&gkey=nsol" type="text/javascript"></script>
public function sys_data($player_info) { TenYear::getInstance(TenYear::data_name('UnionInfo'))->set_union_player_sum_fpower($player_info['union_id'], $player_info['player_id'], $player_info['sum_fpower']); echo $player_info['player_id'] . "--union_id=" . $player_info['union_id'] . "sync suc \n"; }
<?php /** * 异步GloryShop日志备份服务 * @author wanghui@uuzu.com * @date 2015-4-20 */ require dirname(__FILE__) . '/../global.php'; TenYear::getInstance(); ini_set('default_socket_timeout', -1); Com_AdCache::factory()->set_timeout(0); Com_Replication::set_interval_time(300); //注册player_detail同步方法 $objPlayerDetail = new Data_GloryShop(); Com_Replication::register('player_glory_shop', array($objPlayerDetail, 'get_player_log'), array($objPlayerDetail, 'replace_to_mysql')); //开始执行同步 Com_Replication::start();
/** * 购买道具 * @param $player_id * @param $auction_id * @return array */ public function buy_item($player_id, $auction_id, $buy_num) { $auction_data = $this->get_data('Auction')->get_auction($auction_id); if (empty($auction_data)) { $this->throw_error('80920'); //道具不存在 } $prop = json_decode($auction_data['prop_info'], true); if ($buy_num > $prop['item_num'] || $buy_num <= 0) { $this->throw_error('80914'); //购买数量不正确 } if ($prop['player_id'] == $player_id) { $this->throw_error('80915'); //购买数量不正确 } $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'vip', 'gold', 'name', 'player_id', 'privilege_level')); $has_gold = $player_info['gold']; $price = $auction_data['sell_price'] / $prop['item_num']; $need_gold = ceil($price * $buy_num); $this->get_data('Player')->check_player_resource($player_id, $player_info, "-", 'gold', $need_gold); $this->start_trans(); $reward[] = array('type' => 'prop', 'item_id' => $prop['prop_id'], 'item_num' => $buy_num); $result = $this->get_game('Reward')->send_reward($player_id, $reward, array('cmd_id' => '774')); if ($result !== true) { $this->throw_error($result); } if ($result) { // $result = $this->get_data('Player')->update_player_info($player_id,array('gold'=>"-".$need_gold)); $arr_consume = array('price' => $price, 'gold' => $need_gold, 'ticket' => 0, 'count' => $buy_num); #数据中心推送 $result = $this->get_data('Player')->update_player_resource($player_id, $player_info, 774, array(), $arr_consume); } if ($result) { if ($buy_num < $prop['item_num']) { $prop['item_num'] = $prop['item_num'] - $buy_num; $sell_price = $auction_data['sell_price'] - $need_gold; $this->get_data('Auction')->set_auction($auction_id, array('prop_info' => $prop, 'sell_price' => $sell_price)); } else { $prop['item_num'] = 0; $this->get_data('Auction')->del_auction($auction_id); } } $prop_config = Cache_Prop::getInstance()->get_prop_info($prop['prop_id']); $attachment_gold = 0; $objApi = TenYear::getInstance('Com_Uzapi'); $ip = $this->get_cross('Base')->get_server_ip($auction_data['server_id']); $objApi->setServerUrl($ip); if ($result) { $factorage = $need_gold * ($this->_factorage / 100); $factorage = ceil($factorage); $attachment_gold = $need_gold - $factorage; $attachment = array(array("prop_id" => Cache_Currency::getInstance()->get_index('ticket'), "prop_num" => $attachment_gold)); $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info(7); $content = sprintf($phrase_config['content'], $player_info['name'], $prop_config['name'] . '*' . $buy_num, $factorage, $attachment_gold); //"{$player_info['name']} 购买了你出售的 {$prop_config['name']}*{$buy_num} ,扣除手续费{$factorage}钻,你获得了 {$need_gold}钻。"; if ($auction_data['server_id'] == SERVER_ID) { $result = $this->get_game('Mail')->async_trigger_mail($auction_data['player_id'], $phrase_config['title'], $content, $attachment, $phrase_config['sender'], 1, 774); } else { $objApi->setReqData(array("action" => "PlayerInfo", "command" => "send_mail", "player_id" => $auction_data['player_id'], 'title' => $phrase_config['title'], 'content' => $content, 'attachment' => json_encode($attachment), 'sender' => $phrase_config['sender'])); $response = $objApi->sendRequest(); if (!empty($response['return']) && $response['return'] != 1) { $result = false; } } } if ($result) { $this->commit(); #数据中心推送 // if($need_gold > 0){ // $params['act'] = 774; // $params['price'] = $price; // $params['gold'] = $need_gold; // $params['black_gold'] = 0; // $params['count'] = $buy_num; // $params['time'] = time(); // Com_DataCenter::getInstance()->publish_data($player_id,'prop',$params); // } $this->get_game('Reward')->add_reward_log(); //购买日志 Log_Trade::getInstance()->add_trade_log($player_id, $player_info['level'], $player_info['vip'], $player_info['privilege_level'], 2, $prop['prop_id'], $prop_config['name'], $prop['quality'], $buy_num, $prop['item_num'], $prop['level'], $prop, 2, $need_gold); //被购买日志 $prop['buyer_id'] = $player_id; $seller_info = array(); if ($auction_data['server_id'] == SERVER_ID) { $seller_info = $this->get_data('Player')->get_player_info($auction_data['player_id'], array('level', 'vip', 'privilege_level')); } else { $objApi->setReqData(array("action" => "PlayerInfo", "command" => "get_player_info", "player_id" => $auction_data['player_id'])); $response = $objApi->sendRequest(); if (!empty($response['return'])) { $seller_info = $response['return']; } } Log_Trade::getInstance()->add_trade_log($auction_data['player_id'], $seller_info['level'], $seller_info['vip'], $seller_info['privilege_level'], 3, $prop['prop_id'], $prop_config['name'], $prop['quality'], $buy_num, $prop['item_num'], $prop['level'], $prop, 4, $attachment_gold); return array('result' => 1, 'auction_id' => $auction_id); } else { $this->rollback(); } return array('result' => 0, 'auction_id' => $auction_id); }
<?php /** * Created by PhpStorm. * User: chengt * Date: 14-4-9 * Time: 下午5:45 */ define('UUZU_AUTH', 2); require_once '../global.php'; TenYear::getInstance(); header("Content-type: text/html; charset=UTF-8"); $player_id = 348; $result = TenYear::getInstance('Game_PlayerFB')->get_max_min_lv_info($player_id); # 昵称 var_export($result);
public function run() { TenYear::getInstance(TenYear::game_name('GrabTreasure'))->crontab_kf_player_info(1); }
/** * 添加日志 * @param array $log *type 默认按 月分表 month * year,day */ public function add_log($data, $type = 'day') { if (!isset($data['player_id']) || !isset($data['channel'])) { return false; } $log = array(); if ($data['type'] == 1) { if (intval($data['after_amount']) == 0) { $data['after_amount'] = $data['amount'] + $data['item_num']; } } elseif ($data['type'] == 2) { if (intval($data['after_amount'] == 0)) { $data['after_amount'] = $data['amount'] - $data['item_num']; } } if (isset($data['front_attr']) && !empty($data['front_attr']) && is_array($data['front_attr'])) { $data['front_attr'] = json_encode($data['front_attr']); } if (isset($data['after_attr']) && !empty($data['after_attr']) && is_array($data['after_attr'])) { $data['after_attr'] = json_encode($data['after_attr']); } foreach ($this->common_fields as $key => $val) { $log[$key] = isset($data[$key]) && !empty($data[$key]) ? $data[$key] : $val; } if (!isset($data['add_time'])) { $log['add_time'] = time(); } else { $log['add_time'] = $data['add_time']; } if (isset($data['reg_time'])) { $log['reg_time'] = $data['reg_time']; } # -------------------------------------------------------------------- # 活动日志记录 # -------------------------------------------------------------------- # 记录消费日志,跳过经验消耗日志,Game/Reward.php下经验在同一时刻可能消耗多次,造成主键冲突 # 需要提供item_id和cmd2的白名单,用来过滤,避免记录大量无用数据产生性能瓶颈 $whitelist_cmd_id = array(); $whitelist_item_id = TenYear::getInstance('Game_Event')->get_whitelist_for_item_id(); $resource_channel_hash = $this->get_resource_channel(); $whitelist_channel = array_merge($resource_channel_hash, array(17, 19)); if (in_array($data['channel'], $whitelist_channel) && (in_array($data['item_id'], $whitelist_item_id) || $data['item_type'] == 1) && ($data['type'] == 2 || $data['type'] == 5) && !empty($data['item_id']) && !empty($data['item_num']) && $data['item_id'] != 1) { $time = time(); $event_log_info = array('log_type' => 'item_consume', 'player_id' => $data['player_id'], 'reg_time' => $time, 'player_prop_id' => $data['player_prop_id'] ? $data['player_prop_id'] : 0, 'item_id' => $data['item_id'], 'item_num' => $data['item_num'], 'item_type' => intval($data['item_type']), 'item_sub_type' => intval($data['item_sub_type']), 'cmd2' => $data['cmd_id']); TenYear::getInstance('Game_Event')->async_deal_event_log($event_log_info); } $this->log_write($log, $type); return true; }
public function set_dummy_role_in_ladder_other($player_id_list_hash) { $obj_game_challenge = TenYear::getInstance('Game_Challenge'); $obj_data_challenge = TenYear::getInstance('Data_Challenge'); $cur_auto_challenge_rank = $obj_data_challenge->get_auto_challenge_rank_value(); # 当前天梯榜入榜人数 $challenge_partition_boundary = $obj_game_challenge->challenge_partition_boundary; # 天梯榜上限人数 $player_id_list = array_values($player_id_list_hash); $player_count = count($player_id_list); echo "Current player_count = {$player_count} ...\n"; echo "Current auto_challenge_rank = {$cur_auto_challenge_rank} ...\n"; $offset = $challenge_partition_boundary > $player_count ? $player_count - $cur_auto_challenge_rank : $challenge_partition_boundary - $cur_auto_challenge_rank; echo "Current offset = {$offset} ...\n"; $max_rank = $obj_data_challenge->get_new_challenge_rank($offset); echo "Current max_rank = {$max_rank} ...\n"; for ($i = $cur_auto_challenge_rank + 1; $i <= $max_rank; $i++) { $rank_info = array('player_id' => $player_id, 'rank' => $i, 'mod_date' => $this->challenge_current_time, 'latest_reward_time' => 0, 'is_in_battle' => 0, 'in_battle_time' => 0, 'challenge_status' => 0, 'fake_rank' => 0, 'fake_battle_num' => 0, 'fake_rank_list' => array()); $re = $obj_data_challenge->update_challenge_rank_info($rank_info); } echo "Total {$i} player take part in ladder...\n"; }
/** * 判断是否在线 * @param $session_id * @return bool */ public function is_online($session_id) { $objSession = TenYear::getInstance('session'); $data = $objSession->read_session($session_id); if (empty($data)) { return false; } return true; }
# 生成天梯与竞技场假人数据 # ---------------------------------------------------------------------------- file_put_contents($logFile, "生成天梯与竞技场假人数据...\n", FILE_APPEND); $output = array(); exec("/usr/local/webserver/php/bin/php " . PROJECT_ROOT . "/test/generate_dummy_role.php 0", $output, $return_val); if ($return_val) { # return_val不为0表示脚本报异常,执行失败 file_put_contents($logFile, "生成天梯与竞技场假人数据失败...\n", FILE_APPEND); exit; } file_put_contents($logFile, "生成天梯与竞技场假人数据成功...\n", FILE_APPEND); # ---------------------------------------------------------------------------- # 对空天梯榜前20名插入机器人 # ---------------------------------------------------------------------------- try { $result = TenYear::getInstance('Game_Challenge')->fill_empty_challenge(); if ($result) { echo '对空天梯榜前20名插入机器人成功...\\n'; } else { echo '对空天梯榜前20名插入机器人失败[天梯榜不为空]...\\n'; } } catch (Exception $e) { echo 'Caught Exception: [code = ', $e->getCode(), "] ", $e->getMessage(), " ", $e->getFile(), " ", $e->getline(), "\n"; echo '对空天梯榜前20名插入机器人失败...\\n'; } # ---------------------------------------------------------------------------- shell_exec("sudo /etc/init.d/memcached restart"); shell_exec("/usr/local/webserver/php/bin/php /data/code/web/crontab/process.php"); shell_exec("sudo /etc/init.d/mfc++server start"); file_put_contents($logFile, "清档成功", FILE_APPEND); file_put_contents($logFile1, time());
/** * 道具属性结构体 * @param $data * @return array */ public static function get_item_additions(&$data) { $attr_index = Cache_ItemKey::getInstance()->get_item_key(); $role_index = Cache_RoleKey::getInstance()->get_item_key(); // echo "sub_type:".$data['sub_type']."<br>"; $out = array(); $arr_other = array(); $fpower_calc = array(); $fpower_base_calc = array(); if ($data['type'] == 1 || $data['type'] == 6) { if (empty($data['player_prop_id'])) { // $attrData = Cache_EquipBaseAttr::getInstance()->get_equip_base_attr($data['sub_type'],$data['quality'],$data['level'],$data['star_level']); $obj = new Game_Prop(); $attrData = $obj->get_equip_attr($data); unset($obj); // Com_Log::log($attrData,'cache_prop',1); $data['base_attr'] = $attrData['base_attr']; $data['addition_attr'] = $attrData['addition_attr']; $data['base_attr'] = $attrData['base_attr']; $data['level'] = $attrData['level']; $data['intensive_level'] = $attrData['intensive_level']; $data['intensive_desc'] = $attrData['intensive_desc']; } # ---------------------------------------------------------------- # 星图加成信息 # ---------------------------------------------------------------- $star_map = array(); $we_swallow_revise_info = array(); if (!empty($data['star_map_desc'])) { if (is_string($data['star_map_desc'])) { $data['star_map_desc'] = json_decode($data['star_map_desc'], true); } $star_map = self::parse_star_map($data['star_map_desc']); } # ---------------------------------------------------------------- # 基础属性 # ---------------------------------------------------------------- if (!empty($data['base_attr'])) { if (is_string($data['base_attr'])) { $data['base_attr'] = json_decode($data['base_attr'], true); } list($key, $val) = each($data['base_attr']); //基础属性 就一个 # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; # ---------------------------------------------------------------- # 强化属性加成 # ---------------------------------------------------------------- if (!empty($data['intensive_desc'])) { if (is_string($data['intensive_desc'])) { $data['intensive_desc'] = json_decode($data['intensive_desc'], true); } list($i_key, $i_val) = each($data['intensive_desc']); //强化属性 if ($i_key == 'atk' || $i_key == 'atk_max') { $i_key = 'atk_min'; } if (isset($star_map['intensify'])) { $i_val += ceil($i_val * ($star_map['intensify'] / 10000)); //星图加成 } $fpower_calc[$i_key] += $i_val; } $fpower_calc[$key] += $val; $out[] = array(0 => intval($attr_index['equip_base_val']), 1 => array(0 => $role_index[$key], 1 => ceil($val), 2 => 0, 3 => $i_val)); } # ---------------------------------------------------------------- # 附加属性 # ---------------------------------------------------------------- if (!empty($data['addition_attr']) && is_array($data['addition_attr'])) { $out_additional = array(); foreach ($data['addition_attr'] as $key => $val) { # -------------------------------------------------------- # 翅膀装备吞噬属性加成 # -------------------------------------------------------- if (!empty($data['we_swallow_info']) && is_array($data['we_swallow_info']['swallow_attr'])) { if (isset($data['we_swallow_info']['swallow_attr'][$key])) { $add_val = $data['we_swallow_info']['swallow_attr'][$key]; if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_calc[$key] += $add_val; } } # -------------------------------------------------------- # 星图加成 # -------------------------------------------------------- if (isset($star_map['additional'])) { $val += $val * ($star_map['additional'] / 10000); } # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; if (in_array($key, Cache_AttrConfig::getInstance()->get_percent_key())) { $show_type = 1; //前端显示百分比 } else { $show_type = 0; } $out_additional[] = array(0 => $role_index[$key], 1 => ceil($val), 2 => $show_type, 3 => ceil($add_val), 'sort_priority' => self::$_sort_priority[$key]); $fpower_calc[$key] += $val; } # 排序 Com_Array::multisort($out_additional, array('sort_priority' => 'asc')); unset($out_additional['sort_priority']); $out[] = array(0 => $attr_index['equip_additional'], 1 => $out_additional); } # ---------------------------------------------------------------- # 洗练属性 # ---------------------------------------------------------------- if ($data['type'] == 1) { # 只有装备类才获取 if (empty($data['refine_attr']) || empty($data['refine_info'])) { # 为空显示默认洗练属性 if (!Com_Util::is_first_charge_item($data['prop_id'])) { list($data['refine_attr'], $data['refine_info']) = TenYear::getInstance('Game_EquipRefine')->extend_refine($data['sub_type'], $data['level']); } } if (!empty($data['refine_attr']) && is_array($data['refine_attr'])) { $out_refine = array(); $attr_perfection_sum = 0; $attr_progress_sum = 0; foreach ($data['refine_attr'] as $attr_seq => $attr_info) { # -------------------------------------------------------- # 注意,这两项的取值必须在key做转换之前,否则在key转换后可能导致取不到值 # -------------------------------------------------------- $attr_limit = $data['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] + $data['refine_info']['attr_info'][$attr_seq]['attr_stint']; $attr_ratio = $data['refine_info']['attr_info'][$attr_seq]['attr_ratio']; $attr_progress = ceil($data['refine_info']['attr_info'][$attr_seq]['en_refine_attr_value'] / $data['refine_info']['attr_info'][$attr_seq]['attr_stint'] * 10000); # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if (!is_array($attr_info)) { continue; } # TODO: 为了兼容旧的洗练数据,以后要清档上功能,可以除去这行 list($key, $val) = each($attr_info); if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; $fpower_calc[$key] += $val; $out_refine[] = array(0 => $role_index[$key], 1 => ceil($val), 2 => 0, 3 => $attr_limit, 'sort_priority' => self::$_sort_priority[$key]); $attr_perfection_sum += $attr_ratio; $attr_progress_sum += $attr_progress; } # 排序 Com_Array::multisort($out_refine, array('sort_priority' => 'asc')); unset($out_refine['sort_priority']); $out[] = array(0 => $attr_index['equip_refine'], 1 => $out_refine); $out[] = array(0 => $attr_index['equip_refine_perfection'], 1 => ceil($attr_perfection_sum / 5)); $out[] = array(0 => $attr_index['equip_en_refine_progress'], 1 => ceil($attr_progress_sum / $data['refine_info']['last_refine_type'])); } } #策划要一个道具的基础属性战力 $fpower_base = Formula_Fpower::calc_fpower($fpower_base_calc); $out[] = array(0 => intval($attr_index['raw_fpower']), 1 => $fpower_base); # ---------------------------------------------------------------- # 强化等级 # ---------------------------------------------------------------- if (!empty($data['intensive_level'])) { $out[] = array(0 => $attr_index['intensive_level'], 1 => $data['intensive_level']); } # ---------------------------------------------------------------- # 最大强化等级 # ---------------------------------------------------------------- if ($data['type'] == 1) { # 只有装备类才获取 $intensify_lv_limit = TenYear::getInstance('Game_EquipIntensifier')->get_intensify_lv_limit_by_item_level($data['level']); $out[] = array(0 => $attr_index['intensify_max'], 1 => $intensify_lv_limit); } # ---------------------------------------------------------------- # 强化属性 # ---------------------------------------------------------------- if (!empty($data['intensive_desc'])) { if (is_string($data['intensive_desc'])) { $data['intensive_desc'] = json_decode($data['intensive_desc'], true); } $val = 0; list($key, $val) = each($data['intensive_desc']); //强化属性 # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } if (isset($star_map['intensify'])) { $val += ceil($val * ($star_map['intensify'] / 10000)); //星图加成 } $fpower_calc[$key] += $val; $out[] = array(0 => $attr_index['equip_strengthen_val'], 1 => $val); } # ---------------------------------------------------------------- # 翅膀装备吞噬等级与经验 # ---------------------------------------------------------------- if ($data['type'] == 6) { # 只有翅膀装备类才获取 if (!empty($data['we_swallow_info'])) { $out[] = array(0 => $attr_index['wing_equip_swallow_lv'], 1 => $data['we_swallow_info']['swallow_lv']); $out[] = array(0 => $attr_index['wing_equip_swallow_exp'], 1 => $data['we_swallow_info']['swallow_exp']); } else { $out[] = array(0 => $attr_index['wing_equip_swallow_lv'], 1 => 0); $out[] = array(0 => $attr_index['wing_equip_swallow_exp'], 1 => 0); } } # ---------------------------------------------------------------- # 镶嵌宝石属性 # ---------------------------------------------------------------- $gem_item = array(); $gem_configs = array(); $hole_stint = TenYear::getInstance('Game_EquipInlayGems')->get_prop_inlay_gem_hole_stint($data); # 孔位上限 for ($i = 1; $i <= $hole_stint; $i++) { //镶嵌部分 if (!empty($data['inlay_gems'][$i])) { $gem_id = $data['inlay_gems'][$i]; if (!isset($gem_configs[$gem_id])) { $gem_configs[$gem_id] = Cache_Forge::getInstance()->get_inlay_gems_by_id($gem_id); } $attr = self::parse_gem_config_attr($gem_configs[$gem_id]); $out_additional = array(); $gem_fpower = 0; if (!empty($attr)) { foreach ($attr as $key => $val) { if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } if (isset($star_map['gem'])) { $val += ceil($val * ($star_map['gem'] / 10000)); //星图加成 } /** if(in_array($key,Cache_AttrConfig::getInstance()->get_percent_key())){ $show_type = 1; //前端显示百分比 } else{ $show_type = 0; } **/ if (isset($role_index[$key])) { $fpower_calc[$key] += $val; $out_additional[] = array(0 => $role_index[$key], 1 => intval($val)); } } $gem_fpower += Formula_Fpower::calc_fpower($attr); } $gem_item[] = array(0 => $i, 1 => self::get_prop_struct($gem_configs[$gem_id]), 2 => $gem_fpower, 3 => $out_additional); //0 sid 1 战力 2 属性 } else { $gem_item[] = array(0 => $i, 1 => array(), 2 => 0, 3 => array()); //0 sid 1 战力 2 属性 } } $out[] = array(0 => $attr_index['gem'], 1 => $gem_item); //星图属性 if (isset($data['star_map_id']) && $data['star_map_id'] > 0) { $star_attr = array(); $star_map_config = Cache_Prop::getInstance()->get_prop_info($data['star_map_id']); $star_attr['star'] = self::get_prop_struct($star_map_config); $star_attr['power'] = 0; //战力计算 $star_attr['property'] = array(); $star_map_info = Cache_Forge::getInstance()->get_star_map_config_byid($data['star_map_id']); if ($star_map_info) { foreach ($star_map_info as $k => $v) { $a = array(); $a['addition_type'] = self::$_star_map_attr_enum[$v['data']]; #$a['addition_key'] = $v['data']; $a['addition_val'] = $v['data_value']; if (isset($attr_index[$k])) { // if(!isset($attr_index[$k])){ // Com_Log::log($k,'addition',1); // } $a['condition_type'] = 0; $a['condition_key'] = array('k' => $attr_index[$k], 'v' => $v['limit_value'], 'per' => 0); } else { if ($k == 'inlay_gems_lv') { $a['condition_type'] = 1; } elseif ($k == 'inlay_gems') { $a['condition_type'] = 2; } elseif ($k == 'activate') { $a['condition_type'] = 3; } $a['condition_key'] = array('k' => 0, 'v' => $v['limit_value'], 'per' => 0); } $star_attr['property'][] = $a; } } $out[] = array(0 => $attr_index['star'], 1 => $star_attr); } # ---------------------------------------------------------------- # 吞噬属性:需要写死传回已配置的所有吞噬属性,即便当前道具尚未有激活任意项吞噬属性,也需要用初始值填充 # ---------------------------------------------------------------- list($allow_swallow_sub_type, $allow_swallow_id) = TenYear::getInstance('Game_EquipSwallow')->get_swallow_restriction_info($data['sub_type']); $distinct_swallow_list = Cache_Forge::getInstance()->get_distinct_swallow_list(); foreach ($distinct_swallow_list as $swallow_info) { if (!empty($allow_swallow_id) && !in_array($swallow_info['swallow_id'], $allow_swallow_id)) { continue; } $swallow[$swallow_info['swallow_id']] = array('swallow_id' => $swallow_info['swallow_id'], 'swallow_lv' => 0, 'swallow_exp' => 0); } if (!empty($data['swallow_info'])) { foreach ($data['swallow_info'] as $swallow_id => $swallow_info) { $swallow[$swallow_id] = array('id' => $swallow_info['swallow_id'], 'lv' => $swallow_info['swallow_lv'], 'value' => $swallow_info['swallow_exp']); } } $out[] = array(0 => $attr_index['swallow'], 1 => $swallow); if (!empty($data['equip_view'])) { if (is_string($data['equip_view'])) { $equip_view = $data['equip_view']; } else { $equip_view = implode(':', $data['equip_view']); } if ($equip_view == '0:0:0:0' || $equip_view == '0:0:0') { $equip_view = ''; } } $out[] = array(0 => $attr_index['equip_view'], 1 => $equip_view); if (!empty($fpower_calc)) { // Com_Log::log('============[start]===========','equip_fpower',1); // Com_Log::log("prop_id:{$data['prop_id']}",'equip_fpower',1); // Com_Log::log($fpower_calc,'equip_fpower',1); $data['fpower'] = Formula_Fpower::calc_fpower($fpower_calc); // Com_Log::log("fpower:{$data['fpower']}",'equip_fpower',1); // Com_Log::log('============[end]===========','equip_fpower',1); } else { $data['fpower'] = 0; } } foreach (self::$_out_base_keys as $key) { if ($key == 'bind_type') { #特殊处理下 if (isset($attr_index[$key]) && isset($data['bind_flag'])) { $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data['bind_flag'])); } } elseif ($key == 'star_level') { if ($data['star_level'] > 10) { $data['star_level'] = $data['show_star']; } $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data['star_level'])); } else { if (isset($attr_index[$key]) && isset($data[$key]) && !empty($data[$key])) { $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data[$key])); } } } return $out; }
public function recover($suffix) { $backup_file = "flush.refine.bak." . $suffix; #$fh = fopen($backup_file, "r") or exit("Failed to open $backup_file ...\n"); $lines = file($backup_file); if (empty($lines)) { return false; } #var_export($lines); $obj_data_prop = TenYear::getInstance('Data_PlayerProp'); foreach ($lines as $line_num => $line) { list($player_id, $prop_info) = explode("\t", $line); $prop_info = json_decode($prop_info, true); echo "Recover prop info for player_id={$player_id} ...\n"; #var_export($prop_info); $re = $obj_data_prop->update_player_prop($prop_info, $prop_info); } }
$obj = new Skillrune(); switch ($_POST['cmd']) { case 'get_skillrune_list': if (!$_POST['player_id']) { exit('参数错误'); } $skillrune_list = $obj->get_skillrune_list($_POST['player_id']); break; case 'activate_rune': $obj->activate_rune($_POST['player_id'], $_POST['skill_id'], $_POST['rune_id']); $skillrune_list = $obj->get_skillrune_list($_POST['player_id']); break; default: break; } $playerItem = TenYear::getInstance('Data_Player')->get_player_info($_SESSION['player_id']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="zh-CN"> <head> <title>xgame游戏管理 - 符文管理</title> <link rel="stylesheet" type="text/css" href="styles_ope.css"> <link rel="stylesheet" type="text/css" href="kaito.css"> <script type="text/javascript"> function activeConfirm(x){ return confirm("Are you sure to activate this rune? ["+x+"]"); } </script> </head>
public static function getInstance() { return TenYear::getInstance(__CLASS__); }
public static function get_vip_special_reward_add_coeff($func_id, $player_vip, $player_privilege_level, $player_id) { $vip_limit_type = Cache_VipLevelLimit::getInstance()->get_limit_info_func_id($func_id); if ($vip_limit_type['fun_type'] == 1 && !empty($player_vip)) { $vip_limit_info = Cache_VipLevelLimit::getInstance()->get_limit_info($player_vip, $func_id); } elseif ($vip_limit_type['fun_type'] == 2 && !empty($player_privilege_level)) { $left_time = TenYear::getInstance('Game_VipSpecial')->get_left_time($player_id); if ($left_time > 0) { $vip_limit_info = Cache_VipLevelLimit::getInstance()->get_limit_info($player_privilege_level, $func_id); } } $vip_add_coeff = !empty($vip_limit_info) ? $vip_limit_info['max_times'] / 10000 : 0; return $vip_add_coeff; }