1
This commit is contained in:
parent
5cecae6f6c
commit
30241e3cb1
26
doc/BattleHistory.py
Normal file
26
doc/BattleHistory.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import _common
|
||||
|
||||
class BattleHistory(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis = [
|
||||
{
|
||||
'name': 'getBattleList',
|
||||
'desc': '历史战绩',
|
||||
'group': 'BattleHistory',
|
||||
'url': 'webapp/index.php?c=BattleHistory&a=getBattleList',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['target_id', '', ' 用户 account'],
|
||||
['room_mode', '', ' 0:pvp 2:moba'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!data', [_common.BattleSettlementMembersInfo()], '战绩数据'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
|
30
webapp/controller/BattleHistoryController.class.php
Normal file
30
webapp/controller/BattleHistoryController.class.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once('models/BattleSettlement.php');
|
||||
require_once('models/BattleHistory.php');
|
||||
|
||||
|
||||
use models\BattleSettlement;
|
||||
use models\BattleHistory;
|
||||
class BattleHistoryController extends BaseAuthedController {
|
||||
|
||||
public function getBattleList(){
|
||||
$accountId = getReqVal('target_id', 0);
|
||||
$room_mode = getReqVal('room_mode', 0);
|
||||
if (!$accountId){
|
||||
$accountId = myself()->_getAccountId();
|
||||
}
|
||||
$singleList = BattleSettlement::getSingleList($accountId,$room_mode);
|
||||
$historyList = BattleHistory::orderBy($singleList,'desc');
|
||||
$data = array();
|
||||
foreach ($historyList as $k=>$history){
|
||||
if ($k < 40){
|
||||
array_push($data,$history);
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'data' => $data
|
||||
));
|
||||
}
|
||||
|
||||
}
|
@ -128,11 +128,6 @@ class UserController extends BaseAuthedController {
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => 500000
|
||||
));
|
||||
array_push($addItems,
|
||||
array(
|
||||
'item_id' => V_ITEM_STAR,
|
||||
'item_num' => 400
|
||||
));
|
||||
}
|
||||
|
||||
$awardService = new services\AwardService();
|
||||
@ -815,32 +810,53 @@ class UserController extends BaseAuthedController {
|
||||
}
|
||||
$param = 0.95;
|
||||
$r = (2*$param-1) / (1-$param);
|
||||
$h = \mt\Parameter::getVal("radar_axis_min",0.2);
|
||||
if ($gameTimes >= Battle::VALID_GAME_TIMES){
|
||||
// t=x/u r=(2s-1)/(1-s)
|
||||
$t1 = $userChartData['pvp_server_data']['pvp_kills_avg']>0 ? ($killsPer / $userChartData['pvp_server_data']['pvp_kills_avg']) :0;
|
||||
$pvpData['star_kills'] = round((pow($r,$t1) - 1) / (pow($r,$t1)+$r-2),2);
|
||||
$y1 = (pow($r,$t1) - 1) / (pow($r,$t1)+$r-2);
|
||||
$pvpData['star_kills'] = round((1-$h) * $y1 + $h ,2);
|
||||
// $pvpData['star_kills'] = round((pow($r,$t1) - 1) / (pow($r,$t1)+$r-2),2);
|
||||
$t2 = $userChartData['pvp_server_data']['pvp_alive_avg']>0 ? ($alivePer / $userChartData['pvp_server_data']['pvp_alive_avg']) :0;
|
||||
$pvpData['star_alive'] = round((pow($r,$t2) - 1) / (pow($r,$t2)+$r-2),2);
|
||||
$y2 = (pow($r,$t2) - 1) / (pow($r,$t2)+$r-2) ;
|
||||
$pvpData['star_alive'] = round((1-$h) * $y2 + $h ,2);
|
||||
// $pvpData['star_alive'] = round((pow($r,$t2) - 1) / (pow($r,$t2)+$r-2),2);
|
||||
$t3 = $userChartData['pvp_server_data']['pvp_assist_avg']>0 ? ($assistPer / $userChartData['pvp_server_data']['pvp_assist_avg']) :0;
|
||||
$pvpData['star_assist'] = round((pow($r,$t3) - 1) / (pow($r,$t3)+$r-2),2);
|
||||
$y3 = (pow($r,$t3) - 1) / (pow($r,$t3)+$r-2) ;
|
||||
$pvpData['star_assist'] = round((1-$h) * $y3 + $h ,2);
|
||||
// $pvpData['star_assist'] = round((pow($r,$t3) - 1) / (pow($r,$t3)+$r-2),2);
|
||||
$t4 = $userChartData['pvp_server_data']['pvp_damage_avg']>0 ? ($damagePer / $userChartData['pvp_server_data']['pvp_damage_avg']) :0;
|
||||
$pvpData['star_damage'] = round((pow($r,$t4) - 1) / (pow($r,$t4)+$r-2),2);
|
||||
$y4 = (pow($r,$t4) - 1) / (pow($r,$t4)+$r-2);
|
||||
$pvpData['star_damage'] = round((1-$h) * $y4 + $h ,2);
|
||||
// $pvpData['star_damage'] = round((pow($r,$t4) - 1) / (pow($r,$t4)+$r-2),2);
|
||||
$t5 = $userChartData['pvp_server_data']['pvp_recover_avg']>0 ? ($recoverHpPer / $userChartData['pvp_server_data']['pvp_recover_avg']) :0;
|
||||
$pvpData['star_recover'] = round((pow($r,$t5) - 1) / (pow($r,$t5)+$r-2),2);
|
||||
$y5 = (pow($r,$t5) - 1) / (pow($r,$t5)+$r-2);
|
||||
$pvpData['star_recover'] = round((1-$h) * $y5 + $h ,2);
|
||||
// $pvpData['star_recover'] = round((pow($r,$t5) - 1) / (pow($r,$t5)+$r-2),2);
|
||||
}
|
||||
|
||||
if ($gameTimesMoba >= Battle::VALID_GAME_TIMES){
|
||||
$t6 = $userChartData['moba_server_data']['moba_kills_avg']>0 ? ($killsPerMoba / $userChartData['moba_server_data']['moba_kills_avg']) :0;
|
||||
$mobaData['star_kills'] = round((pow($r,$t6) - 1) / (pow($r,$t6)+$r-2),2);
|
||||
$y6 = (pow($r,$t6) - 1) / (pow($r,$t6)+$r-2);
|
||||
$mobaData['star_kills'] = round((1-$h) * $y6 + $h ,2);
|
||||
// $mobaData['star_kills'] = round((pow($r,$t6) - 1) / (pow($r,$t6)+$r-2),2);
|
||||
$t8 = $userChartData['moba_server_data']['moba_assist_avg']>0 ? intval($assistPerMoba / $userChartData['moba_server_data']['moba_assist_avg']) :0;
|
||||
$mobaData['star_assist'] = round((pow($r,$t8) - 1) / (pow($r,$t8)+$r-2),2);
|
||||
$y8 = (pow($r,$t8) - 1) / (pow($r,$t8)+$r-2);
|
||||
$mobaData['star_assist'] = round((1-$h) * $y8 + $h ,2);
|
||||
// $mobaData['star_assist'] = round((pow($r,$t8) - 1) / (pow($r,$t8)+$r-2),2);
|
||||
$t9 = $userChartData['moba_server_data']['moba_damage_avg']>0 ? intval($damagePerMoba / $userChartData['moba_server_data']['moba_damage_avg']) :0;
|
||||
$mobaData['star_damage'] = round((pow($r,$t9) - 1) / (pow($r,$t9)+$r-2),2);
|
||||
$y9 = (pow($r,$t9) - 1) / (pow($r,$t9)+$r-2);
|
||||
$mobaData['star_damage'] = round((1-$h) * $y9 + $h ,2);
|
||||
// $mobaData['star_damage'] = round((pow($r,$t9) - 1) / (pow($r,$t9)+$r-2),2);
|
||||
$t10 = $userChartData['moba_server_data']['moba_recover_avg']>0 ? intval($recoverHpPerMoba / $userChartData['moba_server_data']['moba_recover_avg']) :0;
|
||||
$mobaData['star_recover'] = round((pow($r,$t10) - 1) / (pow($r,$t10)+$r-2),2);
|
||||
$y10 = (pow($r,$t10) - 1) / (pow($r,$t10)+$r-2);
|
||||
$mobaData['star_recover'] = round((1-$h) * $y10 + $h ,2);
|
||||
// $mobaData['star_recover'] = round((pow($r,$t10) - 1) / (pow($r,$t10)+$r-2),2);
|
||||
|
||||
$paramMeta = mt\Parameter::getListValue("radar_moba_level");
|
||||
$mobaData['star_level'] = round(($levelPerMoba - $paramMeta[0]) / ($paramMeta[1] - $paramMeta[0]),2);
|
||||
$y7 = ($levelPerMoba - $paramMeta[0]) / ($paramMeta[1] - $paramMeta[0]);
|
||||
$mobaData['star_level'] = round((1-$h) * $y7 + $h ,2);
|
||||
// $mobaData['star_level'] = round(($levelPerMoba - $paramMeta[0]) / ($paramMeta[1] - $paramMeta[0]),2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ class BattleSettlement extends BaseModel
|
||||
const ROOM_MODE_PVP = 0;
|
||||
// const MATCH_MODE_MATCH = 1;
|
||||
const ROOM_MODE_PVE = 1;
|
||||
const ROOM_MODE_MOBA = 2;
|
||||
|
||||
const MATCH_MODE_PVP = 0;
|
||||
const MATCH_MODE_RANK = 1;
|
||||
@ -47,6 +48,18 @@ class BattleSettlement extends BaseModel
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function findSingle($battleUuid){
|
||||
$row = SqlHelper::ormSelectOne
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement_single',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function addSingle($battleUuid, $roomUuid, $data)
|
||||
{
|
||||
SqlHelper::upsert
|
||||
@ -56,7 +69,10 @@ class BattleSettlement extends BaseModel
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uuid' => $battleUuid,
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'data' => json_encode($data),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uuid' => $battleUuid,
|
||||
@ -68,7 +84,7 @@ class BattleSettlement extends BaseModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function getSingleList($accountId,$roomMode, $matchMode)
|
||||
public static function getSingleList($accountId,$roomMode)
|
||||
{
|
||||
$rows = SqlHelper::ormSelect
|
||||
(myself()->_getSelfMysql(),
|
||||
@ -77,36 +93,27 @@ class BattleSettlement extends BaseModel
|
||||
'account_id' => $accountId,
|
||||
)
|
||||
);
|
||||
$pvpMatchList = array();
|
||||
$pvpRankList = array();
|
||||
$pveMatchList = array();
|
||||
$pvpBattleList = array();
|
||||
$mobaBattleList = array();
|
||||
foreach ($rows as $row) {
|
||||
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||
if ($data['room_mode'] == self::ROOM_MODE_PVP && $data['pvp_mode'] == self::MATCH_MODE_PVP) {
|
||||
array_push($pvpMatchList, self::singleDto($row));
|
||||
} else if ($data['room_mode'] == self::ROOM_MODE_PVP && $data['pvp_mode'] == self::MATCH_MODE_RANK) {
|
||||
array_push($pvpRankList, self::singleDto($row));
|
||||
} else if ($data['room_mode'] == self::ROOM_MODE_PVE) {
|
||||
array_push($pveMatchList, self::singleDto($row));
|
||||
if ($data['room_mode'] == self::ROOM_MODE_PVP ) {
|
||||
array_push($pvpBattleList, self::singleDto($row));
|
||||
} else if ($data['room_mode'] == self::ROOM_MODE_MOBA) {
|
||||
array_push($mobaBattleList, self::singleDto($row));
|
||||
}
|
||||
}
|
||||
switch ($roomMode) {
|
||||
case self::ROOM_MODE_PVP :
|
||||
{
|
||||
switch ($matchMode) {
|
||||
case self::MATCH_MODE_PVP :
|
||||
{
|
||||
return $pvpMatchList;
|
||||
}
|
||||
case self::MATCH_MODE_RANK :
|
||||
{
|
||||
return $pvpRankList;
|
||||
}
|
||||
}
|
||||
return $pvpBattleList;
|
||||
}
|
||||
case self::ROOM_MODE_PVE :
|
||||
case self::ROOM_MODE_MOBA :
|
||||
{
|
||||
return $pveMatchList;
|
||||
return $mobaBattleList;
|
||||
}
|
||||
default : {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ class BattleRandAttribute {
|
||||
foreach ($strs as $str){
|
||||
$attrStr = explode(':', $str);
|
||||
$rnd = rand($attrStr[1]*100000 , $attrStr[2]*100000) / 100000;
|
||||
$val = $attrStr[1] + ($attrStr[2] - $attrStr[1]) * $rnd;
|
||||
// $val = $attrStr[1] + ($attrStr[2] - $attrStr[1]) * $rnd;
|
||||
array_push($attrArray,array(
|
||||
"attr_id" => $attrStr[0],
|
||||
"val" => $val,
|
||||
"val" => $rnd,
|
||||
));
|
||||
}
|
||||
return $attrArray;
|
||||
|
@ -135,6 +135,13 @@ class RoomBattleDataService extends BaseService {
|
||||
if ($userDb && $heroDb){
|
||||
$this->_getBattleRewards($userDb,$heroDb,$battleScore,$member['reward']);
|
||||
myself()->_addItems($member['reward'], $awardService,$propertyChgService);
|
||||
|
||||
$battleSingleDb = BattleSettlement::findSingle($this->battleSettlementDb['battle_uuid']);
|
||||
if ($battleSingleDb){
|
||||
$battleSingleData = emptyReplace(json_decode($battleSingleDb['data'], true), array());
|
||||
$battleSingleData['reward'] = $member['reward'];
|
||||
BattleSettlement::addSingle($battleSingleDb['battle_uuid'],$battleSingleDb['room_uuid'],$battleSingleData);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -165,7 +172,8 @@ class RoomBattleDataService extends BaseService {
|
||||
}
|
||||
//金币模式检验
|
||||
if ($this->mapMode == mt\MapMode::GOLD_MODE &&
|
||||
(!Hero::verifyValid($heroDb) || $goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
|
||||
($goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
|
||||
// (!Hero::verifyValid($heroDb) || $goldModeTimes >= $mapModeMeta['rewards_max_time'] )){
|
||||
error_log("金币模式:出战英雄没有打金时间或每日打金场次上限");
|
||||
}else{
|
||||
if (!empty($rewardMeta['goldLoot'])){
|
||||
|
@ -443,10 +443,12 @@ class TameBattleDataService extends BaseService {
|
||||
$battleUuid = getXVal($this->allInfo,'battle_uuid', 0);
|
||||
$roomUuid = getXVal($this->allInfo,'room_uuid', 0);
|
||||
|
||||
$oldRank = $this->userInfo['rank'];
|
||||
$newRank = $this->userInfo['rank'];
|
||||
$oldScore = $this->userInfo['score'];
|
||||
$newScore = $this->userInfo['score'];
|
||||
$oldElo = $this->userInfo['elo'];
|
||||
$newElo = $this->userInfo['elo'];
|
||||
|
||||
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||
myself()->_setV(TN_LAST_RANKING_TIME,0,getXVal($this->battleInfo,'game_time', 0));
|
||||
$winningPro = $this->celWinningPro($this->userInfo);
|
||||
@ -462,30 +464,72 @@ class TameBattleDataService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
// $data = array(
|
||||
// "battle_uuid" => $battleUuid,
|
||||
// "account_id" => getXVal($this->battleInfo,'account_id', 0),
|
||||
// "room_mode" => getXVal($this->allInfo,'room_mode', 0),
|
||||
// "pvp_mode" => $pvp_mode,
|
||||
// "team_mode" => getXVal($this->allInfo,'team_mode', 0),
|
||||
// "battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0),
|
||||
// "team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0),
|
||||
// "team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0),
|
||||
// "is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
// "kills" => getXVal($this->battleInfo,'kills', 0),
|
||||
// "hero_id" => getXVal($this->battleInfo,'hero_uniid', 0),
|
||||
// "weapon1" => getXVal($this->battleInfo,'weapon_uuid1', 0),
|
||||
// "weapon2" => getXVal($this->battleInfo,'weapon_uuid2', 0),
|
||||
// "battle_end_time" => getXVal($this->battleInfo,'game_time', 0),
|
||||
// "current_level_class" => $newRank,
|
||||
// "current_level_class_score" => $newScore,
|
||||
// "level_class_score_chg" => $newScore - $this->userInfo['score'], // 排位分改变
|
||||
// "pve_rank_score" => getXVal($this->battleInfo,'pve_score', 0),
|
||||
// "pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
// "pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0),
|
||||
//// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0),
|
||||
// "old_elo" => $this->userInfo['elo'],
|
||||
// "new_elo" => $newElo,
|
||||
// 'reward' => array(),
|
||||
// );
|
||||
$data = array(
|
||||
"battle_uuid" => $battleUuid,
|
||||
"account_id" => getXVal($this->battleInfo,'account_id', 0),
|
||||
"room_mode" => getXVal($this->allInfo,'room_mode', 0),
|
||||
"pvp_mode" => $pvp_mode,
|
||||
"team_mode" => getXVal($this->allInfo,'team_mode', 0),
|
||||
"battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0),
|
||||
"team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0),
|
||||
"team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0),
|
||||
"is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
"kills" => getXVal($this->battleInfo,'kills', 0),
|
||||
"hero_id" => getXVal($this->battleInfo,'hero_uniid', 0),
|
||||
"weapon1" => getXVal($this->battleInfo,'weapon_uuid1', 0),
|
||||
"weapon2" => getXVal($this->battleInfo,'weapon_uuid2', 0),
|
||||
"battle_end_time" => getXVal($this->battleInfo,'game_time', 0),
|
||||
"current_level_class" => $newRank,
|
||||
"current_level_class_score" => $newScore,
|
||||
"level_class_score_chg" => $newScore - $this->userInfo['score'], // 排位分改变
|
||||
"pve_rank_score" => getXVal($this->battleInfo,'pve_score', 0),
|
||||
"pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
"pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0),
|
||||
// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0),
|
||||
"old_elo" => $this->userInfo['elo'],
|
||||
"new_elo" => $newElo,
|
||||
"pvp_team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0),
|
||||
"pvp_team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0),
|
||||
'account_id'=> getXVal($this->battleInfo,'account_id', 0),
|
||||
'name'=> getXVal($this->battleInfo,'name', 0),
|
||||
'head'=> getXVal($this->battleInfo,'head', 0),
|
||||
'head_frame'=> getXVal($this->battleInfo,'head_frame', 0),
|
||||
'sex'=> getXVal($this->battleInfo,'sex', 0),
|
||||
'hero_uniid'=> getXVal($this->battleInfo,'hero_uniid', 0),
|
||||
'hero_id'=> getXVal($this->battleInfo,'hero_id', 0),
|
||||
'dead'=> getXVal($this->battleInfo,'dead', 0),
|
||||
'skin_id'=> getXVal($this->battleInfo,'skin_id', 0),
|
||||
'is_mvp'=> getXVal($this->battleInfo,'is_mvp', 0),
|
||||
'old_rank'=> $oldRank,
|
||||
'new_rank'=> $newRank,
|
||||
'old_score'=> $oldScore,
|
||||
'new_score'=> $newScore,
|
||||
'old_elo'=> $oldElo,
|
||||
'new_elo'=> $newElo,
|
||||
'pvp_kill'=> getXVal($this->battleInfo,'pvp_kill', 0),
|
||||
'pvp_damage'=> getXVal($this->battleInfo,'pvp_damage', 0),
|
||||
'pvp_assist'=> getXVal($this->battleInfo,'pvp_assist', 0),
|
||||
'pvp_survia_time'=> getXVal($this->battleInfo,'pvp_survia_time', 0),
|
||||
'pvp_recover'=> getXVal($this->battleInfo,'pvp_recover', 0),
|
||||
'pvp_rescue'=> getXVal($this->battleInfo,'pvp_rescue', 0),
|
||||
'pvp_personal_rank'=> getXVal($this->battleInfo,'pvp_personal_rank', 0),
|
||||
'pve_order'=> getXVal($this->battleInfo,'pve_order', 0),
|
||||
'pve_score'=> getXVal($this->battleInfo,'pve_score', 0),
|
||||
'pve_star'=> getXVal($this->battleInfo,'pve_star', 0),
|
||||
'pve_damage'=> getXVal($this->battleInfo,'pve_damage', 0),
|
||||
'pve_revive'=> getXVal($this->battleInfo,'pve_revive', 0),
|
||||
'pve_survia_time'=> getXVal($this->battleInfo,'pve_survia_time', 0),
|
||||
'pve_wave'=> getXVal($this->battleInfo,'pve_wave', 0),
|
||||
'pve_max_wave'=> getXVal($this->battleInfo,'pve_max_wave', 0),
|
||||
'pve_boss_killed'=> getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
'hero_lv'=> getXVal($this->battleInfo,'hero_lv', 1),
|
||||
'reward' => array(),
|
||||
);
|
||||
BattleSettlement::addSingle($battleUuid,$roomUuid,$data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user