This commit is contained in:
hujiabin 2024-03-26 20:31:44 +08:00
parent a7b1b3ee68
commit 58c7ce8a60
5 changed files with 76 additions and 35 deletions

View File

@ -114,14 +114,14 @@ class BagController extends BaseAuthedController {
return; return;
} }
break; break;
case mt\Item::DRUG_TILI_SUBTYPE: case mt\Item::RECOVER_DRUG_SUBTYPE:
{ {
$this->useTiliDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3); $this->useRecoverDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
} }
break; break;
case mt\Item::DRUG_DURABILITY_SUBTYPE: case mt\Item::PACKAGING_SUBTYPE:
{ {
$this->useDurabilityDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3); $this->useSealDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
} }
break; break;
default: default:
@ -456,7 +456,7 @@ class BagController extends BaseAuthedController {
)); ));
} }
private function useTiliDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3) private function useRecoverDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3)
{ {
$errCode = 0; $errCode = 0;
$errMsg = ''; $errMsg = '';
@ -466,8 +466,17 @@ class BagController extends BaseAuthedController {
$this->_rspErr(1, "You don't have the hero yet"); $this->_rspErr(1, "You don't have the hero yet");
return; return;
} }
Hero::addTili($heroUniId, $itemMeta['param1']); if (!$heroDb['token_id']){
Bag::decItemByUnIid($heroUniId, $itemNum); $this->_rspErr(1, "this hero is not NFT");
return;
}
$this->_decItems(array(
array(
'item_id' => $itemMeta['id'],
'item_num' => 1
)
));
Hero::recoverUsedTime($heroUniId);
$this->propertyChgService->addBagChg(); $this->propertyChgService->addBagChg();
$this->propertyChgService->addHeroChg(); $this->propertyChgService->addHeroChg();
$this->_rspData(array( $this->_rspData(array(
@ -475,20 +484,31 @@ class BagController extends BaseAuthedController {
)); ));
} }
private function useDurabilityDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3) private function useSealDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3)
{ {
$errCode = 0; $errCode = 0;
$errMsg = ''; $errMsg = '';
$targetUniId = $param1; $heroUniId = $param1;
$gunDb = Gun::findByUniId($targetUniId); $heroDb = Hero::find($heroUniId);
if (!$gunDb) { if (!$heroDb) {
$this->_rspErr(1, "You don't have the equip yet"); $this->_rspErr(1, "You don't have the hero yet");
return; return;
} }
Gun::addDurability($gunDb['gun_uniid'], $itemMeta['param1']); if (!$heroDb['token_id']){
Bag::decItemByUnIid($itemDb['item_uniid'], $itemNum); $this->_rspErr(1, "this hero is not NFT");
return;
}
$this->_decItems(array(
array(
'item_id' => $itemMeta['id'],
'item_num' => 1
)
));
Hero::update($heroUniId,array(
'seal_type' => 1
));
$this->propertyChgService->addBagChg(); $this->propertyChgService->addBagChg();
$this->propertyChgService->addGunChg(); $this->propertyChgService->addHeroChg();
$this->_rspData(array( $this->_rspData(array(
'property_chg' => $this->propertyChgService->toDto(), 'property_chg' => $this->propertyChgService->toDto(),
)); ));

View File

@ -204,6 +204,28 @@ class HeroController extends BaseAuthedController {
)); ));
} }
public function unSealHero(){
$heroUniId = getReqVal('hero_uniid', 0);
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(100, 'param error or null');
return;
}
if (!$heroDb['token_id']){
$this->_rspErr(1, "this hero is not NFT");
return;
}
Hero::update($heroUniId,array(
'seal_type' => 0,
"unseal_time" => myself()->_getNowTime()
));
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));
}
/* /*
英雄预设 英雄预设
*/ */

View File

@ -331,14 +331,14 @@ class ToolsController extends BaseController {
'modifytime' => myself()->_getNowTime() 'modifytime' => myself()->_getNowTime()
); );
} }
$account = "6666_2006_testAccount".$i.rand(11111111,99999999); $account = "6666_2006_testAccount".$i.rand(111111111,999999999);
$data['pvp_team_rank'] = rand(1,10); $data['pvp_team_rank'] = rand(1,10);
$data['kills'] = rand(0,10); $data['kills'] = rand(5,15);
$data['damage_out'] = rand(100,1000); $data['damage_out'] = rand(5000,30000);
$data['damage_in'] = rand(100,1000); $data['damage_in'] = rand(5000,30000);
$data['recover_hp'] = rand(0,200); $data['recover_hp'] = rand(1000,6000);
$data['alive_time'] = rand(100000,400000); $data['alive_time'] = rand(240000,600000);
$data['pvp_assist'] = rand(5,20); $data['pvp_assist'] = rand(0,8);
$this->apply($hisBattleData['data'],$data); $this->apply($hisBattleData['data'],$data);
if (!isset($hisBattleData['moba_data'])) { if (!isset($hisBattleData['moba_data'])) {
@ -348,12 +348,12 @@ class ToolsController extends BaseController {
); );
} }
$data['pvp_team_rank'] = rand(1,2); $data['pvp_team_rank'] = rand(1,2);
$data['kills'] = rand(0,15); $data['kills'] = rand(1,5);
$data['damage_out'] = rand(5000,50000); $data['damage_out'] = rand(2500,20000);
$data['damage_in'] = rand(100,1000); $data['damage_in'] = rand(2500,20000);
$data['recover_hp'] = rand(0,200); $data['recover_hp'] = rand(1250,10000);
$data['alive_time'] = rand(100000,400000); $data['alive_time'] = rand(100000,400000);
$data['pvp_assist'] = rand(0,10); $data['pvp_assist'] = rand(0,8);
$data['hero_lv'] = rand(1,10); $data['hero_lv'] = rand(1,10);
$this->apply($hisBattleData['moba_data'],$data); $this->apply($hisBattleData['moba_data'],$data);

View File

@ -638,14 +638,13 @@ class Hero extends BaseModel {
} }
} }
public static function addTili($heroUniId, $tili) public static function recoverUsedTime($heroUniId)
{ {
self::update($heroUniId, self::update($heroUniId,
array( array(
'hero_tili' => function () use($tili) { "unseal_time" => myself()->_getNowTime()
return "hero_tili + ${tili}"; )
}, );
));
} }
public static function gainGoldPvp($heroDto, $addGold) public static function gainGoldPvp($heroDto, $addGold)

View File

@ -112,8 +112,8 @@ class Item {
const FUNC_RENAME_CARD_SUBTYPE = 1; const FUNC_RENAME_CARD_SUBTYPE = 1;
const FUNC_GUILD_CARD_SUBTYPE = 3; const FUNC_GUILD_CARD_SUBTYPE = 3;
const DRUG_TILI_SUBTYPE = 4; const RECOVER_DRUG_SUBTYPE = 4;
const DRUG_DURABILITY_SUBTYPE = 5; const PACKAGING_SUBTYPE = 5;
const ROLE_CHIP_SUBTYPE = 1; const ROLE_CHIP_SUBTYPE = 1;
const GUN_CHIP_SUBTYPE = 2; const GUN_CHIP_SUBTYPE = 2;