1
This commit is contained in:
parent
0be6669690
commit
a7b1b3ee68
@ -286,6 +286,7 @@ class Hero(object):
|
||||
['wealth', 0, '财富值'],
|
||||
['seal_type', 0, '0:未封存 1:已封存'],
|
||||
['unseal_time', 0, '解封时间'],
|
||||
['valid_time', 0, '有效时间],
|
||||
]
|
||||
|
||||
class LevelingHero(object):
|
||||
|
@ -14,6 +14,7 @@ require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
require_once('services/LogService.php');
|
||||
require_once('services/NameService.php');
|
||||
require_once('services/LootService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\Bag;
|
||||
@ -133,7 +134,9 @@ 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::TREASURE_BOX) {
|
||||
$this->openBox($itemDb, $itemMeta, $itemNum);
|
||||
$this->openTreasureBox($itemDb, $itemMeta, $itemNum);
|
||||
} else if ($itemMeta['type'] == mt\Item::BATTLE_REWARD_BOX) {
|
||||
$this->openBattleBox($itemDb, $itemMeta, $itemNum);
|
||||
} else {
|
||||
$this->_rspErr(4, 'The prop function has not been realized yet');
|
||||
}
|
||||
@ -329,7 +332,7 @@ class BagController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
private function openBox($itemDb,$itemMeta,$itemNum){
|
||||
private function openTreasureBox($itemDb,$itemMeta,$itemNum){
|
||||
|
||||
$dropMeta = mt\Drop::get($itemMeta['drop']);
|
||||
if (!$dropMeta) {
|
||||
@ -365,6 +368,52 @@ class BagController extends BaseAuthedController {
|
||||
'property_chg' => $this->propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
// public function test(){
|
||||
// $itemMeta = mt\Item::get(400001);
|
||||
// $itemDb= 0;
|
||||
// $itemNum= 0;
|
||||
// $this->openBattleBox($itemDb,$itemMeta,$itemNum);
|
||||
//// print_r($itemMeta);
|
||||
// }
|
||||
|
||||
private function openBattleBox($itemDb,$itemMeta,$itemNum){
|
||||
$lucky = Hero::getAccountLucky(myself()->_getAddress());
|
||||
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
||||
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
||||
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
||||
$times = $this->proEffect($prob,1);
|
||||
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
||||
$this->_decItems(array(
|
||||
array(
|
||||
'item_id' => $itemMeta['id'],
|
||||
'item_num' => 1
|
||||
)
|
||||
));
|
||||
if ($times > 0){
|
||||
foreach ($items as &$item){
|
||||
$item['item_num'] += $item['item_num']*$times;
|
||||
}
|
||||
}
|
||||
$this->_addItems($items,$this->awardService,$this->propertyChgService);
|
||||
$this->propertyChgService->addBagChg();
|
||||
$this->_rspData(array(
|
||||
'award' => $this->awardService->toDto(),
|
||||
'property_chg' => $this->propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
private function proEffect($p,$b){
|
||||
if ($p * $b > -1 && $b != 0) {
|
||||
$x = floor($p) * $b;
|
||||
$y = max($x+$b,-1);
|
||||
$q = ($p * $b - $y) / ($x - $y);
|
||||
$rnd = rand(1,100);
|
||||
return $rnd < $q*100 ? $x : $y;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function buyItem()
|
||||
{
|
||||
|
@ -250,6 +250,12 @@ class Hero extends BaseModel {
|
||||
}
|
||||
$skinDb = HeroSkin::findBx($row['hero_id']);
|
||||
// $attribute = self::celHeroWealthUpLimit($row);
|
||||
{
|
||||
$heroMeta = \mt\Item::get($row['hero_id']);
|
||||
$heroAtteMeta = \mt\EconomyAttribute::findByGrade($heroMeta['relationship'],$row['quality']);
|
||||
$unsealTime = $row['unseal_time'] ? $row['unseal_time'] : $row['activate_time'];
|
||||
$validTime = $unsealTime + 86400 * $heroAtteMeta['validTime'] ;
|
||||
}
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
@ -281,6 +287,8 @@ class Hero extends BaseModel {
|
||||
'ability' => self::abilityInfo($row, $attr),
|
||||
'seal_type' => $row['seal_type'],
|
||||
'unseal_time' => $row['unseal_time'],
|
||||
'valid_time' => max(0,
|
||||
$validTime - myself()->_getNowTime())
|
||||
);
|
||||
|
||||
// $nft_address = '';
|
||||
|
@ -108,6 +108,7 @@ class Item {
|
||||
const PLANET_TYPE = 28;
|
||||
const AVATAR_TYPE = 29;
|
||||
const TREASURE_BOX = 30;
|
||||
const BATTLE_REWARD_BOX = 32;
|
||||
|
||||
const FUNC_RENAME_CARD_SUBTYPE = 1;
|
||||
const FUNC_GUILD_CARD_SUBTYPE = 3;
|
||||
@ -272,6 +273,7 @@ class Item {
|
||||
self::CHEST_BOX_TYPE,
|
||||
self::CRYSTAL_TYPE,
|
||||
self::TREASURE_BOX,
|
||||
self::BATTLE_REWARD_BOX,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -659,10 +659,10 @@ class TameBattleDataService extends BaseService {
|
||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||
$lastCompute = HashRate::getTotalByAccount($userDb['account_id'], $currentPeriod['id'] - 1);
|
||||
$currentCompute = HashRate::getTotalByAccount($userDb['account_id'], $currentPeriod['id']);
|
||||
$s = mt\Parameter::getVal('compute_inherit_rate',0);
|
||||
$s = mt\Parameter::getVal('economy_account_compute_s',0);
|
||||
$totalCompute = $currentCompute + $s * $lastCompute;
|
||||
$computeParam = mt\Parameter::getVal('compute_parameter',0);
|
||||
$computeMaxEffect = mt\Parameter::getVal('compute_maximum_effect',0);
|
||||
$computeParam = mt\Parameter::getVal('economy_account_compute_K',0);
|
||||
$computeMaxEffect = mt\Parameter::getVal('economy_account_compute_E',0);
|
||||
$gold = intval( $gold * ($totalCompute / ($totalCompute + $computeParam) * $computeMaxEffect + 1));
|
||||
if ($gold > 0){
|
||||
array_push($reward,array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user