战斗结算
This commit is contained in:
parent
bd51335cb9
commit
bafbe05c5a
@ -167,7 +167,7 @@ class UserBattleInfo(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['user_info', [UserInfo()], '用户信息'],
|
['user_info', [UserInfo()], '用户信息'],
|
||||||
['hero_info', [HeroInfo()], '上阵英雄信息'],
|
['hero_info', [Hero()], '上阵英雄信息'],
|
||||||
]
|
]
|
||||||
|
|
||||||
class HonorInfo(object):
|
class HonorInfo(object):
|
||||||
@ -244,13 +244,13 @@ class UserChartInfo(object):
|
|||||||
['assist_avg', 0, '场均助攻'],
|
['assist_avg', 0, '场均助攻'],
|
||||||
['damage_avg', 0, '场均伤害'],
|
['damage_avg', 0, '场均伤害'],
|
||||||
['recover_avg', 0, '场均恢复'],
|
['recover_avg', 0, '场均恢复'],
|
||||||
['win_avg', 0, '场均胜率(4v4模式下才有)'],
|
['alive_avg', 0, '场均生存(4v4模式下才有)'],
|
||||||
['level_avg', 0, '场均等级(moba模式下才有)'],
|
['level_avg', 0, '场均等级(moba模式下才有)'],
|
||||||
['star_kills', 0, '击败(5纬图-击败, 百分比数值整数部分)'],
|
['star_kills', 0, '击败(5纬图-击败, 百分比数值整数部分)'],
|
||||||
['star_damage', 0, '伤害(5纬图-伤害, 百分比数值整数部分)'],
|
['star_damage', 0, '伤害(5纬图-伤害, 百分比数值整数部分)'],
|
||||||
['star_alive', 0, '生存(5纬图-生存, 百分比数值整数部分)'],
|
['star_assist', 0, '助攻(5纬图-生存, 百分比数值整数部分)'],
|
||||||
['star_recover', 0, '治疗(5纬图-治疗, 百分比数值整数部分)'],
|
['star_recover', 0, '治疗(5纬图-治疗, 百分比数值整数部分)'],
|
||||||
['star_win', 0, '胜利(5纬图-胜利, 百分比数值整数部分,4v4模式下才有)'],
|
['star_alive', 0, '生存(5纬图-胜利, 百分比数值整数部分,4v4模式下才有)'],
|
||||||
['star_level', 0, '等级(5纬图-胜利, 百分比数值整数部分,moba模式下才有)'],
|
['star_level', 0, '等级(5纬图-胜利, 百分比数值整数部分,moba模式下才有)'],
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -282,6 +282,10 @@ class Hero(object):
|
|||||||
['tags', '', '1:Gen状态'],
|
['tags', '', '1:Gen状态'],
|
||||||
['!avatarInfo', [AvatarInfo()], '装饰信息'],
|
['!avatarInfo', [AvatarInfo()], '装饰信息'],
|
||||||
['ability', Ability(), '属性'],
|
['ability', Ability(), '属性'],
|
||||||
|
['lucky', 0, '幸运值'],
|
||||||
|
['wealth', 0, '财富值'],
|
||||||
|
['seal_type', 0, '0:未封存 1:已封存'],
|
||||||
|
['unseal_time', 0, '解封时间'],
|
||||||
]
|
]
|
||||||
|
|
||||||
class LevelingHero(object):
|
class LevelingHero(object):
|
||||||
@ -1147,6 +1151,7 @@ class TeamReportMember(object):
|
|||||||
['skin_id', 0, '皮肤id'],
|
['skin_id', 0, '皮肤id'],
|
||||||
['move_distance', 0, '行走距离'],
|
['move_distance', 0, '行走距离'],
|
||||||
['full_level_idx', 0, '第几个满级索引(0:未满级 1:第一个 2:第二个等等)'],
|
['full_level_idx', 0, '第几个满级索引(0:未满级 1:第一个 2:第二个等等)'],
|
||||||
|
['hero_lv', 0, '游戏内英雄等级'],
|
||||||
|
|
||||||
['pvp_kill', 0, 'pvp击杀敌人数'],
|
['pvp_kill', 0, 'pvp击杀敌人数'],
|
||||||
['pvp_damage', 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_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
`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`),
|
PRIMARY KEY (`idx`),
|
||||||
UNIQUE KEY `token_id` (`token_id`),
|
UNIQUE KEY `token_id` (`token_id`),
|
||||||
KEY `account_id` (`account_id`)
|
KEY `account_id` (`account_id`)
|
||||||
@ -245,12 +249,13 @@ CREATE TABLE `t_chip` (
|
|||||||
`chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级',
|
`chip_grade` int(11) NOT NULL DEFAULT '1' COMMENT '芯片等级',
|
||||||
`chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助',
|
`chip_type` int(11) NOT NULL DEFAULT '1' COMMENT '1 攻击;2 防御;3 辅助',
|
||||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '0:已购买 1:免费(GIFT标签)',
|
`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 '随机属性',
|
`rand_attr` mediumblob COMMENT '随机属性',
|
||||||
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
`active_token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'active_token_id',
|
||||||
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
|
||||||
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活',
|
||||||
`quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶',
|
`quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶',
|
||||||
|
`wealth_attr` mediumblob COMMENT '财富值属性',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
begin;
|
begin;
|
||||||
|
|
||||||
alter table t_hero add column `current_wealth` 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 `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 `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_hero drop column base_attr;
|
||||||
|
|
||||||
alter table t_chip add column `wealth_attr` mediumblob COMMENT '财富值属性';
|
alter table t_chip add column `wealth_attr` mediumblob COMMENT '财富值属性';
|
||||||
|
@ -45,4 +45,22 @@ class HashRate extends BaseModel
|
|||||||
return $myHashRate;
|
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) {
|
if (!$itemMeta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// $randAttr = array();
|
|
||||||
$fieldsKv = 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' => 1,
|
||||||
|
'activate_time' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
);
|
);
|
||||||
self::updateByTokenId($row['token_id'],$fieldsKv);
|
self::updateByTokenId($row['token_id'],$fieldsKv);
|
||||||
@ -258,7 +249,7 @@ class Hero extends BaseModel {
|
|||||||
$isSelect = 1;
|
$isSelect = 1;
|
||||||
}
|
}
|
||||||
$skinDb = HeroSkin::findBx($row['hero_id']);
|
$skinDb = HeroSkin::findBx($row['hero_id']);
|
||||||
$attribute = self::celHeroWealthUpLimit($row);
|
// $attribute = self::celHeroWealthUpLimit($row);
|
||||||
$dto = array(
|
$dto = array(
|
||||||
'idx' => $row['idx'],
|
'idx' => $row['idx'],
|
||||||
'token_id' => $row['token_id'],
|
'token_id' => $row['token_id'],
|
||||||
@ -285,10 +276,11 @@ class Hero extends BaseModel {
|
|||||||
'offer_reward_state' => 0,
|
'offer_reward_state' => 0,
|
||||||
'tags' => isset($row['tags'])?$row['tags']:'',
|
'tags' => isset($row['tags'])?$row['tags']:'',
|
||||||
'is_select' => $isSelect,
|
'is_select' => $isSelect,
|
||||||
'lucky' => $attribute['lucky'],
|
'lucky' => self::getHeroLucky($row),
|
||||||
'current_wealth' => $row['current_wealth'],
|
'wealth' => self::getHeroWealth($row),
|
||||||
'wealth_uplimit' => $attribute['wealth'],
|
'ability' => self::abilityInfo($row, $attr),
|
||||||
'ability' => self::abilityInfo($row, $attr)
|
'seal_type' => $row['seal_type'],
|
||||||
|
'unseal_time' => $row['unseal_time'],
|
||||||
);
|
);
|
||||||
|
|
||||||
// $nft_address = '';
|
// $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){
|
public static function avatarInfo($row){
|
||||||
$avatarDbs = Avatar::getAvatarByHeroIdx($row['idx']);
|
$avatarDbs = Avatar::getAvatarByHeroIdx($row['idx']);
|
||||||
$avatarInfos = array();
|
$avatarInfos = array();
|
||||||
@ -530,16 +530,12 @@ class Hero extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$randAttr = self::getRandAttr($heroMeta['id']) ;
|
$randAttr = self::getRandAttr($heroMeta['id']) ;
|
||||||
{
|
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $quality);
|
||||||
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $quality);
|
|
||||||
$result = \mt\EconomyAttribute::getAttrValue($attribute);
|
|
||||||
$wealth = floor($result['wealth'] * (1+$result['wealth_rate']));
|
|
||||||
}
|
|
||||||
$fieldsKv = array(
|
$fieldsKv = array(
|
||||||
'hero_id' => $heroMeta['id'],
|
'hero_id' => $heroMeta['id'],
|
||||||
'hero_lv' => 1,
|
'hero_lv' => 1,
|
||||||
'quality' => $quality,
|
'quality' => $quality,
|
||||||
// 'hero_tili' => FormulaService::Hero_NFT_Maximum_Physical_Strength(1,FormulaService::Hero_Advanced_Lucky_Value(1)),
|
|
||||||
'state' => self::FREE_STATE,
|
'state' => self::FREE_STATE,
|
||||||
'skill_lv1' => 1,
|
'skill_lv1' => 1,
|
||||||
'skill_lv2' => 1,
|
'skill_lv2' => 1,
|
||||||
@ -547,12 +543,13 @@ class Hero extends BaseModel {
|
|||||||
'lock_type' => self::NO_LOCK,
|
'lock_type' => self::NO_LOCK,
|
||||||
'unlock_time' => 0,
|
'unlock_time' => 0,
|
||||||
'unlock_trade_time' => 0,
|
'unlock_trade_time' => 0,
|
||||||
'activate' => 1,
|
'activate' => 0,
|
||||||
'current_wealth' => $wealth,
|
'activate_time' => 0,
|
||||||
'wealth_attr' => json_encode($attribute),
|
'wealth_attr' => json_encode($attribute),
|
||||||
|
'seal_type' => 0,
|
||||||
|
'unseal_time' => 0,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
'current_wealth_modifytime' => myself()->_getNowTime()
|
|
||||||
);
|
);
|
||||||
if ($accountId) {
|
if ($accountId) {
|
||||||
$fieldsKv['account_id'] = $accountId;
|
$fieldsKv['account_id'] = $accountId;
|
||||||
@ -792,4 +789,43 @@ class Hero extends BaseModel {
|
|||||||
return $hero;
|
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;
|
namespace mt;
|
||||||
|
|
||||||
|
|
||||||
class BattlePass
|
class BattleReward
|
||||||
{
|
{
|
||||||
public static function find($id){
|
public static function find($typeId,$lucky){
|
||||||
return getXVal(self::getMetaList(), $id);
|
$reward = array();
|
||||||
}
|
foreach (self::getMetaList() as $meta){
|
||||||
|
if ($meta['type'] == $typeId && $lucky >= $meta['luckRangeMin']){
|
||||||
public static function all(){
|
$reward = $meta;
|
||||||
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'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $reward;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCurrentSeason(){
|
public static function findByType($typeId){
|
||||||
foreach (self::getMetaCommon() as $meta) {
|
$metas = array();
|
||||||
if (myself()->_getNowTime() >= strtotime($meta['begin_time']) &&
|
foreach (self::getMetaList() as $meta){
|
||||||
myself()->_getNowTime() <= strtotime($meta['end_time'])) {
|
if ($meta['type'] == $typeId){
|
||||||
return $meta;
|
array_push($metas,$meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return $metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
self::$metaList = getMetaTable('Battlepass@Battlepass.php');
|
self::$metaList = getMetaTable('battleReward@battleReward.php');
|
||||||
}
|
}
|
||||||
return self::$metaList;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getMetaCommon()
|
|
||||||
{
|
|
||||||
if (!self::$metaCommon) {
|
|
||||||
self::$metaCommon = getMetaTable('BattlepassCommon@BattlepassCommon.php');
|
|
||||||
}
|
|
||||||
return self::$metaCommon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected static $metaList;
|
protected static $metaList;
|
||||||
protected static $metaCommon;
|
|
||||||
|
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
namespace mt;
|
namespace mt;
|
||||||
|
|
||||||
|
|
||||||
class BattleReward
|
class MapMode
|
||||||
{
|
{
|
||||||
public static function find($id){
|
public static function find($id){
|
||||||
return getXVal(self::getMetaList(), $id);
|
return getXVal(self::getMetaList(), $id);
|
||||||
@ -24,7 +24,7 @@ class BattleReward
|
|||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
self::$metaList = getMetaTable('battleReward@battleReward.php');
|
self::$metaList = getMetaTable('mapMode@mapMode.php');
|
||||||
}
|
}
|
||||||
return self::$metaList;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ require_once('mt/RankSeason.php');
|
|||||||
require_once('mt/StarLevel.php');
|
require_once('mt/StarLevel.php');
|
||||||
require_once('mt/AchievementsCycle.php');
|
require_once('mt/AchievementsCycle.php');
|
||||||
require_once('mt/ServerTaskTime.php');
|
require_once('mt/ServerTaskTime.php');
|
||||||
|
require_once('mt/MapMode.php');
|
||||||
|
require_once('mt/BattleReward.php');
|
||||||
|
|
||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
require_once('models/Battle.php');
|
require_once('models/Battle.php');
|
||||||
@ -27,12 +29,14 @@ require_once('services/RankActivityService.php');
|
|||||||
require_once('services/AwardService.php');
|
require_once('services/AwardService.php');
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
require_once('services/LogService.php');
|
require_once('services/LogService.php');
|
||||||
|
require_once('services/LootService.php');
|
||||||
|
|
||||||
|
|
||||||
use models\BattleSettlement;
|
use models\BattleSettlement;
|
||||||
|
|
||||||
use models\FragmentRecord;
|
use models\FragmentRecord;
|
||||||
use models\GlobalData;
|
use models\GlobalData;
|
||||||
|
use models\HashRate;
|
||||||
use models\RankBattle;
|
use models\RankBattle;
|
||||||
use models\User;
|
use models\User;
|
||||||
use mt;
|
use mt;
|
||||||
@ -543,16 +547,19 @@ class TameBattleDataService extends BaseService {
|
|||||||
$oldElo = 0;
|
$oldElo = 0;
|
||||||
$newElo = 0;
|
$newElo = 0;
|
||||||
$userDb = User::find(getXVal($info,'account_id', 0));
|
$userDb = User::find(getXVal($info,'account_id', 0));
|
||||||
|
$rewards = array();
|
||||||
if ($userDb){
|
if ($userDb){
|
||||||
|
$this->calStarNum2($rewards,getXVal($info,'pvp_personal_rank', 0),$userDb['account_id']);
|
||||||
$oldRank = $userDb['rank'];
|
$oldRank = $userDb['rank'];
|
||||||
$newRank = $userDb['rank'];
|
$newRank = $userDb['rank'];
|
||||||
$oldScore = $userDb['score'];
|
$oldScore = $userDb['score'];
|
||||||
$newScore = $userDb['score'];
|
$newScore = $userDb['score'];
|
||||||
$oldElo = $userDb['elo'];
|
$oldElo = $userDb['elo'];
|
||||||
$newElo = $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));
|
||||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
if ($heroDb){
|
||||||
if ($heroDb){
|
self::calBattleReward($userDb,$heroDb,$rewards);
|
||||||
|
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||||
$winningPro = $this->celWinningPro($userDb);
|
$winningPro = $this->celWinningPro($userDb);
|
||||||
if ($winningPro){
|
if ($winningPro){
|
||||||
$newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分
|
$newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分
|
||||||
@ -564,7 +571,6 @@ class TameBattleDataService extends BaseService {
|
|||||||
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
|
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,46 +608,8 @@ class TameBattleDataService extends BaseService {
|
|||||||
'pve_max_wave'=> getXVal($info,'pve_max_wave', 0),
|
'pve_max_wave'=> getXVal($info,'pve_max_wave', 0),
|
||||||
'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0),
|
'pve_boss_killed'=> getXVal($info,'pve_boss_killed', 0),
|
||||||
// 'pve_rank_score'=> getXVal($info,'pve_rank_score', 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);
|
array_push($data['members'],$temp);
|
||||||
}
|
}
|
||||||
BattleSettlement::addTeam(
|
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)
|
private function rewardGoldPvp(&$reward,$heroDto,$userRank)
|
||||||
{
|
{
|
||||||
$heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$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){
|
public function calStarNum2(&$reward,$pvp_rank,$account_id){
|
||||||
$currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
|
$currStarMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
|
||||||
if (!$currStarMissionSeasonMeta){
|
if (!$currStarMissionSeasonMeta){
|
||||||
@ -722,7 +715,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
$battleTimes = getXVal($seasonBattleData, 'total_battle_times', 0);
|
$battleTimes = getXVal($seasonBattleData, 'total_battle_times', 0);
|
||||||
}
|
}
|
||||||
if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){
|
if ($battleTimes <= mt\Parameter::getVal('rookie_map_counts',10)){
|
||||||
array_push($reward['items'],array(
|
array_push($reward,array(
|
||||||
'item_id' => V_ITEM_STAR,
|
'item_id' => V_ITEM_STAR,
|
||||||
'item_num' => 10
|
'item_num' => 10
|
||||||
));
|
));
|
||||||
@ -736,7 +729,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($finalNum > 0){
|
if ($finalNum > 0){
|
||||||
array_push($reward['items'],array(
|
array_push($reward,array(
|
||||||
'item_id'=> V_ITEM_STAR,
|
'item_id'=> V_ITEM_STAR,
|
||||||
'item_num'=>$finalNum,
|
'item_num'=>$finalNum,
|
||||||
));
|
));
|
||||||
@ -770,10 +763,10 @@ class TameBattleDataService extends BaseService {
|
|||||||
if ($data){
|
if ($data){
|
||||||
foreach ($data['members'] as $member){
|
foreach ($data['members'] as $member){
|
||||||
if ($member['account_id'] == myself()->_getAccountId()){
|
if ($member['account_id'] == myself()->_getAccountId()){
|
||||||
if ($member['reward']['items']){
|
if (! empty($member['reward'])){
|
||||||
$gold= 0;
|
$gold= 0;
|
||||||
$items = array();
|
$items = array();
|
||||||
foreach ($member['reward']['items'] as $value){
|
foreach ($member['reward'] as $value){
|
||||||
if ($value['item_id'] == V_ITEM_GOLD){
|
if ($value['item_id'] == V_ITEM_GOLD){
|
||||||
$gold = $value['item_num'];
|
$gold = $value['item_num'];
|
||||||
}
|
}
|
||||||
@ -791,13 +784,13 @@ class TameBattleDataService extends BaseService {
|
|||||||
LogService::productGold($event);
|
LogService::productGold($event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($member['reward']['hero']['hero_uniid']){
|
// if ($member['reward']['hero']['hero_uniid']){
|
||||||
Hero::update($member['reward']['hero']['hero_uniid'],
|
// Hero::update($member['reward']['hero']['hero_uniid'],
|
||||||
array(
|
// array(
|
||||||
'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100,
|
// 'today_get_gold' => $member['reward']['hero']['curr_gold'] * 100,
|
||||||
'last_get_gold_time' => myself()->_getNowTime()
|
// 'last_get_gold_time' => myself()->_getNowTime()
|
||||||
));
|
// ));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1055,7 +1048,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
$this->maxValue($battleData, 'max_assist_time', $assistTime);
|
$this->maxValue($battleData, 'max_assist_time', $assistTime);
|
||||||
}
|
}
|
||||||
//等级
|
//等级
|
||||||
$level = getXVal($this->battleInfo,'level', 0);
|
$level = getXVal($this->battleInfo,'hero_lv', 1);
|
||||||
if ($level > 0) {
|
if ($level > 0) {
|
||||||
//总等级
|
//总等级
|
||||||
$this->incValue($battleData, 'total_level', $level);
|
$this->incValue($battleData, 'total_level', $level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user