This commit is contained in:
hujiabin 2024-01-22 14:17:15 +08:00
parent a2fd250a92
commit cf107daa9e
3 changed files with 84 additions and 20 deletions

40
doc/Activity.py Normal file
View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
import _common
class Activity(object):
def __init__(self):
self.apis = [
{
'name': 'serverTask',
'desc': '服务器大事件任务',
'group': 'Activity',
'url': 'webapp/index.php?c=Activity&a=serverTask',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
['obtain_start_time', 0, '完成进度阶段开始时间'],
['obtain_end_time', 0, '完成进度阶段结束时间'],
['income_start_time', 0, '宝箱掉落阶段开始时间'],
['income_end_time', 0, '宝箱掉落阶段结束时间'],
['status', 0, '0:任务进行时 1:4v4完成任务 2:pvp完成任务 '],
['!taskDtoList1', [serverTask()], '4v4任务列表'],
['!taskDtoList2', [serverTask()], 'pvp任务列表'],
]
}
]
class serverTask(object):
def __init__(self):
self.fields = [
['task_id', 0, '任务id'],
['current', 0, '当前进度'],
['target', 0, '目标进度'],
['state', 0, '1:完成 0:未完成'],
]

View File

@ -132,8 +132,8 @@ class BagController extends BaseAuthedController {
}
} else if ($itemMeta['type'] == mt\Item::GIFT_PACKAGE_TYPE) {
$this->openGiftPackage($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
} else if ($itemMeta['type'] == mt\Item::FRAGMENT_BOX_TYPE) {
$this->openFragmentBox($itemDb, $itemMeta, $itemNum);
} else if ($itemMeta['type'] == mt\Item::TREASURE_BOX) {
$this->openBox($itemDb, $itemMeta, $itemNum);
} else {
$this->_rspErr(4, 'The prop function has not been realized yet');
}
@ -329,6 +329,44 @@ class BagController extends BaseAuthedController {
));
}
private function openBox($itemDb,$itemMeta,$itemNum){
$dropMeta = mt\Drop::get($itemMeta['drop']);
if (!$dropMeta) {
$this->_rspErr(1, 'config error');
return;
}
$costItems = array(
array(
"item_id" => V_ITEM_GOLD,
"item_num" => $itemMeta['gold'] * $itemNum
)
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
if ($itemDb['item_num'] < $itemNum){
$this->_rspErr(3, "item inadequate in number");
return;
}
$this->_decItems($costItems);
$this->_decItems(array(
array(
'item_id' => $itemMeta['id'],
'item_num' => $itemNum
)
));
for ($i=1;$i<=$itemNum;$i++){
$this->_scatterDrop('serverBox:' . $itemMeta['id'], $dropMeta, $this->awardService, $this->propertyChgService);
}
$this->propertyChgService->addBagChg();
$this->_rspData(array(
'award' => $this->awardService->toDto(),
'property_chg' => $this->propertyChgService->toDto(),
));
}
public function buyItem()
{
$itemId = getReqVal('item_id', 0);
@ -408,24 +446,7 @@ class BagController extends BaseAuthedController {
));
}
private function openFragmentBox($itemDb, $itemMeta, $itemNum){
$this->_rspOk();
// if ($itemDb['item_num']<$itemNum){
// $this->_rspErr(1, "The shard chest is insufficient");
// return;
// }
// for ($i=1;$i<=$itemNum;$i++){
// if (! Nft::addNftByFragmentBox($itemMeta,$i)){
// $this->_rspErr(1, "server internal error");
// return;
// }
// Bag::decItemByUnIid($itemDb['item_uniid'], 1);
// }
// $this->propertyChgService->addBagChg();
// $this->_rspData(array(
// 'property_chg' => $this->propertyChgService->toDto(),
// ));
}
public function syntheticGold(){
$itemId = getReqVal('item_id', 0);

View File

@ -30,6 +30,8 @@ class Item {
23 随机宝箱
24 Gacha
26 晶体
29 外饰装扮
30 活动宝箱
*/
/*
@ -105,6 +107,7 @@ class Item {
const CHEST_BOX_TYPE = 23;
const PLANET_TYPE = 28;
const AVATAR_TYPE = 29;
const TREASURE_BOX = 30;
const FUNC_RENAME_CARD_SUBTYPE = 1;
const FUNC_GUILD_CARD_SUBTYPE = 3;