修改英雄枪械成长属性公式

This commit is contained in:
hujiabin 2022-09-28 10:54:09 +08:00
parent 4d4eefe418
commit 7a4976e70f
5 changed files with 185 additions and 38 deletions

View File

@ -377,8 +377,8 @@ class Gun extends BaseModel {
}
}
//射速升级提升公式
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_FireRate){
//装弹时间升级提升公式
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_ReloadTime){
array_push($attrPro1,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
@ -386,7 +386,8 @@ class Gun extends BaseModel {
]);
}
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] != kHAT_FireRate && $val['attr_id'] != kHAT_Volume){
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] != kHAT_ReloadTime && $val['attr_id'] != kHAT_Volume &&
$val['attr_id'] != kHAT_FireRate && $val['attr_id'] != kHAT_BulletSpeed){
array_push($attrPro1,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
@ -409,7 +410,7 @@ class Gun extends BaseModel {
$coef_quality = mt\HeroQuality::getByCoefficient($coefficient_quality, $val['attr_id']);
if ($coef_quality){
//射速升级提升公式
if ($val['attr_id'] == kHAT_FireRate){
if ($val['attr_id'] == kHAT_ReloadTime){
array_push($attrPro2,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
@ -432,7 +433,8 @@ class Gun extends BaseModel {
}
}
if($val['attr_id'] != kHAT_FireRate && $val['attr_id'] != kHAT_Volume){
if($val['attr_id'] != kHAT_ReloadTime && $val['attr_id'] != kHAT_Volume &&
$val['attr_id'] != kHAT_FireRate && $val['attr_id'] != kHAT_BulletSpeed){
array_push($attrPro2, [
'attr_id' => $val['attr_id'],
'type' => $val['type'],

View File

@ -496,14 +496,15 @@ class Hero extends BaseModel {
foreach ($baseAttr as $val){
$coef_level = mt\HeroLevelAttr::getByCoefficient($coefficient_level,$val['attr_id']);
foreach ($attr as $v){
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_Atk){ //18 //18.941564456287 //20.847692307692
array_push($attrPro1,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
'val' => strval($val['val']*$v['val']+$v['val']/$coef_level['val']*100-100/$coef_level['val']),
]);
}
if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] != kHAT_Atk){
// if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_Atk){ //18 //18.941564456287 //20.847692307692
// array_push($attrPro1,[
// 'attr_id' => $val['attr_id'],
// 'type'=> $val['type'],
// 'val' => strval($val['val']*$v['val']+$v['val']/$coef_level['val']*100-100/$coef_level['val']),
// ]);
// }
//&& $val['attr_id'] != kHAT_Atk
if ( $val['attr_id'] == $v['attr_id'] ){
array_push($attrPro1,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
@ -522,20 +523,25 @@ class Hero extends BaseModel {
foreach ($baseAttr as $val){
$coef_quality = mt\HeroQuality::getByCoefficient($coefficient_quality,$val['attr_id']);
if ($coef_quality){
if ($val['attr_id'] == kHAT_Atk){
array_push($attrPro2,[
'attr_id' => $val['attr_id'],
'type'=> $val['type'],
'val' => strval($val['val']*$qualityMeta['promote_val']+$qualityMeta['promote_val']/$coef_quality['val']*100-100/$coef_quality['val']),
]);
}
if ($val['attr_id'] != kHAT_Atk) {
array_push($attrPro2, [
'attr_id' => $val['attr_id'],
'type' => $val['type'],
'val' => strval($val['val'] * pow($qualityMeta['promote_val'], $coef_quality['val'])),
]);
}
// if ($val['attr_id'] == kHAT_Atk){
// array_push($attrPro2,[
// 'attr_id' => $val['attr_id'],
// 'type'=> $val['type'],
// 'val' => strval($val['val']*$qualityMeta['promote_val']+$qualityMeta['promote_val']/$coef_quality['val']*100-100/$coef_quality['val']),
// ]);
// }
// if ($val['attr_id'] != kHAT_Atk) {
// array_push($attrPro2, [
// 'attr_id' => $val['attr_id'],
// 'type' => $val['type'],
// 'val' => strval($val['val'] * pow($qualityMeta['promote_val'], $coef_quality['val'])),
// ]);
// }
array_push($attrPro2, [
'attr_id' => $val['attr_id'],
'type' => $val['type'],
'val' => strval($val['val'] * pow($qualityMeta['promote_val'], $coef_quality['val'])),
]);
}
}
return $attrPro2;

View File

@ -602,6 +602,11 @@ class BattleDataService extends BaseService {
$ranked = getReqVal('ranked', 0);
$kills = getReqVal('kills', 0);
$aliveTime = getReqVal('alive_time', 0);
$log_param = [
'battle_uniid' => getReqVal('battle_uniid', 0),
'match_mode' => getReqVal('match_mode', 0),
'room_uuid' => getReqVal('room_uuid', 0),
];
$cond = (1 - ($ranked >= 30 ? 1 : 0)) *
($kills >= 1 ? 1 : 0) *
($aliveTime >= 30 ? 1 : 0);
@ -625,16 +630,46 @@ class BattleDataService extends BaseService {
)));
if ($heroPvpCeg > 0) {
$heroPvpCeg = Hero::gainGoldPvp($this->heroDto, $heroPvpCeg);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVP,
'val' => $heroPvpCeg
];
LogService::productCEG($event,$this->heroDto,$log_param);
}
$this->reward['hero']['obtain_ceg'] = '' . ($this->heroDto['current_pvp_get_ceg'] + $heroPvpCeg);
$this->reward['total_ceg'] += $heroPvpCeg;
}
if ($weaponPvpCeg1 > 0) {
$weaponPvpCeg1 = Gun::gainGoldPvp($this->weapon1Dto, $weaponPvpCeg1);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVP,
'val' => $weaponPvpCeg1
];
LogService::productCEG($event,$this->weapon1Dto,$log_param);
}
$this->reward['weapon1']['obtain_ceg'] = '' . ($this->weapon1Dto['current_pvp_get_ceg'] + $weaponPvpCeg1);
$this->reward['total_ceg'] += $weaponPvpCeg1;
}
if ($weaponPvpCeg2 > 0) {
$weaponPvpCeg2 = Gun::gainGoldPvp($this->weapon1Dto, $weaponPvpCeg2);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVP,
'val' => $weaponPvpCeg2
];
LogService::productCEG($event,$this->weapon2Dto,$log_param);
}
$this->reward['weapon2']['obtain_ceg'] = '' . ($this->weapon2Dto['current_pvp_get_ceg'] + $weaponPvpCeg2);
$this->reward['total_ceg'] += $weaponPvpCeg2;
}
@ -652,6 +687,11 @@ class BattleDataService extends BaseService {
private function rewardCegPve()
{
$log_param = [
'battle_uniid' => getReqVal('battle_uniid', 0),
'match_mode' => getReqVal('match_mode', 0),
'room_uuid' => getReqVal('room_uuid', 0),
];
if ($this->instanceRank < 1) {
return;
}
@ -686,16 +726,46 @@ class BattleDataService extends BaseService {
)));
if ($heroPveCeg > 0) {
$heroPveCeg = Hero::gainGoldPve($this->heroDto, $heroPveCeg);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVE,
'val' => $heroPveCeg
];
LogService::productCEG($event,$this->heroDto,$log_param);
}
$this->reward['hero']['obtain_ceg'] = '' . ($this->heroDto['current_pve_get_ceg'] + $heroPveCeg);
$this->reward['total_ceg'] += $heroPveCeg;
}
if ($weaponPveCeg1 > 0) {
$weaponPveCeg1 = Gun::gainGoldPve($this->weapon1Dto, $weaponPveCeg1);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVE,
'val' => $weaponPveCeg1
];
LogService::productCEG($event,$this->weapon1Dto,$log_param);
}
$this->reward['weapon1']['obtain_ceg'] = '' . ($this->weapon1Dto['current_pve_get_ceg'] + $weaponPveCeg1);
$this->reward['total_ceg'] += $weaponPveCeg1;
}
if ($weaponPveCeg2 > 0) {
$weaponPveCeg2 = Gun::gainGoldPve($this->weapon1Dto, $weaponPveCeg2);
{
//埋点
$event = [
'name' => LogService::BATTLE_AWARD_PVE,
'val' => $weaponPveCeg2
];
LogService::productCEG($event,$this->weapon2Dto,$log_param);
}
$this->reward['weapon2']['obtain_ceg'] = '' . ($this->weapon2Dto['current_pve_get_ceg'] + $weaponPveCeg2);
$this->reward['total_ceg'] += $weaponPveCeg2;
}
@ -761,6 +831,14 @@ class BattleDataService extends BaseService {
private function procDrop($dropIdx)
{
$log_param = [
'battle_uniid' => getReqVal('battle_uniid', 0),
'match_mode' => getReqVal('match_mode', 0),
'room_uuid' => getReqVal('room_uuid', 0),
'fragment_type' => $dropIdx
];
$event = array();
$todayPveBattleTimes = myself()->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0);
$todayPveLastGetFragmentBattle = myself()->_getDailyV(TN_DAILY_PVE_LAST_GET_FRAGMENT_BATTLE, 0);
@ -770,6 +848,14 @@ class BattleDataService extends BaseService {
$type = 0;
if ($matchMode == self::MATCH_MODE_PVE) {
$type = 1;
$event['name'] = LogService::BATTLE_AWARD_PVE;
}
if ($matchMode == self::MATCH_MODE_PVP) {
$event['name'] = LogService::BATTLE_AWARD_PVP;
}
if ($matchMode == self::MATCH_MODE_MATCH) {
$type = 1;
$event['name'] = LogService::BATTLE_AWARD_MATCH;
}
if ($dropIdx == 0) {
$itemId = FragmentPool::dropHero($type);
@ -794,6 +880,13 @@ class BattleDataService extends BaseService {
} else {
myself()->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0, 1);
}
{
//埋点
$event['item_id'] = $itemId;
$event['number'] = 1;
LogService::productFragment($event,$log_param);
}
}
} else if ($dropIdx == 1) {
$itemId = FragmentPool::dropGun($type);
@ -818,6 +911,13 @@ class BattleDataService extends BaseService {
} else {
myself()->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0, 1);
}
{
//埋点
$event['item_id'] = $itemId;
$event['number'] = 1;
LogService::productFragment($event,$log_param);
}
}
}
}

