碎片合成
This commit is contained in:
parent
fa3915532e
commit
472e75fa35
13
doc/Hero.py
13
doc/Hero.py
@ -121,6 +121,19 @@ class Hero(object):
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
]
|
||||
},{
|
||||
'name': 'heroPieceSys',
|
||||
'desc': '英雄碎片合成',
|
||||
'group': 'Hero',
|
||||
'url': 'webapp/index.php?c=Hero&a=heroPieceSys',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['item_id', 0, '碎片itemID'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['hero_id', 0, '英雄itemId']
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
|
@ -9,8 +9,8 @@ const constant = require('../constant');
|
||||
class Star {
|
||||
async start() {
|
||||
console.log('Star And Pass Start');
|
||||
let url_star = getUrl('resetStar');
|
||||
let url_pass = getUrl('resetPassLevel');
|
||||
let url_star = getUrl('Star','resetStar');
|
||||
let url_pass = getUrl('Pass','resetPassLevel');
|
||||
while (true) {
|
||||
await http.get(url_star,null)
|
||||
await http.get(url_pass,null)
|
||||
@ -25,13 +25,13 @@ class Star {
|
||||
|
||||
}
|
||||
|
||||
function getUrl(action){
|
||||
function getUrl(controller,action){
|
||||
// let url = 'http://james.com/webapp/index.php?&c=Star&a=resetStar';
|
||||
let url = '';
|
||||
if (utils.isOnlineEnv()) {
|
||||
url = 'https://game2006api-test.cebggame.com/webapp/index.php?&c=Star&a=' + action;
|
||||
url = 'https://game2006api-test.cebggame.com/webapp/index.php?&c=' + controller + '&a=' + action;
|
||||
} else {
|
||||
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=Star&a=' + action;
|
||||
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=' + controller + '&a=' + action;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
@ -303,5 +303,31 @@ class HeroController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
public function heroPieceSys(){
|
||||
$itemId = getReqVal('item_id',0);
|
||||
$pieceNum = \mt\Parameter::getVal('hero_piece_synthesis_num',0);
|
||||
$itemMeta = \mt\Item::get($itemId);
|
||||
if (!$itemMeta || $itemMeta['type'] != \mt\Item::FRAGMENT_TYPE){
|
||||
$this->_rspErr(1, "param item_id error");
|
||||
return;
|
||||
}
|
||||
$bagDb = Bag::find($itemId);
|
||||
if (!$bagDb || $bagDb['item_num'] < $pieceNum){
|
||||
$this->_rspErr(1, "Insufficient material");
|
||||
return;
|
||||
}
|
||||
|
||||
$heroMeta = \mt\Item::get($itemMeta['relationship']);
|
||||
Bag::decItem($itemId,$pieceNum);
|
||||
Hero::addHero($heroMeta);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addHeroChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'hero_id' => $heroMeta['id'],
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user