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;
}
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;
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;
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;
$errMsg = '';
@ -466,8 +466,17 @@ class BagController extends BaseAuthedController {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
Hero::addTili($heroUniId, $itemMeta['param1']);
Bag::decItemByUnIid($heroUniId, $itemNum);
if (!$heroDb['token_id']){
$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->addHeroChg();
$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;
$errMsg = '';
$targetUniId = $param1;
$gunDb = Gun::findByUniId($targetUniId);
if (!$gunDb) {
$this->_rspErr(1, "You don't have the equip yet");
$heroUniId = $param1;
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
Gun::addDurability($gunDb['gun_uniid'], $itemMeta['param1']);
Bag::decItemByUnIid($itemDb['item_uniid'], $itemNum);
if (!$heroDb['token_id']){
$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->addGunChg();
$this->propertyChgService->addHeroChg();
$this->_rspData(array(
'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()
);
}
$account = "6666_2006_testAccount".$i.rand(11111111,99999999);
$account = "6666_2006_testAccount".$i.rand(111111111,999999999);
$data['pvp_team_rank'] = rand(1,10);
$data['kills'] = rand(0,10);
$data['damage_out'] = rand(100,1000);
$data['damage_in'] = rand(100,1000);
$data['recover_hp'] = rand(0,200);
$data['alive_time'] = rand(100000,400000);
$data['pvp_assist'] = rand(5,20);
$data['kills'] = rand(5,15);
$data['damage_out'] = rand(5000,30000);
$data['damage_in'] = rand(5000,30000);
$data['recover_hp'] = rand(1000,6000);
$data['alive_time'] = rand(240000,600000);
$data['pvp_assist'] = rand(0,8);
$this->apply($hisBattleData['data'],$data);
if (!isset($hisBattleData['moba_data'])) {
@ -348,12 +348,12 @@ class ToolsController extends BaseController {
);
}
$data['pvp_team_rank'] = rand(1,2);
$data['kills'] = rand(0,15);
$data['damage_out'] = rand(5000,50000);
$data['damage_in'] = rand(100,1000);
$data['recover_hp'] = rand(0,200);
$data['kills'] = rand(1,5);
$data['damage_out'] = rand(2500,20000);
$data['damage_in'] = rand(2500,20000);
$data['recover_hp'] = rand(1250,10000);
$data['alive_time'] = rand(100000,400000);
$data['pvp_assist'] = rand(0,10);
$data['pvp_assist'] = rand(0,8);
$data['hero_lv'] = rand(1,10);
$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,
array(
'hero_tili' => function () use($tili) {
return "hero_tili + ${tili}";
},
));
array(
"unseal_time" => myself()->_getNowTime()
)
);
}
public static function gainGoldPvp($heroDto, $addGold)

View File

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