1
This commit is contained in:
parent
43a916c235
commit
c19b4a1fb6
@ -39,6 +39,8 @@ use services\FormulaService;
|
|||||||
|
|
||||||
class BattleDataService extends BaseService {
|
class BattleDataService extends BaseService {
|
||||||
|
|
||||||
|
const MAX_DROP_NUM = 2;
|
||||||
|
|
||||||
private $seasonDb = array();
|
private $seasonDb = array();
|
||||||
private $heroDto = null;
|
private $heroDto = null;
|
||||||
private $heroMeta = null;
|
private $heroMeta = null;
|
||||||
@ -488,54 +490,33 @@ class BattleDataService extends BaseService {
|
|||||||
|
|
||||||
private function rewardFragmentPvp()
|
private function rewardFragmentPvp()
|
||||||
{
|
{
|
||||||
$todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0);
|
|
||||||
$todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0);
|
$todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0);
|
||||||
$todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0);
|
$todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0);
|
||||||
|
|
||||||
if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum > 2) {
|
if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) {
|
||||||
return;
|
$todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0);
|
||||||
}
|
|
||||||
|
|
||||||
$onlineNum = RealtimeData::getOnline();
|
$onlineNum = RealtimeData::getOnline();
|
||||||
$heroFragmentNum = FragmentPool::getHeroNum();
|
$heroFragmentNum = FragmentPool::getHeroNum();
|
||||||
$gunFragmentNum = FragmentPool::getGunNum();
|
$gunFragmentNum = FragmentPool::getGunNum();
|
||||||
|
|
||||||
$heroProbability = FormulaService::calcHeroFragmentProbabilityPvp
|
$heroProbability = FormulaService::calcHeroFragmentProbabilityPvp
|
||||||
($_REQUEST,
|
($_REQUEST,
|
||||||
$onlineNum,
|
$onlineNum,
|
||||||
$heroFragmentNum,
|
$heroFragmentNum,
|
||||||
$todayPvpBattleTimes);
|
$todayPvpBattleTimes);
|
||||||
$gunProbability = FormulaService::calcGunFragmentProbabilityPvp
|
$gunProbability = FormulaService::calcGunFragmentProbabilityPvp
|
||||||
($_REQUEST,
|
($_REQUEST,
|
||||||
$onlineNum,
|
$onlineNum,
|
||||||
$gunFragmentNum,
|
$gunFragmentNum,
|
||||||
$todayPvpBattleTimes);
|
$todayPvpBattleTimes);
|
||||||
|
|
||||||
$heroProbability = max($heroProbability, 0);
|
$heroProbability = max($heroProbability, 0);
|
||||||
$gunProbability = max($gunProbability, 0);
|
$gunProbability = max($gunProbability, 0);
|
||||||
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
||||||
|
|
||||||
$dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
$dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
||||||
if ($dropIdx == 0) {
|
$this->procDrop($dropIdx);
|
||||||
$itemId = FragmentPool::dropHero();
|
|
||||||
if ($itemId) {
|
|
||||||
array_push($this->reward['items'],
|
|
||||||
array(
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'item_num' => 1
|
|
||||||
));
|
|
||||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
|
||||||
}
|
|
||||||
} else if ($dropIdx == 1) {
|
|
||||||
$itemId = FragmentPool::dropGun();
|
|
||||||
if ($itemId) {
|
|
||||||
array_push($this->reward['items'],
|
|
||||||
array(
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'item_num' => 1
|
|
||||||
));
|
|
||||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,4 +724,29 @@ class BattleDataService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function procDrop($dropIdx)
|
||||||
|
{
|
||||||
|
if ($dropIdx == 0) {
|
||||||
|
$itemId = FragmentPool::dropHero();
|
||||||
|
if ($itemId) {
|
||||||
|
array_push($this->reward['items'],
|
||||||
|
array(
|
||||||
|
'item_id' => $itemId,
|
||||||
|
'item_num' => 1
|
||||||
|
));
|
||||||
|
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||||
|
}
|
||||||
|
} else if ($dropIdx == 1) {
|
||||||
|
$itemId = FragmentPool::dropGun();
|
||||||
|
if ($itemId) {
|
||||||
|
array_push($this->reward['items'],
|
||||||
|
array(
|
||||||
|
'item_id' => $itemId,
|
||||||
|
'item_num' => 1
|
||||||
|
));
|
||||||
|
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user