本文整理汇总了PHP中TenYear::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP TenYear::getInstance方法的具体用法?PHP TenYear::getInstance怎么用?PHP TenYear::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TenYear
的用法示例。
在下文中一共展示了TenYear::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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";
}
}
}
}
}
示例2: achieve_repair
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";
}
示例3: doAction
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;
}
示例4: get_cross
protected function get_cross($name, $isOne = false)
{
$className = TenYear::cross_name($name);
if ($isOne) {
return new $className();
}
$this->_objData[$className]++;
return TenYear::getInstance($className);
}
示例5: handle_dirty_data
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";
}
示例6: add_unions
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;
}
}
示例7: fb
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";
}
}
示例8: get_search_list
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;
}
示例9: run
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);
}
}
}
}
}
示例10: handle_fashion_for_dummy
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));
}
}
示例11: get_top_three
/**
* 获取前三
* @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();
}
示例12: get_player_panel_info
/**
* 人 物面板信息
* @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());
}
}
}
示例13: grab_treasure_battle
/**
* 获取挑战双方战斗信息
* @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);
# 获取保护时间
//.........这里部分代码省略.........
示例14: array
$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);
}
}
示例15: flush_sum_fpower_for_dummy
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));
}