1
This commit is contained in:
parent
8826dab683
commit
cdba43c119
@ -86,7 +86,7 @@ class BagController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
$itemDb = Bag::find($itemId);
|
||||
if (!isset($itemDb) || $itemDb['item_num'] <= 0) {
|
||||
if (!isset($itemDb) || $itemDb['item_num'] <= 0 || $itemDb['item_num']< $itemNum) {
|
||||
$this->_rspErr(1, 'Not enough item');
|
||||
return;
|
||||
}
|
||||
@ -608,6 +608,7 @@ class BagController extends BaseAuthedController {
|
||||
|
||||
|
||||
public function syntheticGold(){
|
||||
return
|
||||
$itemId = getReqVal('item_id', 0);
|
||||
$paramMeta = mt\Parameter::getVal('gold_synthesis_rank',0);
|
||||
if (!$paramMeta){
|
||||
@ -683,6 +684,7 @@ class BagController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
public function resolveGolds(){
|
||||
return
|
||||
$item_uniid= getReqVal('item_uniid', 0);
|
||||
$itemDb = Bag::findByUniId($item_uniid);
|
||||
if (!$itemDb || $itemDb['item_num'] <= 0) {
|
||||
|
@ -130,56 +130,4 @@ class ChipController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
public function upgradeQualityOld(){
|
||||
$chipUniId = trim(getReqVal('chip_uniid', 0));
|
||||
if (!$chipUniId) {
|
||||
$this->_rspErr(1, 'Please enter parameter');
|
||||
return;
|
||||
}
|
||||
$chipDb = Chip::find($chipUniId);
|
||||
if (!$chipDb){
|
||||
$this->_rspErr(1,'unique_id_main parameter error');
|
||||
return;
|
||||
}
|
||||
if ($chipDb['quality'] == \mt\QualityUpMapRule::MAX_QUALITY){
|
||||
$this->_rspErr(5, "It's already the highest level");
|
||||
return;
|
||||
}
|
||||
$heroQualityMeta = \mt\QualityUpMapRule::getByQuality($chipDb['item_id'],$chipDb['quality']+1);
|
||||
if (!$heroQualityMeta){
|
||||
$this->_rspErr(100, 'server internal error');
|
||||
return;
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $heroQualityMeta['gold']
|
||||
),
|
||||
array(
|
||||
'item_id' => $heroQualityMeta['item'],
|
||||
'item_num' => $heroQualityMeta['item_num']
|
||||
),
|
||||
);
|
||||
$lackItem = null;
|
||||
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||
return;
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
$chipMeta = \mt\Item::get($chipDb['item_id']);
|
||||
$chipAttrMeta = \mt\ChipAttribute::get($chipMeta['id']);
|
||||
$attribute = \mt\EconomyAttribute::getAttribute($chipAttrMeta['economyAttribute'],$chipDb['quality'] + 1);
|
||||
Chip::update2($chipUniId, array(
|
||||
'quality' => $chipDb['quality'] + 1,
|
||||
'wealth_attr' => json_encode($attribute),
|
||||
));
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addChip();
|
||||
$propertyChgService->addUserChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,42 +20,7 @@ use phpcommon\SqlHelper;
|
||||
|
||||
class FragmentController extends BaseAuthedController
|
||||
{
|
||||
public function syntheticFragment(){
|
||||
$itemId = getReqVal('item_id',0);
|
||||
$itemMeta = \mt\Item::get($itemId);
|
||||
if (!$itemMeta || $itemMeta['type'] != \mt\Item::FRAGMENT_TYPE){
|
||||
$this->_rspErr(1, "param item_id error");
|
||||
return;
|
||||
}
|
||||
$pieceNum = $itemMeta['param1'];
|
||||
$bagDb = Bag::find($itemId);
|
||||
if (!$bagDb || $bagDb['item_num'] < $pieceNum){
|
||||
$this->_rspErr(1, "Insufficient material");
|
||||
return;
|
||||
}
|
||||
$itemMetaDto = \mt\Item::get($itemMeta['relationship']);
|
||||
if ( !$itemMetaDto ){
|
||||
$this->_rspErr(1, "param error");
|
||||
return;
|
||||
}
|
||||
Bag::decItem($itemId,$pieceNum);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addBagChg();
|
||||
|
||||
if ($itemMeta['sub_type'] == \mt\Item::HERO_FRAGMENT_SUBTYPE){
|
||||
Hero::addSyntheticHero($itemMetaDto,$itemMeta['quality']);
|
||||
$propertyChgService->addHeroChg();
|
||||
}
|
||||
if ($itemMeta['sub_type'] == \mt\Item::CHIP_FRAGMENT_SUBTYPE){
|
||||
Chip::addSyntheticChip($itemMetaDto,$itemMeta['quality']);
|
||||
$propertyChgService->addChip();
|
||||
}
|
||||
|
||||
$this->_rspData(array(
|
||||
'item_id' => $itemMetaDto['id'],
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
//新合成
|
||||
public function synHero(){
|
||||
|
@ -79,89 +79,9 @@ class HeroController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
升阶预览
|
||||
*/
|
||||
public function upgradeQualityPreview(){
|
||||
return;
|
||||
$itemId = getReqVal('itemId', 0);
|
||||
$quality = getReqVal('quality', 0);
|
||||
|
||||
if ($quality == \mt\QualityUpMapRule::MAX_QUALITY){
|
||||
$this->_rspErr(5, "It's already the highest quality");
|
||||
return;
|
||||
}
|
||||
$heroQualityMeta = \mt\QualityUpMapRule::getByQuality($itemId,$quality+1);
|
||||
if (!$heroQualityMeta){
|
||||
$this->_rspErr(100, 'server internal error');
|
||||
return;
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $heroQualityMeta['gold']
|
||||
),
|
||||
array(
|
||||
'item_id' => $heroQualityMeta['item'],
|
||||
'item_num' => $heroQualityMeta['item_num']
|
||||
),
|
||||
);
|
||||
$this->_rspData(array(
|
||||
'cost' => $costItems
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
英雄升阶
|
||||
*/
|
||||
public function upgradeQualityOld(){
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(100, 'param error or null');
|
||||
return;
|
||||
}
|
||||
if ($heroDb['quality'] == \mt\QualityUpMapRule::MAX_QUALITY){
|
||||
$this->_rspErr(5, "It's already the highest level");
|
||||
return;
|
||||
}
|
||||
$heroQualityMeta = \mt\QualityUpMapRule::getByQuality($heroDb['hero_id'],$heroDb['quality']+1);
|
||||
if (!$heroQualityMeta){
|
||||
$this->_rspErr(100, 'server internal error');
|
||||
return;
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => $heroQualityMeta['gold']
|
||||
),
|
||||
array(
|
||||
'item_id' => $heroQualityMeta['item'],
|
||||
'item_num' => $heroQualityMeta['item_num']
|
||||
),
|
||||
);
|
||||
$lackItem = null;
|
||||
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||
return;
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
$heroMeta = \mt\Item::get($heroDb['hero_id']);
|
||||
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $heroDb['quality'] + 1);
|
||||
Hero::update($heroUniId, array(
|
||||
'quality' => $heroDb['quality'] + 1,
|
||||
'wealth_attr' => json_encode($attribute),
|
||||
));
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addHeroChg();
|
||||
$propertyChgService->addUserChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
public function upgradeQuality(){
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$itemId = getReqVal('item_id',0);
|
||||
|
@ -71,6 +71,12 @@ class HeroSkinController extends BaseAuthedController {
|
||||
'modifytime'=>myself()->_getNowTime(),
|
||||
));
|
||||
}
|
||||
if ($heroSkinDb['hero_uniid']){
|
||||
Hero::update($heroSkinDb['hero_uniid'],array(
|
||||
'skin_id' => 0,
|
||||
'modifytime'=>myself()->_getNowTime()
|
||||
));
|
||||
}
|
||||
Hero::update($heroUniid,array(
|
||||
'skin_id' => $skinUniid,
|
||||
'modifytime'=>myself()->_getNowTime()
|
||||
|
Loading…
x
Reference in New Issue
Block a user