1
This commit is contained in:
parent
e888ef4268
commit
3cff27758a
13
doc/Bag.py
13
doc/Bag.py
@ -66,5 +66,18 @@ class Bag(object):
|
|||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
|
},{
|
||||||
|
'name': 'syntheticGold',
|
||||||
|
'desc': '金币合成',
|
||||||
|
'group': 'Bag',
|
||||||
|
'url': 'webapp/index.php?c=Bag&a=syntheticGold',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['item_id', '', '合成的道具id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -10,6 +10,8 @@ define('MATCH_CURRENT_TEAM_KEY', 'match:current_team:');
|
|||||||
define('MATCH_OK_KEY', 'match:ok:');
|
define('MATCH_OK_KEY', 'match:ok:');
|
||||||
|
|
||||||
define('V_ITEM_GOLD', 10001); //金币
|
define('V_ITEM_GOLD', 10001); //金币
|
||||||
|
define('V_ITEM_GOLDS', 10017); //金堆
|
||||||
|
define('V_ITEM_GOLDBRICK', 10018); //金砖
|
||||||
define('V_ITEM_DIAMOND', 10014); //钻石
|
define('V_ITEM_DIAMOND', 10014); //钻石
|
||||||
define('V_ITEM_EXP', 10003); //经验
|
define('V_ITEM_EXP', 10003); //经验
|
||||||
define('V_ITEM_ACTIVE', 10004); //活跃度
|
define('V_ITEM_ACTIVE', 10004); //活跃度
|
||||||
|
@ -427,4 +427,59 @@ class BagController extends BaseAuthedController {
|
|||||||
// ));
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function syntheticGold(){
|
||||||
|
$itemId = getReqVal('item_id', 0);
|
||||||
|
$paramMeta = mt\Parameter::getVal('gold_synthesis_rank',0);
|
||||||
|
if (!$paramMeta){
|
||||||
|
$this->_rspErr(1,"config error");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$consume = explode("|",$paramMeta);
|
||||||
|
switch ($itemId){
|
||||||
|
case V_ITEM_GOLDS :{
|
||||||
|
$costItems = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $consume[0]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$lackItem = null;
|
||||||
|
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||||
|
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->_decItems($costItems);
|
||||||
|
Bag::addItem(V_ITEM_GOLDS,1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_ITEM_GOLDBRICK :{
|
||||||
|
$costItems = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $consume[1]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$lackItem = null;
|
||||||
|
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||||
|
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->_decItems($costItems);
|
||||||
|
Bag::addItem(V_ITEM_GOLDBRICK,1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:{
|
||||||
|
$this->_rspErr(1,"param error");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$propertyChgService = new services\PropertyChgService();
|
||||||
|
$propertyChgService->addUserChg();
|
||||||
|
$propertyChgService->addBagChg();
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user