战斗结算
This commit is contained in:
parent
bd51335cb9
commit
bafbe05c5a
@ -167,7 +167,7 @@ class UserBattleInfo(object):
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['user_info', [UserInfo()], '用户信息'],
|
||||
['hero_info', [HeroInfo()], '上阵英雄信息'],
|
||||
['hero_info', [Hero()], '上阵英雄信息'],
|
||||
]
|
||||
|
||||
class HonorInfo(object):
|
||||
@ -244,13 +244,13 @@ class UserChartInfo(object):
|
||||
['assist_avg', 0, '场均助攻'],
|
||||
['damage_avg', 0, '场均伤害'],
|
||||
['recover_avg', 0, '场均恢复'],
|
||||
['win_avg', 0, '场均胜率(4v4模式下才有)'],
|
||||
['alive_avg', 0, '场均生存(4v4模式下才有)'],
|
||||
['level_avg', 0, '场均等级(moba模式下才有)'],
|
||||
['star_kills', 0, '击败(5纬图-击败, 百分比数值整数部分)'],
|
||||
['star_damage', 0, '伤害(5纬图-伤害, 百分比数值整数部分)'],
|
||||
['star_alive', 0, '生存(5纬图-生存, 百分比数值整数部分)'],
|
||||
['star_assist', 0, '助攻(5纬图-生存, 百分比数值整数部分)'],
|
||||
['star_recover', 0, '治疗(5纬图-治疗, 百分比数值整数部分)'],
|
||||
['star_win', 0, '胜利(5纬图-胜利, 百分比数值整数部分,4v4模式下才有)'],
|
||||
['star_alive', 0, '生存(5纬图-胜利, 百分比数值整数部分,4v4模式下才有)'],
|
||||
['star_level', 0, '等级(5纬图-胜利, 百分比数值整数部分,moba模式下才有)'],
|
||||
]
|
||||
|
||||
@ -282,6 +282,10 @@ class Hero(object):
|
||||
['tags', '', '1:Gen状态'],
|
||||
['!avatarInfo', [AvatarInfo()], '装饰信息'],
|
||||
['ability', Ability(), '属性'],
|
||||
['lucky', 0, '幸运值'],
|
||||
['wealth', 0, '财富值'],
|
||||
['seal_type', 0, '0:未封存 1:已封存'],
|
||||
['unseal_time', 0, '解封时间'],
|
||||
]
|
||||
|
||||
class LevelingHero(object):
|
||||
@ -1147,6 +1151,7 @@ class TeamReportMember(object):
|
||||
['skin_id', 0, '皮肤id'],
|
||||
['move_distance', 0, '行走距离'],
|
||||
['full_level_idx', 0, '第几个满级索引(0:未满级 1:第一个 2:第二个等等)'],
|
||||
['hero_lv', 0, '游戏内英雄等级'],
|
||||
|
||||
['pvp_kill', 0, 'pvp击杀敌人数'],
|
||||
['pvp_damage', 0, 'pvp伤害总量'],
|
||||
|
@ -170,7 +170,11 @@ CREATE TABLE `t_hero` (
|
||||
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||
`base_attr` mediumblob COMMENT '初始随机属性(英雄重置时需要)',
|
||||
`activate_time` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间',
|
||||
`wealth_attr` mediumblob COMMENT '财富值属性',
|
||||
`seal_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:未封存 1:已封存',
|
||||
`unseal_time` int(11) NOT NULL DEFAULT '0' COMMENT '解开封时间',
|
||||
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `token_id` (`token_id`),
|
||||
KEY `account_id` (`account_id`)
|
||||
@ -245,12 +249,13 @@ CREATE TABLE `t_chip` (
|
||||
`chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级',
|
||||
`chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助',
|
||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:免费(GIFT标签)',
|
||||
`inlay_state` varchar(60) COMMENT '所镶嵌的芯片页id:1|2|3',
|
||||
`inlay_state` varchar(60) COMMENT '镶嵌状态 1:已镶嵌 0:未镶嵌',
|
||||
`rand_attr` mediumblob COMMENT '随机属性',
|
||||
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||
`quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶',
|
||||
`wealth_attr` mediumblob COMMENT '财富值属性',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
|
@ -1,8 +1,11 @@
|
||||
begin;
|
||||
|
||||
alter table t_hero add column `current_wealth` int(11) NOT NULL DEFAULT '0' COMMENT '当前财富值';
|
||||
alter table t_hero add column `current_wealth_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '当前财富值修改时间';
|
||||
-- alter table t_hero add column `current_wealth` int(11) NOT NULL DEFAULT '0' COMMENT '当前财富值';
|
||||
-- alter table t_hero add column `current_wealth_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '当前财富值修改时间';
|
||||
alter table t_hero add column `wealth_attr` mediumblob COMMENT '财富值属性';
|
||||
alter table t_hero add column `activate_time` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间';
|
||||
alter table t_hero add column `seal_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:未封存 1:已封存';
|
||||
alter table t_hero add column `unseal_time` int(11) NOT NULL DEFAULT '0' COMMENT '解封时间';
|
||||
alter table t_hero drop column base_attr;
|
||||
|
||||
alter table t_chip add column `wealth_attr` mediumblob COMMENT '财富值属性';
|
||||
|
@ -45,4 +45,22 @@ class HashRate extends BaseModel
|
||||
return $myHashRate;
|
||||
}
|
||||
|
||||
public static function getTotalByAccount($accountId,$period){
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hash_rate',
|
||||
array(
|
||||
'account_id' => $accountId,
|
||||
'period' => $period,
|
||||
)
|
||||
);
|
||||
$totalHashRate = 0;
|
||||
if ($rows){
|
||||
foreach ($rows as $row){
|
||||
$totalHashRate += $row['reward'];
|
||||
}
|
||||
}
|
||||
return $totalHashRate;
|
||||
}
|
||||
|
||||
}
|
@ -206,19 +206,10 @@ class Hero extends BaseModel {
|
||||
if (!$itemMeta) {
|
||||
return;
|
||||
}
|
||||
// $randAttr = array();
|
||||
|
||||
$fieldsKv = array(
|
||||
// 'hero_lv' => 1,
|
||||
// 'quality' => 1,
|
||||
// 'hero_tili' => 0,
|
||||
// 'state' => self::GETED_STATE,
|
||||
// 'skill_lv1' => 1,
|
||||
// 'skill_lv2' => 1,
|
||||
// 'rand_attr' => json_encode($randAttr),
|
||||
'lock_type' => self::NO_LOCK,
|
||||
'unlock_time' => 0,
|
||||
'unlock_trade_time' => 0,
|
||||
'activate' => 1,
|
||||
'activate_time' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
);
|
||||
self::updateByTokenId($row['token_id'],$fieldsKv);
|
||||
@ -258,7 +249,7 @@ class Hero extends BaseModel {
|
||||
$isSelect = 1;
|
||||
}
|
||||
$skinDb = HeroSkin::findBx($row['hero_id']);
|
||||
$attribute = self::celHeroWealthUpLimit($row);
|
||||
// $attribute = self::celHeroWealthUpLimit($row);
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
@ -285,10 +276,11 @@ class Hero extends BaseModel {
|
||||
'offer_reward_state' => 0,
|
||||
'tags' => isset($row['tags'])?$row['tags']:'',
|
||||
'is_select' => $isSelect,
|
||||
'lucky' => $attribute['lucky'],
|
||||
'current_wealth' => $row['current_wealth'],
|
||||
'wealth_uplimit' => $attribute['wealth'],
|
||||
'ability' => self::abilityInfo($row, $attr)
|
||||
'lucky' => self::getHeroLucky($row),
|
||||
'wealth' => self::getHeroWealth($row),
|
||||
'ability' => self::abilityInfo($row, $attr),
|
||||
'seal_type' => $row['seal_type'],
|
||||
'unseal_time' => $row['unseal_time'],
|
||||
);
|
||||
|
||||
// $nft_address = '';
|
||||
@ -332,6 +324,14 @@ class Hero extends BaseModel {
|
||||
);
|
||||
}
|
||||
|
||||
public static function getHeroWealth($row){
|
||||
return self::celHeroWealthUpLimit($row)["wealth"];
|
||||
}
|
||||
|
||||
public static function getHeroLucky($row){
|
||||
return self::celHeroWealthUpLimit($row)["lucky"];
|
||||
}
|
||||
|
||||
public static function avatarInfo($row){
|
||||
$avatarDbs = Avatar::getAvatarByHeroIdx($row['idx']);
|
||||
$avatarInfos = array();
|
||||
@ -530,16 +530,12 @@ class Hero extends BaseModel {
|
||||
}
|
||||
}
|
||||
$randAttr = self::getRandAttr($heroMeta['id']) ;
|
||||
{
|
||||
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $quality);
|
||||
$result = \mt\EconomyAttribute::getAttrValue($attribute);
|
||||
$wealth = floor($result['wealth'] * (1+$result['wealth_rate']));
|
||||
}
|
||||
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $quality);
|
||||
|
||||
$fieldsKv = array(
|
||||
'hero_id' => $heroMeta['id'],
|
||||
'hero_lv' => 1,
|
||||
'quality' => $quality,
|
||||
// 'hero_tili' => FormulaService::Hero_NFT_Maximum_Physical_Strength(1,FormulaService::Hero_Advanced_Lucky_Value(1)),
|
||||
'state' => self::FREE_STATE,
|
||||
'skill_lv1' => 1,
|
||||
'skill_lv2' => 1,
|
||||
@ -547,12 +543,13 @@ class Hero extends BaseModel {
|
||||
'lock_type' => self::NO_LOCK,
|
||||
'unlock_time' => 0,
|
||||
'unlock_trade_time' => 0,
|
||||
'activate' => 1,
|
||||
'current_wealth' => $wealth,
|
||||
'activate' => 0,
|
||||
'activate_time' => 0,
|
||||
'wealth_attr' => json_encode($attribute),
|
||||
'seal_type' => 0,
|
||||
'unseal_time' => 0,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
'current_wealth_modifytime' => myself()->_getNowTime()
|
||||
);
|
||||
if ($accountId) {
|
||||
$fieldsKv['account_id'] = $accountId;
|
||||
@ -792,4 +789,43 @@ class Hero extends BaseModel {
|
||||
return $hero;
|
||||
}
|
||||
|
||||
public static function getAccountLucky($address){
|
||||
$lucky = 0;
|
||||
foreach (NftService::getHeros($address) as $nftDb) {
|
||||
if (! $nftDb['deleted']){
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero',
|
||||
array(
|
||||
'token_id' => $nftDb['token_id'],
|
||||
)
|
||||
);
|
||||
if ($row) {
|
||||
$heroMeta = \mt\Item::get($row['hero_id']);
|
||||
$heroAtteMeta = \mt\EconomyAttribute::findByGrade($heroMeta['relationship'],$row['quality']);
|
||||
$currTime = $row['unseal_time'] ? $row['unseal_time'] : $row['activate_time'];
|
||||
if ($row['seal_type'] == 0 && $currTime + 86400 * $heroAtteMeta['validTime'] > myself()->_getNowTime()){
|
||||
$lucky += self::getHeroLucky($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $lucky;
|
||||
}
|
||||
|
||||
public static function verifyValid($hero){
|
||||
if (empty($hero['token_id'])){
|
||||
return false;
|
||||
}
|
||||
|
||||
$heroMeta = \mt\Item::get($hero['hero_id']);
|
||||
$heroAtteMeta = \mt\EconomyAttribute::findByGrade($heroMeta['relationship'],$hero['quality']);
|
||||
$currTime = $hero['unseal_time'] ? $hero['unseal_time'] : $hero['activate_time'];
|
||||
if ($hero['seal_type'] == 0 && $currTime + 86400 * $heroAtteMeta['validTime'] > myself()->_getNowTime()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,66 +4,38 @@
|
||||
namespace mt;
|
||||
|
||||
|
||||
class BattlePass
|
||||
class BattleReward
|
||||
{
|
||||
public static function find($id){
|
||||
return getXVal(self::getMetaList(), $id);
|
||||
}
|
||||
|
||||
public static function all(){
|
||||
return self::getMetaList();
|
||||
}
|
||||
|
||||
public static function getExpByLv(&$lv,&$exp){
|
||||
$meta = self::getMetaList();
|
||||
if ($exp > 0){
|
||||
for ($i=1;$i<=count($meta);$i++){
|
||||
if ($exp >= $meta[count($meta)]['total_exp']){
|
||||
$exp = min($exp, $meta[count($meta)]['total_exp']);
|
||||
$lv = $meta[count($meta)]['id'];
|
||||
}else{
|
||||
if ($i<count($meta)){
|
||||
if ($exp >= $meta[$i]['total_exp'] &&
|
||||
$exp < $meta[$i+1]['total_exp'])
|
||||
{
|
||||
$lv = $meta[$i]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static function find($typeId,$lucky){
|
||||
$reward = array();
|
||||
foreach (self::getMetaList() as $meta){
|
||||
if ($meta['type'] == $typeId && $lucky >= $meta['luckRangeMin']){
|
||||
$reward = $meta;
|
||||
}
|
||||
}
|
||||
return $reward;
|
||||
}
|
||||
|
||||
public static function getCurrentSeason(){
|
||||
foreach (self::getMetaCommon() as $meta) {
|
||||
if (myself()->_getNowTime() >= strtotime($meta['begin_time']) &&
|
||||
myself()->_getNowTime() <= strtotime($meta['end_time'])) {
|
||||
return $meta;
|
||||
public static function findByType($typeId){
|
||||
$metas = array();
|
||||
foreach (self::getMetaList() as $meta){
|
||||
if ($meta['type'] == $typeId){
|
||||
array_push($metas,$meta);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return $metas;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$metaList) {
|
||||
self::$metaList = getMetaTable('Battlepass@Battlepass.php');
|
||||
self::$metaList = getMetaTable('battleReward@battleReward.php');
|
||||
}
|
||||
return self::$metaList;
|
||||
}
|
||||
|
||||
protected static function getMetaCommon()
|
||||
{
|
||||
if (!self::$metaCommon) {
|
||||
self::$metaCommon = getMetaTable('BattlepassCommon@BattlepassCommon.php');
|
||||
}
|
||||
return self::$metaCommon;
|
||||
}
|
||||
|
||||
|
||||
protected static $metaList;
|
||||
protected static $metaCommon;
|
||||
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
namespace mt;
|
||||
|
||||
|
||||
class BattleReward
|
||||
class MapMode
|
||||
{
|
||||
public static function find($id){
|
||||
return getXVal(self::getMetaList(), $id);
|
||||
@ -24,7 +24,7 @@ class BattleReward
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$metaList) {
|
||||
self::$metaList = getMetaTable('battleReward@battleReward.php');
|
||||
self::$metaList = getMetaTable('mapMode@mapMode.php');
|
||||
}
|
||||
return self::$metaList;
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ require_once('mt/RankSeason.php');
|
||||
require_once('mt/StarLevel.php');
|
||||
require_once('mt/AchievementsCycle.php');
|
||||
require_once('mt/ServerTaskTime.php');
|
||||
require_once('mt/MapMode.php');
|
||||
require_once('mt/BattleReward.php');
|
||||
|
||||
require_once('models/Season.php');
|
||||
require_once('models/Battle.php');
|
||||
@ -27,12 +29,14 @@ require_once('services/RankActivityService.php');
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
require_once('services/LogService.php');
|
||||
require_once('services/LootService.php');
|
||||
|
||||
|
||||
use models\BattleSettlement;
|
||||
|
||||
use models\FragmentRecord;
|
||||
use models\GlobalData;
|
||||
use models\HashRate;
|
||||
use models\RankBattle;
|
||||
use models\User;
|
||||
use mt;
|
||||
@ -543,16 +547,19 @@ class TameBattleDataService extends BaseService {
|
||||
$oldElo = 0;
|
||||
$newElo = 0;
|
||||
$userDb = User::find(getXVal($info,'account_id', 0));
|
||||
$rewards = array();
|
||||
if ($userDb){
|
||||
$this->calStarNum2($rewards,getXVal($info,'pvp_personal_rank', 0),$userDb['account_id']);
|
||||
$oldRank = $userDb['rank'];
|
||||
$newRank = $userDb['rank'];
|
||||
$oldScore = $userDb['score'];
|
||||
$newScore = $userDb['score'];
|
||||
$oldElo = $userDb['elo'];
|
||||
$newElo = $userDb['elo'];
|
||||
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
||||
if ($heroDb){
|
||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
||||
if ($heroDb){
|
||||
self::calBattleReward($userDb,$heroDb,$rewards);
|
||||
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||
$winningPro = $this->celWinningPro($userDb);
|
||||
if ($winningPro){
|
||||
$newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分
|
||||
@ -564,7 +571,6 @@ class TameBattleDataService extends BaseService {
|
||||
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,46 +608,8 @@ class TameBattleDataService extends BaseService {
|
||||
'pve_max_wave'=> getXVal($info,'pve_max_wave', 0),
|
||||
'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0),
|
||||
// 'pve_rank_score'=> getXVal($info,'pve_rank_score', 0),
|
||||
'reward' => $rewards
|
||||
);
|
||||
|
||||
$temp['reward'] = array(
|
||||
'hero' => array(
|
||||
'hero_uniid' => '',
|
||||
'id' => '',
|
||||
'gold_uplimit' => 0,
|
||||
'obtain_gold' => 0,
|
||||
'curr_gold' => 0,
|
||||
),
|
||||
'items' => array(),
|
||||
);
|
||||
|
||||
switch ($room_mode){
|
||||
case self::ROOM_MODE_PVP:
|
||||
{
|
||||
//pvp奖励 gold
|
||||
if ($userDb){
|
||||
$this->calStarNum2($temp['reward'],getXVal($info,'pvp_personal_rank', 0),$userDb['account_id']);
|
||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
||||
if (!$heroDb){
|
||||
break;
|
||||
}
|
||||
$heroDto = Hero::toDto($heroDb);
|
||||
$temp['reward']['hero']['hero_uniid'] = $heroDto['hero_uniid'];
|
||||
$temp['reward']['hero']['id'] = $heroDto['hero_id'];
|
||||
$temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit'];
|
||||
$this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
case self::ROOM_MODE_PVE:
|
||||
{
|
||||
//pve 奖励碎片
|
||||
// print_r($data);die;
|
||||
}
|
||||
break;
|
||||
default:{}
|
||||
}
|
||||
array_push($data['members'],$temp);
|
||||
}
|
||||
BattleSettlement::addTeam(
|
||||
@ -651,6 +619,73 @@ class TameBattleDataService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
public function calBattleReward($userDb,$heroDb,&$reward){
|
||||
$room_mode = getXVal($this->allInfo,'map_mode', 0);
|
||||
$teamRank = getXVal($this->allInfo,'pvp_team_rank', 0);
|
||||
$mapModeMeta = mt\MapMode::findByMapMode($room_mode);
|
||||
if ($mapModeMeta){
|
||||
$gold = 0;
|
||||
$accountLucky = Hero::getAccountLucky($userDb['address']);
|
||||
$rewardMeta = mt\BattleReward::find($mapModeMeta['rewardMode'],$accountLucky);
|
||||
if (!$rewardMeta){
|
||||
return ;
|
||||
}
|
||||
//验证英雄是否有效期内
|
||||
if (Hero::verifyValid($heroDb)){
|
||||
if (!empty($rewardMeta['goldLoot'])){
|
||||
$items = LootService::dropOutItem($rewardMeta['goldLoot']);
|
||||
foreach ($items as $item){
|
||||
if ($item['item_id'] = V_ITEM_GOLD){
|
||||
$gold = $item['item_num'];
|
||||
}else{
|
||||
array_push($reward,$item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($gold > 0){
|
||||
$strArr = explode("|",$rewardMeta['goldParam']);
|
||||
$coefficientArr = explode(";",$strArr[0]);
|
||||
$coefficient = isset($coefficientArr[$teamRank-1]) ? $coefficientArr[$teamRank-1] : 0;
|
||||
$gold = $gold * $coefficient;
|
||||
|
||||
}
|
||||
|
||||
//财富值加成
|
||||
$wealthK = mt\Parameter::getVal('economy_hero_wealth_K',0);
|
||||
$wealthE = mt\Parameter::getVal('economy_hero_wealth_E',0);
|
||||
$gold = $gold * (1 + $wealthE * (Hero::getHeroWealth($heroDb) / (Hero::getHeroWealth($heroDb) + $wealthK)));
|
||||
|
||||
//算力加成
|
||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||
$lastCompute = HashRate::getTotalByAccount($userDb['account_id'], $currentPeriod['id'] - 1);
|
||||
$currentCompute = HashRate::getTotalByAccount($userDb['account_id'], $currentPeriod['id']);
|
||||
$s = mt\Parameter::getVal('compute_inherit_rate',0);
|
||||
$totalCompute = $currentCompute + $s * $lastCompute;
|
||||
$computeParam = mt\Parameter::getVal('compute_parameter',0);
|
||||
$computeMaxEffect = mt\Parameter::getVal('compute_maximum_effect',0);
|
||||
$gold = intval( $gold * ($totalCompute / ($totalCompute + $computeParam) * $computeMaxEffect + 1));
|
||||
if ($gold > 0){
|
||||
array_push($reward,array(
|
||||
"item_id" => V_ITEM_GOLD,
|
||||
"item_num" => $gold,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
//宝箱掉落
|
||||
$rand = $rewardMeta['chestLootProb'] * 100;
|
||||
$rnd = rand(1,3);print_r($rnd);
|
||||
if ($rnd <= $rand){
|
||||
$chestItems = LootService::dropOutItem($rewardMeta['chestLoot']);
|
||||
foreach ($chestItems as $item){
|
||||
array_push($reward,$item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function rewardGoldPvp(&$reward,$heroDto,$userRank)
|
||||
{
|
||||
$heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank);
|
||||
@ -667,48 +702,6 @@ class TameBattleDataService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
public function calStarNum(){
|
||||
$currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
|
||||
if (!$currStarMissionSeasonMeta){
|
||||
return;
|
||||
}
|
||||
$battleData = Battle::getMyBattleData();
|
||||
$data = isset($battleData) ? getXVal($battleData, 'data', array()) : array();
|
||||
$battleTimes = getXVal($data, 'total_battle_times', 0);
|
||||
$items = array();
|
||||
$totalNum = 0;
|
||||
if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){
|
||||
$totalNum = 10;
|
||||
array_push($items,array(
|
||||
'item_id' => V_ITEM_STAR,
|
||||
'item_num' => 10
|
||||
));
|
||||
}else{
|
||||
$pvp_rank = getReqVal('pvp_personal_rank', 0);
|
||||
$star_get_num = mt\Parameter::getVal('star_get_num',0);
|
||||
$num_arr = explode('|',$star_get_num);
|
||||
if ($pvp_rank>count($num_arr) || $pvp_rank<1){
|
||||
$finalNum = 0;
|
||||
}else{
|
||||
$finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]);
|
||||
}
|
||||
$totalNum = $finalNum;
|
||||
if ($finalNum > 0){
|
||||
array_push($items,array(
|
||||
'item_id' => V_ITEM_STAR,
|
||||
'item_num' => $finalNum
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
if ($items){
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$awardService = new services\AwardService();
|
||||
myself()->_addItems($items, $awardService,$propertyChgService);
|
||||
myself()->_incV(TN_TOTAL_STAR_NUM, 0, $totalNum);
|
||||
}
|
||||
|
||||
}
|
||||
public function calStarNum2(&$reward,$pvp_rank,$account_id){
|
||||
$currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
|
||||
if (!$currStarMissionSeasonMeta){
|
||||
@ -722,7 +715,7 @@ class TameBattleDataService extends BaseService {
|
||||
$battleTimes = getXVal($seasonBattleData, 'total_battle_times', 0);
|
||||
}
|
||||
if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){
|
||||
array_push($reward['items'],array(
|
||||
array_push($reward,array(
|
||||
'item_id' => V_ITEM_STAR,
|
||||
'item_num' => 10
|
||||
));
|
||||
@ -736,7 +729,7 @@ class TameBattleDataService extends BaseService {
|
||||
}
|
||||
|
||||
if ($finalNum > 0){
|
||||
array_push($reward['items'],array(
|
||||
array_push($reward,array(
|
||||
'item_id'=> V_ITEM_STAR,
|
||||
'item_num'=>$finalNum,
|
||||
));
|
||||
@ -770,10 +763,10 @@ class TameBattleDataService extends BaseService {
|
||||
if ($data){
|
||||
foreach ($data['members'] as $member){
|
||||
if ($member['account_id'] == myself()->_getAccountId()){
|
||||
if ($member['reward']['items']){
|
||||
if (! empty($member['reward'])){
|
||||
$gold= 0;
|
||||
$items = array();
|
||||
foreach ($member['reward']['items'] as $value){
|
||||
foreach ($member['reward'] as $value){
|
||||
if ($value['item_id'] == V_ITEM_GOLD){
|
||||
$gold = $value['item_num'];
|
||||
}
|
||||
@ -791,13 +784,13 @@ class TameBattleDataService extends BaseService {
|
||||
LogService::productGold($event);
|
||||
}
|
||||
}
|
||||
if ($member['reward']['hero']['hero_uniid']){
|
||||
Hero::update($member['reward']['hero']['hero_uniid'],
|
||||
array(
|
||||
'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100,
|
||||
'last_get_gold_time' => myself()->_getNowTime()
|
||||
));
|
||||
}
|
||||
// if ($member['reward']['hero']['hero_uniid']){
|
||||
// Hero::update($member['reward']['hero']['hero_uniid'],
|
||||
// array(
|
||||
// 'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100,
|
||||
// 'last_get_gold_time' => myself()->_getNowTime()
|
||||
// ));
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1055,7 +1048,7 @@ class TameBattleDataService extends BaseService {
|
||||
$this->maxValue($battleData, 'max_assist_time', $assistTime);
|
||||
}
|
||||
//等级
|
||||
$level = getXVal($this->battleInfo,'level', 0);
|
||||
$level = getXVal($this->battleInfo,'hero_lv', 1);
|
||||
if ($level > 0) {
|
||||
//总等级
|
||||
$this->incValue($battleData, 'total_level', $level);
|
||||
|
Loading…
x
Reference in New Issue
Block a user