skill_common
This commit is contained in:
parent
242a928fdf
commit
7928ea7c0c
18
doc/Hero.py
18
doc/Hero.py
@ -54,9 +54,11 @@ class Hero(object):
|
|||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['hero_uniid', 0, '英雄唯一id'],
|
['hero_uniid', 0, '英雄唯一id'],
|
||||||
|
['skill_idx', 0, '技能idx 0:主动技能;1:被动技能'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -164,4 +166,20 @@ class Hero(object):
|
|||||||
['!data', [_common.Hero()], '英雄信息']
|
['!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(), '属性变更'],
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -214,11 +214,12 @@ class Hero(object):
|
|||||||
['state', 0, '0:已购买 1:体验中'],
|
['state', 0, '0:已购买 1:体验中'],
|
||||||
['skin_id', 0, '英雄皮肤id'],
|
['skin_id', 0, '英雄皮肤id'],
|
||||||
['quality', 0, '品阶'],
|
['quality', 0, '品阶'],
|
||||||
['skill_lv1', 0, '必杀技等级'],
|
['skill_lv1', 0, '主动技能unique_id'],
|
||||||
['skill_lv2', 0, '躲避技能等级'],
|
['skill_lv2', 0, '被动技能unique_id'],
|
||||||
['ceg_uplimit', 0, 'ceg今天获取上限'],
|
['ceg_uplimit', 0, 'ceg今天获取上限'],
|
||||||
['pve_ceg_uplimit', 0, 'pve ceg今天获取上限'],
|
['pve_ceg_uplimit', 0, 'pve ceg今天获取上限'],
|
||||||
['!attr', [Attr()], '属性'],
|
['!attr', [Attr()], '英雄总属性'],
|
||||||
|
['!rand_attr', [Attr()], '芯片属性'],
|
||||||
['try_count', 0, '剩余体验次数 当state=1时才有意义'],
|
['try_count', 0, '剩余体验次数 当state=1时才有意义'],
|
||||||
['lock_type', 0, '0:无锁 1:升级 2:升阶 3:派遣中'],
|
['lock_type', 0, '0:无锁 1:升级 2:升阶 3:派遣中'],
|
||||||
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],
|
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],
|
||||||
|
@ -472,9 +472,7 @@ class ChipController extends BaseAuthedController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test(){
|
public function test(){
|
||||||
// $a = \services\FormulaService::Do_Demount_Hero_Mint(620.2-612.738994);
|
// $nft_active = SqlHelper::ormSelect(
|
||||||
|
|
||||||
// $nft = SqlHelper::ormSelect(
|
|
||||||
// myself()->_getSelfMysql(),
|
// myself()->_getSelfMysql(),
|
||||||
// 't_nft_active',
|
// 't_nft_active',
|
||||||
// array(
|
// array(
|
||||||
@ -482,14 +480,18 @@ class ChipController extends BaseAuthedController
|
|||||||
// 'token_type' =>3,
|
// 'token_type' =>3,
|
||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
// foreach ($nft as $item){
|
// foreach ($nft_active as $item){
|
||||||
// $chip = Chip::getChipByTokenId($item['token_id']);
|
// $chip = Chip::getChipByTokenId($item['token_id']);
|
||||||
// $Hero_Chip_PSA_Value= \services\FormulaService::Hero_Chip_PSA_Value($chip['chip_grade']);
|
// if ($chip['chip_type'] == 1){
|
||||||
// $tili = $chip['strength']-$chip['strength_max']*$Hero_Chip_PSA_Value;
|
// $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]);
|
// Chip::update($chip['token_id'],['strength'=>$tili]);
|
||||||
// }
|
// }
|
||||||
// print_r($a);
|
// $this->_rspOk();
|
||||||
$this->chipDetails();
|
echo $this->_getV(TN_HERO_LEVEL_UP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -741,9 +743,9 @@ class ChipController extends BaseAuthedController
|
|||||||
|
|
||||||
$lucky = ltrim(\services\FormulaService::getChipLuckyValue($new_grade),'-') ;
|
$lucky = ltrim(\services\FormulaService::getChipLuckyValue($new_grade),'-') ;
|
||||||
if ($new_grade>=5){
|
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{
|
}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);
|
Chip::update($chip['token_id'],$where);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ require_once('mt/HeroLevelAttr.php');
|
|||||||
require_once('mt/HeroQuality.php');
|
require_once('mt/HeroQuality.php');
|
||||||
require_once('mt/AttrHelper.php');
|
require_once('mt/AttrHelper.php');
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
|
require_once('mt/SkillCommon.php');
|
||||||
|
require_once('mt/Skill.php');
|
||||||
|
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
require_once('models/Bag.php');
|
require_once('models/Bag.php');
|
||||||
@ -64,7 +66,11 @@ class HeroController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hero['rand_attr'] = $item;
|
$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);
|
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
|
||||||
$hero['attr'] = $hero_attr;
|
$hero['attr'] = $hero_attr;
|
||||||
$chipCore = [];
|
$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()
|
public function skinList()
|
||||||
{
|
{
|
||||||
$skinList = array();
|
$skinList = array();
|
||||||
@ -128,23 +224,6 @@ class HeroController extends BaseAuthedController {
|
|||||||
$this->_rspOk();
|
$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()
|
public function getUpgradeLevelList()
|
||||||
{
|
{
|
||||||
$infos = array();
|
$infos = array();
|
||||||
|
@ -213,7 +213,6 @@ class Chip extends BaseModel
|
|||||||
$rand_attr = emptyReplace(json_decode($chip['rand_attr'], true), array());
|
$rand_attr = emptyReplace(json_decode($chip['rand_attr'], true), array());
|
||||||
array_push($rand_attr,$attr_pool);
|
array_push($rand_attr,$attr_pool);
|
||||||
$fieldsKv = [
|
$fieldsKv = [
|
||||||
'chip_grade'=>$chip['chip_grade']+1,
|
|
||||||
'rand_attr'=>json_encode($rand_attr)
|
'rand_attr'=>json_encode($rand_attr)
|
||||||
];
|
];
|
||||||
self::update($chip['token_id'],$fieldsKv);
|
self::update($chip['token_id'],$fieldsKv);
|
||||||
|
@ -212,7 +212,9 @@ class Hero extends BaseModel {
|
|||||||
'def' => $def,
|
'def' => $def,
|
||||||
'advanced_count' => $row['advanced_count'],
|
'advanced_count' => $row['advanced_count'],
|
||||||
'lucky' => $heroLucky,
|
'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['ceg_uplimit'] = FormulaService::getHeroPvpDailyCegUpLimit($dto);
|
||||||
$dto['raw_pve_ceg_uplimit'] =
|
$dto['raw_pve_ceg_uplimit'] =
|
||||||
@ -249,8 +251,8 @@ class Hero extends BaseModel {
|
|||||||
'quality' => 1,
|
'quality' => 1,
|
||||||
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
|
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
|
||||||
'state' => self::GETED_STATE,
|
'state' => self::GETED_STATE,
|
||||||
'skill_lv1' => 1,
|
'skill_lv1' => $realHeroMeta['skill1list'],
|
||||||
'skill_lv2' => 1,
|
'skill_lv2' => $realHeroMeta['skill3list'],
|
||||||
'rand_attr' => json_encode($randAttr),
|
'rand_attr' => json_encode($randAttr),
|
||||||
'lock_type' => self::NO_LOCK,
|
'lock_type' => self::NO_LOCK,
|
||||||
'unlock_time' => 0,
|
'unlock_time' => 0,
|
||||||
|
24
webapp/mt/SkillCommon.php
Normal file
24
webapp/mt/SkillCommon.php
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user