View File

@ -503,7 +503,7 @@ class FormulaService extends BaseService {
//芯片升级MINT费用
public static function Chip_Need_Mint_Cost($grand){
// 芯片升星累计MINT成本=(SIGN(chip星级>=5)*SIGN(chip星级<=10)*ROUND(91*chip星级*(chip星级-6.06)/100+1000/100,0)*100+SIGN(chip星级>=11)*SIGN(chip星级<=15)*ROUND(364.29*chip星级*(chip星级-17.847)/100+33446/100,0)*100)*CEG_Discount_Rate
return ($grand>=5?1:0)*($grand<=10?1:0)*round(91*$grand*($grand-6.06)/100+1000/100,0)*100+($grand>=11?1:0)*($grand<=15?1:0)*round(364.29*$grand*($grand-17.847)/100+33446/100,0)*100*self::CEG_Discount_Rate();
return (($grand>=5?1:0)*($grand<=10?1:0)*round(91*$grand*($grand-6.06)/100+1000/100,0)*100+($grand>=11?1:0)*($grand<=15?1:0)*round(364.29*$grand*($grand-17.847)/100+33446/100,0)*100)*self::CEG_Discount_Rate();
}
//芯片镶嵌MINT费用

View File

@ -29,13 +29,17 @@ class LogService extends BaseService
const GUN_FRAGMENT = "weapon_fragment_synth"; //枪械碎片合成U
const FRAGMENT_SYNTH_MATERIAL = "fragment_synth_material"; //芯片合成材料
const CONSUME = 0; //消耗
const PRODUCT = 1; //产出
const CONSUME = 0; //消耗 ↑
const PRODUCT = 1; //产出 ↓
const BATTLE_AWARD_PVP = "battle_award_pvp"; //PVP战斗奖励
const BATTLE_AWARD_PVE = "battle_award_pve"; //PVE战斗奖励
const BATTLE_AWARD_MATCH = "battle_award_match"; //排位赛战斗奖励
const PRONAME = 'game_20006_api';
const GAMEID = 2006;
public static function consumeCEG($event,$old_nft,$new_nft)
public static function consumeCEG($event,$old_nft,$new_nft,$param = [])
{
$data = self::userInfo();
$data['type'] = self::CONSUME;
@ -45,12 +49,12 @@ class LogService extends BaseService
$data['ceg_discount_rate'] = FormulaService::CEG_Discount_Rate(); //CEG折扣比率
$nft = self::nftInfo($old_nft,$new_nft);
$logInfo = array_merge($data,$nft);
$logInfo = array_merge($data,$nft,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
}
public static function consumeCEC($event, $old_nft,$new_nft)
public static function consumeCEC($event, $old_nft,$new_nft,$param = [])
{
$data = self::userInfo();
$data['type'] = self::CONSUME;
@ -60,13 +64,35 @@ class LogService extends BaseService
$data['cec_discount_rate'] = FormulaService::CEC_Discount_Rate(); //CEC折扣比率
$nft = self::nftInfo($old_nft,$new_nft);
$logInfo = array_merge($data,$nft);
$logInfo = array_merge($data,$nft,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
}
public static function product($event)
public static function productCEG($event,$nft,$param = [])
{
$data = self::userInfo();
$data['type'] = self::PRODUCT;
$data['event_name'] = $event['name'];
$data['event_product'] = 'CEG';
$data['event_product_val'] = $event['val'];
$data['ceg_discount_rate'] = FormulaService::CEG_Discount_Rate(); //CEG折扣比率
$nftInfo = self::nftProductInfo($nft);
$logInfo = array_merge($data,$nftInfo,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
}
public static function productFragment($event,$param = [])
{
$data = self::userInfo();
$data['type'] = self::PRODUCT;
$data['event_name'] = $event['name'];
$data['event_product'] = 'Fragment';
$data['event_product_item_id'] = $event['item_id'];
$data['event_product_val'] = $event['number'];
$logInfo = array_merge($data,$param);
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($logInfo));
}
public static function LevelUpOrQualityUp( $event, $old_nft,$new_nft)
@ -102,7 +128,8 @@ class LogService extends BaseService
TGLog::writeToLog(self::PRONAME,self::GAMEID,json_encode($data));
}
private static function userInfo(){
private static function userInfo()
{
$user = User::find(myself()->_getAccountId());
$info = array(
'account_id' => myself()->_getAccountId(), //账号id
@ -120,7 +147,8 @@ class LogService extends BaseService
return $info;
}
private static function nftInfo($old_nft,$new_nft){
private static function nftInfo($old_nft,$new_nft)
{
$info = array(
'nft_unique_id' => $old_nft['idx'], //NFT idx
'nft_token_id' => $old_nft['token_id']?$old_nft['token_id']:null, //NFT token ID
@ -129,11 +157,22 @@ class LogService extends BaseService
'nft_level' => $old_nft['level'] ? $old_nft['level'] : null, //NFT等级
'nft_ quality2' => $new_nft['quality'] ? $new_nft['quality'] : null, //NFT品阶2
'nft_level2' => $new_nft['level'] ? $new_nft['level'] : null, //NFT等级2
'old_nft' => json_encode($old_nft),
'nft_info' => json_encode($old_nft),
'new_nft' => json_encode($new_nft)
);
return $info;
}
private static function nftProductInfo($nft)
{
$info = array(
'nft_unique_id' => $nft['idx'], //NFT idx
'nft_token_id' => $nft['token_id']?$nft['token_id']:null, //NFT token ID
'nft_item_id' => $nft['item_id'], //NFT item ID
'nft_info' => json_encode($nft),
);
return $info;
}
}