1
This commit is contained in:
parent
e888ef4268
commit
3cff27758a
153
doc/Bag.py
153
doc/Bag.py
@ -1,70 +1,83 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import _common
|
import _common
|
||||||
|
|
||||||
class Bag(object):
|
class Bag(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.apis = [
|
self.apis = [
|
||||||
{
|
{
|
||||||
'name': 'itemList',
|
'name': 'itemList',
|
||||||
'desc': '获取背包物品列表',
|
'desc': '获取背包物品列表',
|
||||||
'group': 'Bag',
|
'group': 'Bag',
|
||||||
'url': 'webapp/index.php?c=Bag&a=itemList',
|
'url': 'webapp/index.php?c=Bag&a=itemList',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!item_list', [_common.Item()], '物品列表']
|
['!item_list', [_common.Item()], '物品列表']
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'useItem',
|
'name': 'useItem',
|
||||||
'desc': '使用道具',
|
'desc': '使用道具',
|
||||||
'group': 'Bag',
|
'group': 'Bag',
|
||||||
'url': 'webapp/index.php?c=Bag&a=useItem',
|
'url': 'webapp/index.php?c=Bag&a=useItem',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['item_uniid', 0, '道具唯一id'],
|
['item_uniid', 0, '道具唯一id'],
|
||||||
['item_num', 0, '道具数量'],
|
['item_num', 0, '道具数量'],
|
||||||
['param1', '', '参数1(当使用的是改名卡时param1=新的角色名)'],
|
['param1', '', '参数1(当使用的是改名卡时param1=新的角色名)'],
|
||||||
['param2', '', '参数2(当使用的是改名卡时param2=签名)'],
|
['param2', '', '参数2(当使用的是改名卡时param2=签名)'],
|
||||||
['param3', '', '参数3'],
|
['param3', '', '参数3'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['award', _common.Award(), '奖励信息'],
|
['award', _common.Award(), '奖励信息'],
|
||||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'rename',
|
'name': 'rename',
|
||||||
'desc': '改名(优先扣改名卡没有则扣钻石)',
|
'desc': '改名(优先扣改名卡没有则扣钻石)',
|
||||||
'group': 'Bag',
|
'group': 'Bag',
|
||||||
'url': 'webapp/index.php?c=Bag&a=rename',
|
'url': 'webapp/index.php?c=Bag&a=rename',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['name', '', '新的角色名'],
|
['name', '', '新的角色名'],
|
||||||
['name_sign', '', '名字签名)'],
|
['name_sign', '', '名字签名)'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'buyItem',
|
'name': 'buyItem',
|
||||||
'desc': '购买道具(目前只一次购买改名卡)',
|
'desc': '购买道具(目前只一次购买改名卡)',
|
||||||
'group': 'Bag',
|
'group': 'Bag',
|
||||||
'url': 'webapp/index.php?c=Bag&a=buyItem',
|
'url': 'webapp/index.php?c=Bag&a=buyItem',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['item_id', '', '道具id'],
|
['item_id', '', '道具id'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_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