skill_common

This commit is contained in:
hujiabin 2022-08-29 17:29:11 +08:00
parent 242a928fdf
commit 7928ea7c0c
7 changed files with 160 additions and 35 deletions

View File

@ -54,9 +54,11 @@ class Hero(object):
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'],
['skill_idx', 0, '技能idx 0主动技能1被动技能'],
],
'response': [
_common.RspHead(),
['property_chg', _common.PropertyChg(), '属性变更'],
]
},
{
@ -164,4 +166,20 @@ class Hero(object):
['!data', [_common.Hero()], '英雄信息']
]
},
{
'name': 'upgradeSkillCommon',
'desc': '通用技能升级',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=upgradeSkillCommon',
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'],
['skill_index', 0, '通用技能下标'],
],
'response': [
_common.RspHead(),
['property_chg', _common.PropertyChg(), '属性变更'],
]
},
]

View File

@ -214,11 +214,12 @@ class Hero(object):
['state', 0, '0已购买 1体验中'],
['skin_id', 0, '英雄皮肤id'],
['quality', 0, '品阶'],
['skill_lv1', 0, '必杀技等级'],
['skill_lv2', 0, '躲避技能等级'],
['skill_lv1', 0, '主动技能unique_id'],
['skill_lv2', 0, '被动技能unique_id'],
['ceg_uplimit', 0, 'ceg今天获取上限'],
['pve_ceg_uplimit', 0, 'pve ceg今天获取上限'],
['!attr', [Attr()], '属性'],
['!attr', [Attr()], '英雄总属性'],
['!rand_attr', [Attr()], '芯片属性'],
['try_count', 0, '剩余体验次数 当state=1时才有意义'],
['lock_type', 0, '0:无锁 1:升级 2:升阶 3:派遣中'],
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],

View File

@ -472,9 +472,7 @@ class ChipController extends BaseAuthedController
}
public function test(){
// $a = \services\FormulaService::Do_Demount_Hero_Mint(620.2-612.738994);
// $nft = SqlHelper::ormSelect(
// $nft_active = SqlHelper::ormSelect(
// myself()->_getSelfMysql(),
// 't_nft_active',
// array(
@ -482,14 +480,18 @@ class ChipController extends BaseAuthedController
// 'token_type' =>3,
// )
// );
// foreach ($nft as $item){
// foreach ($nft_active as $item){
// $chip = Chip::getChipByTokenId($item['token_id']);
// $Hero_Chip_PSA_Value= \services\FormulaService::Hero_Chip_PSA_Value($chip['chip_grade']);
// $tili = $chip['strength']-$chip['strength_max']*$Hero_Chip_PSA_Value;
// if ($chip['chip_type'] == 1){
// $Chip_PSA_Value= \services\FormulaService::Hero_Chip_PSA_Value($chip['chip_grade']);
// }else{
// $Chip_PSA_Value= \services\FormulaService::Weapon_Chip_DA_Value($chip['chip_grade']);
// }
// $tili = $chip['strength']-$chip['strength_max']*$Chip_PSA_Value;
// Chip::update($chip['token_id'],['strength'=>$tili]);
// }
// print_r($a);
$this->chipDetails();
// $this->_rspOk();
echo $this->_getV(TN_HERO_LEVEL_UP, 0);
}
@ -741,9 +743,9 @@ class ChipController extends BaseAuthedController
$lucky = ltrim(\services\FormulaService::getChipLuckyValue($new_grade),'-') ;
if ($new_grade>=5){
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade,'supper_state'=>1];
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade,'supper_state'=>1,'modifytime' => $this->_getNowTime()];
}else{
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade];
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade,'modifytime' => $this->_getNowTime()];
}
Chip::update($chip['token_id'],$where);
}

View File

