升级及合约地址的修改
This commit is contained in:
parent
8ea7d4ab02
commit
ecd257a4ee
@ -98,7 +98,6 @@ class Gun(object):
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['gun_uniid', 0, '枪械唯一id'],
|
||||
['cost_gun_uniid', 0, '材料武器id'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
|
@ -85,7 +85,6 @@ class Hero(object):
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['hero_uniid', 0, '英雄唯一id'],
|
||||
['cost_hero_uniid', 0, '材料英雄id(非必选参数--4|9|14等级必选)'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
|
@ -5,7 +5,7 @@ import _common
|
||||
class Sign(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis_ = [
|
||||
self.apis = [
|
||||
{
|
||||
'name': 'getSignList',
|
||||
'desc': '7日签到',
|
||||
|
11
doc/Star.py
11
doc/Star.py
@ -5,9 +5,10 @@ import _common
|
||||
class Star(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis_ = [
|
||||
self.apis = [
|
||||
{
|
||||
'desc': 'getList',
|
||||
'name': 'getList',
|
||||
'desc': '成长任务列表',
|
||||
'group': 'Star',
|
||||
'url': 'webapp/index.php?c=Star&a=getList',
|
||||
'params': [
|
||||
@ -19,7 +20,8 @@ class Star(object):
|
||||
['!data', [Task()], '任务列表'],
|
||||
]
|
||||
},{
|
||||
'desc': 'commit',
|
||||
'name': 'commit',
|
||||
'desc': '领取任务',
|
||||
'group': 'Star',
|
||||
'url': 'webapp/index.php?c=Star&a=commit',
|
||||
'params': [
|
||||
@ -32,7 +34,8 @@ class Star(object):
|
||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||
]
|
||||
},{
|
||||
'desc': 'commitAll',
|
||||
'name': 'commitAll',
|
||||
'desc': '全部领取',
|
||||
'group': 'Star',
|
||||
'url': 'webapp/index.php?c=Star&a=commitAll',
|
||||
'params': [
|
||||
|
@ -95,6 +95,7 @@ class Gun(object):
|
||||
['last_pve_get_ceg_time', 0, '最后一次获取pve获取ceg时间'],
|
||||
['offer_reward_state', 0, '是否悬赏中'],
|
||||
['tags', '', '1:Gen状态'],
|
||||
['!hero_ids', [], '被使用英雄的item_id'],
|
||||
]
|
||||
|
||||
class GunSkin(object):
|
||||
|
@ -4,6 +4,7 @@ require_once('models/Chip.php');
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/User.php');
|
||||
require_once('models/Bag.php');
|
||||
|
||||
require_once('mt/ChipAttr.php');
|
||||
|
||||
@ -16,6 +17,7 @@ require_once('services/LogService.php');
|
||||
|
||||
|
||||
use models\Chip;
|
||||
use models\Bag;
|
||||
use models\Hero;
|
||||
use models\Gun;
|
||||
use models\User;
|
||||
@ -70,6 +72,11 @@ class ChipController extends BaseAuthedController
|
||||
$this->_rspErr(1,' Level upper limit');
|
||||
return;
|
||||
}
|
||||
$paramMeta = mt\Parameter::getByName('chip_upgrade_cost');
|
||||
if (!$paramMeta){
|
||||
$this->_rspErr(1, ' parameter null');
|
||||
return;
|
||||
}
|
||||
$chip = Chip::toDto($chipDb);
|
||||
$rand_attr = emptyReplace(json_decode($chipDb['rand_attr'], true), array());
|
||||
$chipMeta = mt\ChipAttr::getAttrByItemId($chipDb['item_id']);
|
||||
@ -80,22 +87,32 @@ class ChipController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
$chip['rand_attr_after'] = $rand_attr;
|
||||
$paramMeta = mt\Parameter::getByName('chip_upgrade_cost');
|
||||
$gold = 0;
|
||||
if ($paramMeta){
|
||||
|
||||
$paramValue = explode('|',$paramMeta['param_value']);
|
||||
$gold = 0;
|
||||
$stone = 0;
|
||||
switch ($chipDb['chip_grade']){
|
||||
case 1: {
|
||||
$gold = $paramValue[0];
|
||||
$lv2 = explode(':',$paramValue[0]);
|
||||
$gold = $lv2[0];
|
||||
$stone = $lv2[1];
|
||||
};break;
|
||||
case 2: {
|
||||
$gold = $paramValue[1];
|
||||
$lv3 = explode(':',$paramValue[1]);
|
||||
$gold = $lv3[0];
|
||||
$stone = $lv3[1];
|
||||
};break;
|
||||
}
|
||||
}
|
||||
|
||||
$chip['cost'] = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $gold
|
||||
),
|
||||
array(
|
||||
'item_id' => V_ITEM_CHIP_META,
|
||||
'item_num' => $stone
|
||||
)
|
||||
);
|
||||
$this->_rspData(array(
|
||||
'data' => $chip
|
||||
@ -132,55 +149,48 @@ class ChipController extends BaseAuthedController
|
||||
}
|
||||
|
||||
public function upgradeLevel(){
|
||||
$idxMain = trim(getReqVal('unique_id_main', 0));
|
||||
$idxParam = trim(getReqVal('unique_id_param', 0));
|
||||
if (!$idxMain || !$idxParam) {
|
||||
$chipUniId = trim(getReqVal('chip_uniid', 0));
|
||||
if (!$chipUniId) {
|
||||
$this->_rspErr(1, 'Please enter parameter');
|
||||
return;
|
||||
}
|
||||
$chipDbMain = Chip::find($idxMain);
|
||||
if (!$chipDbMain){
|
||||
$chipDb = Chip::find($chipUniId);
|
||||
if (!$chipDb){
|
||||
$this->_rspErr(1,'unique_id_main parameter error');
|
||||
return;
|
||||
}
|
||||
if ($chipDbMain['chip_grade'] == Chip::CHIP_LV_MAX){
|
||||
if ($chipDb['chip_grade'] == Chip::CHIP_LV_MAX){
|
||||
$this->_rspErr(1,' Level upper limit');
|
||||
return;
|
||||
}
|
||||
$chipDbParam = Chip::find($idxParam);
|
||||
if (!$chipDbParam){
|
||||
$this->_rspErr(1,"unique_id_param parameter error");
|
||||
return;
|
||||
}
|
||||
if ($chipDbParam['token_id']) {
|
||||
$this->_rspErr(1, "Unable to use nft chip");
|
||||
return;
|
||||
}
|
||||
// if ($chipDbParam['state'] == Chip::FREE_STATE) {
|
||||
// $this->_rspErr(1, "Unable to use free chip");
|
||||
// return;
|
||||
// }
|
||||
if (count(array_filter(explode("|",$chipDbParam['inlay_state']))) > 0){
|
||||
$this->_rspErr(1, "The used chip");
|
||||
return;
|
||||
}
|
||||
if ($chipDbParam['chip_grade'] != $chipDbMain['chip_grade']){
|
||||
$this->_rspErr(1, "Material chip grade does not meet");
|
||||
return;
|
||||
}
|
||||
|
||||
$paramMeta = mt\Parameter::getByName('chip_upgrade_cost');
|
||||
$gold = 0;
|
||||
if ($paramMeta){
|
||||
if (!$paramMeta){
|
||||
$this->_rspErr(1, ' parameter null');
|
||||
return;
|
||||
}
|
||||
$paramValue = explode('|',$paramMeta['param_value']);
|
||||
switch ($chipDbMain['chip_grade']){
|
||||
$gold = 0;
|
||||
$stone = 0;
|
||||
switch ($chipDb['chip_grade']){
|
||||
case 1: {
|
||||
$gold = $paramValue[0];
|
||||
$lv2 = explode(':',$paramValue[0]);
|
||||
$gold = $lv2[0];
|
||||
$stone = $lv2[1];
|
||||
};break;
|
||||
case 2: {
|
||||
$gold = $paramValue[1];
|
||||
$lv3 = explode(':',$paramValue[1]);
|
||||
$gold = $lv3[0];
|
||||
$stone = $lv3[1];
|
||||
};break;
|
||||
}
|
||||
//校验枪械水晶数量
|
||||
$num = Bag::getItemCount(V_ITEM_CHIP_META);
|
||||
if ($num < $stone){
|
||||
$this->_rspErr(3, "Lack of chip crystal");
|
||||
return;
|
||||
}
|
||||
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
@ -194,27 +204,26 @@ class ChipController extends BaseAuthedController
|
||||
}
|
||||
|
||||
$this->_decItems($costItems);
|
||||
Chip::update2($idxParam,
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId() . '!!!',
|
||||
)
|
||||
);
|
||||
Bag::decItem(V_ITEM_CHIP_META,$stone);
|
||||
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addChip();
|
||||
$rand_attr = emptyReplace(json_decode($chipDbMain['rand_attr'], true), array());
|
||||
$attrProMeta = \mt\ChipAttr::getAttrPool($chipDbMain);
|
||||
$propertyChgService->addBagChg();
|
||||
$propertyChgService->addUserChg();
|
||||
$rand_attr = emptyReplace(json_decode($chipDb['rand_attr'], true), array());
|
||||
$attrProMeta = \mt\ChipAttr::getAttrPool($chipDb);
|
||||
array_push($rand_attr,array(
|
||||
'attr_id'=>$attrProMeta['attr_id'],
|
||||
'val'=>$attrProMeta['val'],
|
||||
));
|
||||
Chip::update2($idxMain,
|
||||
Chip::update2($chipUniId,
|
||||
array(
|
||||
'chip_grade' => $chipDbMain['chip_grade']+1,
|
||||
'chip_grade' => $chipDb['chip_grade']+1,
|
||||
'state' => Chip::GETED_STATE,
|
||||
'rand_attr' => json_encode($rand_attr),
|
||||
)
|
||||
);
|
||||
$chipDbNew = Chip::toDto(Chip::find($idxMain));
|
||||
$chipDbNew = Chip::toDto(Chip::find($chipUniId));
|
||||
$this->_rspData([
|
||||
'data'=>$chipDbNew,
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
|
@ -13,10 +13,10 @@ class GMController extends BaseAuthedController {
|
||||
public function _handlePre()
|
||||
{
|
||||
parent::_handlePre();
|
||||
// if (SERVER_ENV == _ONLINE) {
|
||||
// die("can't create GMController");
|
||||
// return;
|
||||
// }
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
die("can't create GMController");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function execCmd()
|
||||
@ -35,9 +35,9 @@ class GMController extends BaseAuthedController {
|
||||
'.additem' => function () use($params) {
|
||||
$this->addItem($params);
|
||||
},
|
||||
'.addnft' => function () use($params) {
|
||||
$this->addNft($params);
|
||||
},
|
||||
// '.addnft' => function () use($params) {
|
||||
// $this->addNft($params);
|
||||
// },
|
||||
'.addtili' => function () use($params) {
|
||||
$this->addTili($params);
|
||||
},
|
||||
@ -160,7 +160,7 @@ END
|
||||
die('不支持设置系统时间');
|
||||
return;
|
||||
}
|
||||
$newtime = strtotime($_REQUET['newtime']);
|
||||
$newtime = strtotime($_REQUEST['newtime']);
|
||||
if ($newtime <= 0) {
|
||||
die('时间格式错误');
|
||||
return;
|
||||
|
@ -159,11 +159,20 @@ class GunController extends BaseAuthedController {
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $nextLevelMeta['gold']
|
||||
),
|
||||
// array(
|
||||
// 'item_id' => V_ITEM_DIAMOND,
|
||||
// 'item_num' => $nextLevelMeta['diamond']
|
||||
// ),
|
||||
array(
|
||||
'item_id' => V_ITEM_GUN_META,
|
||||
'item_num' => $nextLevelMeta['stone']
|
||||
)
|
||||
);
|
||||
$metaList = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE);
|
||||
foreach ($metaList as $meta){
|
||||
if ($meta['relationship'] == $gunDb['gun_id']) {
|
||||
array_push($costItems,array(
|
||||
'item_id' => $meta['id'],
|
||||
'item_num' => $nextLevelMeta['piece'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$newGunDb = $gunDb;
|
||||
$newGunDb['gun_lv'] += 1;
|
||||
@ -182,26 +191,15 @@ class GunController extends BaseAuthedController {
|
||||
|
||||
public function upgradeLv(){
|
||||
$gunUniId = getReqVal('gun_uniid', 0);
|
||||
$costGunUniId = getReqVal('cost_gun_uniid', 0);
|
||||
// $costGunUniId = getReqVal('cost_gun_uniid', 0);
|
||||
$gunDb = Gun::find($gunUniId);
|
||||
$oldGun = Gun::toDto($gunDb);
|
||||
$costGunDb = Gun::findEx($costGunUniId);
|
||||
if (!$gunDb || !$costGunDb) {
|
||||
// $costGunDb = Gun::findEx($costGunUniId);
|
||||
if (!$gunDb ) {
|
||||
$this->_rspErr(100, 'param error or null');
|
||||
return;
|
||||
}
|
||||
if ($costGunDb['token_id']){
|
||||
$this->_rspErr(100, 'NFT cannot be a material');
|
||||
return;
|
||||
}
|
||||
// if ($costGunDb['state'] == Gun::FREE_STATE){
|
||||
// $this->_rspErr(100, 'Unable to use free gun');
|
||||
// return;
|
||||
// }
|
||||
if ($gunDb['gun_lv'] != $costGunDb['gun_lv']){
|
||||
$this->_rspErr(100, 'You need the same level to do it');
|
||||
return;
|
||||
}
|
||||
|
||||
$itemMeta = mt\Item::get($gunDb['gun_id']);
|
||||
if (!$itemMeta) {
|
||||
$this->_rspErr(100, 'server internal error');
|
||||
@ -213,8 +211,29 @@ class GunController extends BaseAuthedController {
|
||||
$this->_rspErr(5, "It's already the highest level");
|
||||
return;
|
||||
}
|
||||
//校验枪械碎片数量
|
||||
$piece_item_id = 0;
|
||||
$metaList = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE);
|
||||
foreach ($metaList as $meta){
|
||||
if ($meta['relationship'] == $gunDb['gun_id']) {
|
||||
$piece_item_id = $meta['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$piece_num = Bag::getItemCount($piece_item_id);
|
||||
if ($piece_num < $nextLevelMeta['piece']){
|
||||
$this->_rspErr(3, "Lack of gun piece");
|
||||
return;
|
||||
}
|
||||
//校验枪械水晶数量
|
||||
$num = Bag::getItemCount(V_ITEM_GUN_META);
|
||||
if ($num < $nextLevelMeta['stone']){
|
||||
$this->_rspErr(3, "Lack of gun crystal");
|
||||
return;
|
||||
}
|
||||
|
||||
//升级所需消耗
|
||||
|
||||
//校验用户gold数量
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
@ -231,6 +250,8 @@ class GunController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
Bag::decItem($piece_item_id,$nextLevelMeta['piece']);
|
||||
Bag::decItem(V_ITEM_GUN_META,$nextLevelMeta['stone']);
|
||||
|
||||
$attrs = Gun::LvUpAddAttr($gunDb,1);
|
||||
Gun::update($gunUniId,
|
||||
@ -239,15 +260,12 @@ class GunController extends BaseAuthedController {
|
||||
'state' => Gun::GETED_STATE,
|
||||
'rand_attr' => json_encode($attrs),
|
||||
));
|
||||
Gun::update($costGunUniId,
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId() . '!!!',
|
||||
)
|
||||
);
|
||||
|
||||
$newGun = Gun::toDto(Gun::find($gunUniId));
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addGunChg();
|
||||
$propertyChgService->addUserChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'old_gun' => $oldGun,
|
||||
|
@ -11,6 +11,7 @@ require_once('models/Nft.php');
|
||||
require_once('models/ChipPage.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/HeroPreset.php');
|
||||
require_once('models/Bag.php');
|
||||
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
@ -25,6 +26,7 @@ use models\ChipPage;
|
||||
use models\Gun;
|
||||
use models\Nft;
|
||||
use models\HeroPreset;
|
||||
use models\Bag;
|
||||
use services\LogService;
|
||||
|
||||
class HeroController extends BaseAuthedController {
|
||||
@ -163,50 +165,13 @@ class HeroController extends BaseAuthedController {
|
||||
public function upgradeLv()
|
||||
{
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
// $costHeroUniId = getReqVal('cost_hero_uniid', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$oldHero = Hero::toDto($heroDb);
|
||||
// $costHeroDb = Hero::findEx($costHeroUniId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(100, 'param error or null');
|
||||
return;
|
||||
}
|
||||
// if ($heroDb['hero_lv'] == Hero::LV_1 ||
|
||||
// $heroDb['hero_lv'] == Hero::LV_2 ||
|
||||
// $heroDb['hero_lv'] == Hero::LV_3 ){
|
||||
// if (! $costHeroDb){
|
||||
// $this->_rspErr(100, 'material param error or null');
|
||||
// return;
|
||||
// }
|
||||
// if ($costHeroDb['token_id']){
|
||||
// $this->_rspErr(100, 'NFT cannot be a material');
|
||||
// return;
|
||||
// }
|
||||
//// if ($costHeroDb['state'] == Hero::FREE_STATE){
|
||||
//// $this->_rspErr(100, 'Unable to use free hero');
|
||||
//// return;
|
||||
//// }
|
||||
// switch ($heroDb['hero_lv']){
|
||||
// case Hero::LV_1:{
|
||||
// if ($heroDb['hero_lv'] < $costHeroDb['hero_lv']){
|
||||
// $this->_rspErr(100, 'Grade discrepancy');
|
||||
// return;
|
||||
// }
|
||||
// };break;
|
||||
// case Hero::LV_2:{
|
||||
// if ($heroDb['hero_lv'] < $costHeroDb['hero_lv'] && $costHeroDb['hero_lv'] <= Hero::LV_1){
|
||||
// $this->_rspErr(100, 'Grade discrepancy');
|
||||
// return;
|
||||
// }
|
||||
// };break;
|
||||
// case Hero::LV_3:{
|
||||
// if ($heroDb['hero_lv'] < $costHeroDb['hero_lv'] && $costHeroDb['hero_lv'] <= Hero::LV_2){
|
||||
// $this->_rspErr(100, 'Grade discrepancy');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$heroMeta = mt\Hero::get($heroDb['hero_id']);
|
||||
if (!$heroMeta) {
|
||||
$this->_rspErr(100, 'server internal error');
|
||||
@ -217,8 +182,30 @@ class HeroController extends BaseAuthedController {
|
||||
$this->_rspErr(5, "It's already the highest level");
|
||||
return;
|
||||
}
|
||||
die;
|
||||
//升级所需消耗
|
||||
|
||||
//校验英雄碎片数量
|
||||
$piece_item_id = 0;
|
||||
$metaList = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE);
|
||||
foreach ($metaList as $meta){
|
||||
if ($meta['relationship'] == $heroDb['hero_id']) {
|
||||
$piece_item_id = $meta['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$piece_num = Bag::getItemCount($piece_item_id);
|
||||
if ($piece_num < $nextLevelMeta['piece']){
|
||||
$this->_rspErr(3, "Lack of hero piece");
|
||||
return;
|
||||
}
|
||||
|
||||
//校验英雄水晶数量
|
||||
$num = Bag::getItemCount(V_ITEM_HERO_META);
|
||||
if ($num < $nextLevelMeta['serum']){
|
||||
$this->_rspErr(3, "Lack of hero crystal");
|
||||
return;
|
||||
}
|
||||
|
||||
//校验用户gold数量
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
@ -235,6 +222,8 @@ class HeroController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
Bag::decItem($piece_item_id,$nextLevelMeta['piece']);
|
||||
Bag::decItem(V_ITEM_HERO_META,$nextLevelMeta['serum']);
|
||||
|
||||
$attrs = Hero::LvUpAddAttr($heroDb,\mt\HeroLevelAttr::FINAL_RAND_ATTR);
|
||||
Hero::update($heroUniId, array(
|
||||
@ -242,11 +231,7 @@ class HeroController extends BaseAuthedController {
|
||||
'rand_attr' => json_encode($attrs),
|
||||
'state' => Hero::GETED_STATE,
|
||||
));
|
||||
if ($costHeroDb){
|
||||
Hero::update($costHeroUniId, array(
|
||||
'account_id' => myself()->_getAccountId() . '!!!',
|
||||
));
|
||||
}
|
||||
|
||||
if ($heroDb['hero_lv'] + 1 > myself()->_getV(TN_HERO_MAX_LEVEL, 0)) {
|
||||
myself()->_setV(TN_HERO_MAX_LEVEL, 0, $heroDb['hero_lv'] + 1);
|
||||
}
|
||||
@ -254,6 +239,7 @@ class HeroController extends BaseAuthedController {
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addHeroChg();
|
||||
$propertyChgService->addUserChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'old_hero' => $oldHero,
|
||||
|
@ -5,6 +5,7 @@ namespace models;
|
||||
|
||||
require_once('services/NftService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
require_once('services/ContractConfig.php');
|
||||
|
||||
require_once('mt/Item.php');
|
||||
require_once('mt/ChipAttr.php');
|
||||
@ -13,6 +14,7 @@ require_once('mt/ChipAttr.php');
|
||||
use mt;
|
||||
use mt\ChipAttr;
|
||||
use phpcommon\SqlHelper;
|
||||
use services\ContractConfig;
|
||||
use services\NftService;
|
||||
use services\FormulaService;
|
||||
|
||||
@ -174,8 +176,9 @@ class Chip extends BaseModel
|
||||
);
|
||||
$dto['chip_name'] = mt\Item::get($row['item_id'])?mt\Item::get($row['item_id'])['name']:'XXX';
|
||||
$nft_address = '';
|
||||
$contract = ContractConfig::find(ContractConfig::ERC721);
|
||||
if ($dto['token_id']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x73482411443E87CAC124C12A10B34e9Aaa2De168' : '0x26b4AFb60d6C903165150C6F0AA14F8016bE4aec';
|
||||
$nft_address = $contract ? $contract['chip'] : "";
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
$dto['tags'] = '';
|
||||
|
@ -9,12 +9,14 @@ require_once('models/GunSkin.php');
|
||||
require_once('models/ChipPlugin.php');
|
||||
require_once('services/NftService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
require_once('services/ContractConfig.php');
|
||||
|
||||
use mt;
|
||||
use phpcommon;
|
||||
use phpcommon\SqlHelper;
|
||||
use services\NftService;
|
||||
use services\FormulaService;
|
||||
use services\ContractConfig;
|
||||
use models\ChipPlugin;
|
||||
|
||||
class Gun extends BaseModel {
|
||||
@ -245,24 +247,17 @@ class Gun extends BaseModel {
|
||||
$lockType = $row['lock_type'];
|
||||
$unlockTime = $row['unlock_time'];
|
||||
}
|
||||
{
|
||||
$heroIds =array();
|
||||
$list = HeroPreset::getByGunUid($row['idx']);
|
||||
if ($list){
|
||||
foreach ($list as $value){
|
||||
$heroDb = Hero::find($value['hero_uid']);
|
||||
array_push($heroIds,$heroDb['hero_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$todayGetGold = $row['today_get_gold'];
|
||||
$lastGetGoldTime = $row['last_get_gold_time'];
|
||||
if (myself()->_getDaySeconds($lastGetGoldTime) < myself()->_getNowDaySeconds()) {
|
||||
$todayGetGold = 0;
|
||||
}
|
||||
$todayPveGetCeg = $row['today_pve_get_ceg'];
|
||||
$lastPveGetCegTime = $row['last_pve_get_ceg_time'];
|
||||
if (myself()->_getDaySeconds($lastPveGetCegTime) <
|
||||
myself()->_getNowDaySeconds()) {
|
||||
$todayPveGetCeg = 0;
|
||||
}
|
||||
$todayMissionGetCeg = $row['today_mission_get_ceg'];
|
||||
$lastMissionGetCegTime = $row['last_mission_get_ceg_time'];
|
||||
if (myself()->_getDaySeconds($lastMissionGetCegTime) < myself()->_getNowDaySeconds()) {
|
||||
$todayMissionGetCeg = 0;
|
||||
}
|
||||
$gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']);
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
@ -277,12 +272,6 @@ class Gun extends BaseModel {
|
||||
'raw_pve_ceg_uplimit' => 0,
|
||||
'rand_attr' => $attr,
|
||||
'try_count' => $row['try_count'],
|
||||
'current_pvp_get_ceg' => $todayGetGold / 100,
|
||||
'last_pvp_get_ceg_time' => $lastGetGoldTime,
|
||||
'current_pve_get_ceg' => $todayPveGetCeg / 100,
|
||||
'last_pve_get_ceg_time' => $lastPveGetCegTime,
|
||||
'current_mission_get_ceg' => $todayMissionGetCeg / 100,
|
||||
'last_mission_get_ceg_time' => $lastMissionGetCegTime,
|
||||
'lock_type' => $lockType,
|
||||
'unlock_time' => $unlockTime,
|
||||
'unlock_lefttime' => max(0,
|
||||
@ -290,19 +279,14 @@ class Gun extends BaseModel {
|
||||
'unlock_trade_time' => $row['unlock_trade_time'],
|
||||
'offer_reward_state' => 0,
|
||||
'tags' => isset($row['tags'])?$row['tags']:'',
|
||||
'hero_ids' => $heroIds,
|
||||
|
||||
|
||||
'lucky' => strval($gunLucky),
|
||||
'chip_strength_sum' => 0,
|
||||
'labour' => 0,
|
||||
);
|
||||
$dto['durability_max'] = strval(round(FormulaService::Weapon_NFT_Maximum_Durability($dto['quality'],$dto['lucky']),3));
|
||||
$dto['pvp_ceg_uplimit'] = strval( round(FormulaService::getWeaponPvpDailyCegUpLimit($dto),2) );
|
||||
$dto['pve_ceg_uplimit'] = strval( round(FormulaService::getWeaponPveDailyCegUpLimit($dto),2) );
|
||||
$dto['mission_ceg_uplimit'] = strval( round(FormulaService::getWeaponMissionDailyCegUpLimit($dto),2) );
|
||||
|
||||
$nft_address = '';
|
||||
$contract = ContractConfig::find(ContractConfig::ERC721);
|
||||
if ($row['token_id']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x2F2Ed1c403cB7156617449795dE1CB47A0302a25' : '0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66';
|
||||
$nft_address = $contract ? $contract['gun'] : "";
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
return $dto;
|
||||
|
@ -14,6 +14,7 @@ require_once('models/User.php');
|
||||
require_once('models/ChipPlugin.php');
|
||||
require_once('services/NftService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
require_once('services/ContractConfig.php');
|
||||
|
||||
|
||||
use mt;
|
||||
@ -21,6 +22,7 @@ use phpcommon;
|
||||
use phpcommon\SqlHelper;
|
||||
use services\NftService;
|
||||
use services\FormulaService;
|
||||
use services\ContractConfig;
|
||||
use models\ChipPlugin;
|
||||
|
||||
|
||||
@ -243,27 +245,12 @@ class Hero extends BaseModel {
|
||||
$todayGetGold = 0;
|
||||
}
|
||||
|
||||
{
|
||||
$todayPveGetCeg = $row['today_pve_get_ceg'];
|
||||
$lastPveGetCegTime = $row['last_pve_get_ceg_time'];
|
||||
if (myself()->_getDaySeconds($lastPveGetCegTime) <
|
||||
myself()->_getNowDaySeconds()) {
|
||||
$todayPveGetCeg = 0;
|
||||
}
|
||||
$todayMissionGetCeg = $row['today_mission_get_ceg'];
|
||||
$lastMissionGetCegTime = $row['last_mission_get_ceg_time'];
|
||||
if (myself()->_getDaySeconds($lastMissionGetCegTime) < myself()->_getNowDaySeconds()) {
|
||||
$todayMissionGetCeg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($row['quality']);
|
||||
$userDb = myself()->_getOrmUserInfo();
|
||||
$isSelect = 0;
|
||||
if ($row['idx'] == $userDb['hero_id']){
|
||||
$isSelect = 1;
|
||||
}
|
||||
$skinDb = HeroSkin::findBx($row['hero_id']);
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
@ -272,7 +259,7 @@ class Hero extends BaseModel {
|
||||
'hero_lv' => $row['hero_lv'],
|
||||
'hero_tili' => $row['hero_tili'],
|
||||
'state' => $row['state'],
|
||||
'skin_id' => $row['skin_id'],
|
||||
'skin_id' => $skinDb?$skinDb['skin_id']:0,
|
||||
'quality' => $row['quality'],
|
||||
'skill_lv1' => $row['skill_lv1'],
|
||||
'skill_lv2' => $row['skill_lv2'],
|
||||
@ -291,26 +278,14 @@ class Hero extends BaseModel {
|
||||
'tags' => isset($row['tags'])?$row['tags']:'',
|
||||
'is_select' => $isSelect,
|
||||
|
||||
//暂留(以下弃用字段)
|
||||
'current_pvp_get_ceg' => $todayGetGold / 100,
|
||||
'last_pvp_get_ceg_time' => $lastGetGoldTime,
|
||||
'current_pve_get_ceg' => $todayPveGetCeg / 100,
|
||||
'last_pve_get_ceg_time' => $lastPveGetCegTime,
|
||||
'current_mission_get_ceg' => $todayMissionGetCeg / 100,
|
||||
'last_mission_get_ceg_time' => $lastMissionGetCegTime,
|
||||
'lucky' => $heroLucky,
|
||||
'chip_strength_sum' => 0,
|
||||
'labour' => 0,
|
||||
|
||||
|
||||
);
|
||||
$dto['hero_tili_max'] = strval(round(FormulaService::Hero_NFT_Maximum_Physical_Strength($dto['quality'],$dto['lucky']),3));
|
||||
$dto['pvp_ceg_uplimit'] =strval( round(FormulaService::getHeroPvpDailyCegUpLimit($dto),2) );
|
||||
$dto['pve_ceg_uplimit'] = strval( round(FormulaService::getHeroPveDailyCegUpLimit($dto),2) );
|
||||
$dto['mission_ceg_uplimit'] = strval( round(FormulaService::getHeroMissionDailyCegUpLimit($dto),2) );
|
||||
|
||||
$nft_address = '';
|
||||
$contract = ContractConfig::find(ContractConfig::ERC721);
|
||||
if ($row['token_id']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x3EBF5196dADC8F3F09C808333f98FE8A4b7d1e62' : '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0';
|
||||
$nft_address = $contract ? $contract['hero'] : "";
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
return $dto;
|
||||
|
@ -7,6 +7,20 @@ use phpcommon;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class HeroPreset extends BaseModel {
|
||||
public static function getByGunUid($weapon_uid){
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_hero_preset',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'weapon_uid1' => $weapon_uid,
|
||||
)
|
||||
);
|
||||
if (!$rows){
|
||||
return null;
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function getHeroPreset($heroUid){
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
|
@ -6,5 +6,32 @@ use mt\Item;
|
||||
|
||||
class ContractConfig extends BaseService {
|
||||
|
||||
const ERC721 = "erc721";
|
||||
public static function find($type){
|
||||
return self::_setConfig($type)?:null;
|
||||
}
|
||||
|
||||
private static function _setConfig($type){
|
||||
if (!$type){
|
||||
return;
|
||||
}
|
||||
if (SERVER_ENV == _ONLINE){
|
||||
switch ($type){
|
||||
case "erc721" : {
|
||||
return array(
|
||||
"hero" => "0xE6A69474E04B93De50dd07F239d62879dB9bF716",
|
||||
"gun" => "0x8Ce844402bE22fA1276a375Ff2354DD27aDEF285",
|
||||
"chip" => "0x4678fE0177B15538F441264cB851364d9F3872AA",
|
||||
);
|
||||
}
|
||||
case "erc20" : {
|
||||
return array(
|
||||
"CEC" => "0x8dd1439E0C3254b4543d6D68b3C0C891E5Bd2eCE",
|
||||
"CEG" => "0x2C7221588D4FBac2585D71618CD540e74c7413B8",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user