@ -8,6 +8,8 @@ require_once('mt/HeroLevelAttr.php');
require_once('mt/HeroQuality.php');
require_once('mt/AttrHelper.php');
require_once('mt/Parameter.php');
require_once('mt/SkillCommon.php');
require_once('mt/Skill.php');
require_once('models/Hero.php');
require_once('models/Bag.php');
@ -64,7 +66,11 @@ class HeroController extends BaseAuthedController {
}
}
$hero['rand_attr'] = $item;
$hero_attr = emptyReplace(json_decode($hero['attr'], true), array());
if ($hero['attr']){
$hero_attr = emptyReplace(json_decode($hero['attr'], true), array());
}else{
$hero_attr = [];
}
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
$hero['attr'] = $hero_attr;
$chipCore = [];
@ -92,6 +98,96 @@ class HeroController extends BaseAuthedController {
));
}
public function upgradeSkillCommon(){
$heroUniId = getReqVal('hero_uniid', 0);
$skillIndex = getReqVal('skill_index', 0);
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
$item = explode('|',$heroDb['skill_common']);
$skill_common = \mt\SkillCommon::get($item[$skillIndex]);
if ($skill_common['skill_level'] == 10){
$this->_rspErr(1, "Max level");
return;
}
if($heroDb['quality'] < $skill_common['skill_limit_star']){
$this->_rspErr(1, "Hero level is not enough");
return;
}
if($heroDb['skill_points'] < $skill_common['skill_point_cost']){
$this->_rspErr(1, "Not enough hero skill points");
return;
}
$item[$skillIndex] = $skill_common['nextlv_skill'];
$where = [
'skill_common'=>implode('|',$item),
'skill_points'=>$heroDb['skill_points']-$skill_common['skill_point_cost'],
'modifytime' => $this->_getNowTime()
];
Hero::update($heroUniId, $where);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'propery_chg' => $propertyChgService->toDto(),
));
}
public function upgradeSkill()
{
$heroUniId = getReqVal('hero_uniid', 0);
$skillIdx = getReqVal('skill_idx', 0);
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
if (!in_array($skillIdx, array(0, 1))) {
$this->_rspErr(1, 'skill_idx must be 0-1');
return;
}
if ($skillIdx){
$skill = \mt\Skill::get($heroDb['skill_lv2']);
}else{
$skill = \mt\Skill::get($heroDb['skill_lv1']);
}
if (!$skill){
$this->_rspErr(1, "You don't have the skill yet");
return;
}
if ($skill['level_skill'] == 15){
$this->_rspErr(1, "Max level");
return;
}
if($heroDb['quality'] < $skill['skill_limit_star']){
$this->_rspErr(1, "Hero level is not enough");
return;
}
if(! $heroDb['skill_points'] || $heroDb['skill_points'] < $skill['skill_point']){
$this->_rspErr(1, "Not enough hero skill points");
return;
}
if ($skillIdx){
$where = [
'skill_lv2'=>$skill['nextlv_skill'],
'modifytime' => $this->_getNowTime()
];
}else{
$where = [
'skill_lv1'=>$skill['nextlv_skill'],
'modifytime' => $this->_getNowTime()
];
}
Hero::update($heroUniId,$where);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'propery_chg' => $propertyChgService->toDto(),
));
}
public function skinList()
{
$skinList = array();
@ -128,23 +224,6 @@ class HeroController extends BaseAuthedController {
$this->_rspOk();
}
public function upgradeSkill()
{
$heroUniId = getReqVal('hero_uniid', 0);
$skillIdx = getReqVal('skill_idx', 0);
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
if (!in_array($skillIdx, array(0, 1))) {
$this->_rspErr(1, 'skill_idx must be 0-1');
return;
}
Hero::upgradeSkill($heroUniId, $skillIdx);
$this->_rspOk();
}
public function getUpgradeLevelList()
{
$infos = array();

View File

@ -213,7 +213,6 @@ class Chip extends BaseModel
$rand_attr = emptyReplace(json_decode($chip['rand_attr'], true), array());
array_push($rand_attr,$attr_pool);
$fieldsKv = [
'chip_grade'=>$chip['chip_grade']+1,
'rand_attr'=>json_encode($rand_attr)
];
self::update($chip['token_id'],$fieldsKv);

View File

@ -212,7 +212,9 @@ class Hero extends BaseModel {
'def' => $def,
'advanced_count' => $row['advanced_count'],
'lucky' => $heroLucky,
'chip_ids' => $row['chip_ids']
'chip_ids' => $row['chip_ids'],
'skill_common' => explode("|",$row['skill_common']),
'skill_points' => $row['skill_points'],
);
$dto['ceg_uplimit'] = FormulaService::getHeroPvpDailyCegUpLimit($dto);
$dto['raw_pve_ceg_uplimit'] =
@ -249,8 +251,8 @@ class Hero extends BaseModel {
'quality' => 1,
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
'state' => self::GETED_STATE,
'skill_lv1' => 1,
'skill_lv2' => 1,
'skill_lv1' => $realHeroMeta['skill1list'],
'skill_lv2' => $realHeroMeta['skill3list'],
'rand_attr' => json_encode($randAttr),
'lock_type' => self::NO_LOCK,
'unlock_time' => 0,

24
webapp/mt/SkillCommon.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace mt;
use phpcommon;
class SkillCommon {
protected static $metaList;
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('skillCommon@skillCommon.php');
}
return self::$metaList;
}
public static function get($id)
{
// return self::getMetaList();
return getXVal(self::getMetaList(), $id);
}
}