This commit is contained in:
aozhiwei 2022-09-22 11:17:51 +08:00
parent c12a61e362
commit cf1c9c46c3
2 changed files with 21 additions and 16 deletions

View File

@ -7,9 +7,9 @@ use phpcommon\SqlHelper;
class FragmentPool extends BaseModel { class FragmentPool extends BaseModel {
public static function dropHero() public static function dropHero($type)
{ {
$items = self::internalGet(0); $items = self::internalGet(0, $type);
if (count($items)) { if (count($items)) {
$idx = array_rand($items, 1); $idx = array_rand($items, 1);
$fragmentId = $items[$idx]['fragment_id']; $fragmentId = $items[$idx]['fragment_id'];
@ -19,9 +19,9 @@ class FragmentPool extends BaseModel {
return 0; return 0;
} }
public static function dropGun() public static function dropGun($type)
{ {
$items = self::internalGet(1); $items = self::internalGet(1, $type);
if (count($items)) { if (count($items)) {
$idx = array_rand($items, 1); $idx = array_rand($items, 1);
$fragmentId = $items[$idx]['fragment_id']; $fragmentId = $items[$idx]['fragment_id'];
@ -31,9 +31,9 @@ class FragmentPool extends BaseModel {
return 0; return 0;
} }
public static function getHeroNum() public static function getHeroNum($type)
{ {
$items = self::internalGet(0); $items = self::internalGet(0, $type);
$num = 0; $num = 0;
foreach ($items as $item) { foreach ($items as $item) {
$num += $item['fragment_num']; $num += $item['fragment_num'];
@ -41,9 +41,9 @@ class FragmentPool extends BaseModel {
return $num; return $num;
} }
public static function getGunNum() public static function getGunNum($type)
{ {
$items = self::internalGet(1); $items = self::internalGet(1, $type);
$num = 0; $num = 0;
foreach ($items as $item) { foreach ($items as $item) {
$num += $item['fragment_num']; $num += $item['fragment_num'];
@ -51,14 +51,15 @@ class FragmentPool extends BaseModel {
return $num; return $num;
} }
private static function internalGet($type) private static function internalGet($fragmentType, $type)
{ {
$allocTime = self::getAllocTime(); $allocTime = self::getAllocTime();
$rows = SqlHelper::ormSelect $rows = SqlHelper::ormSelect
(myself()->_getSelfMysql(), (myself()->_getSelfMysql(),
't_fragment_pool', 't_fragment_pool',
array( array(
'fragment_type' => $type, 'type' => $type,
'fragment_type' => $fragmentType,
'alloc_time' => $allocTime, 'alloc_time' => $allocTime,
) )
); );

View File

@ -524,8 +524,8 @@ class BattleDataService extends BaseService {
$todayPvpBattleTimes = myself()->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); $todayPvpBattleTimes = myself()->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0);
$onlineNum = RealtimeData::getOnline(); $onlineNum = RealtimeData::getOnline();
$heroFragmentNum = FragmentPool::getHeroNum(); $heroFragmentNum = FragmentPool::getHeroNum0();
$gunFragmentNum = FragmentPool::getGunNum(); $gunFragmentNum = FragmentPool::getGunNum(0);
$heroProbability = FormulaService::calcHeroFragmentProbabilityPvp $heroProbability = FormulaService::calcHeroFragmentProbabilityPvp
($_REQUEST, ($_REQUEST,
@ -553,8 +553,8 @@ class BattleDataService extends BaseService {
if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) {
$onlineNum = RealtimeData::getOnline(); $onlineNum = RealtimeData::getOnline();
$heroFragmentNum = FragmentPool::getHeroNum(); $heroFragmentNum = FragmentPool::getHeroNum(1);
$gunFragmentNum = FragmentPool::getGunNum(); $gunFragmentNum = FragmentPool::getGunNum(1);
$instanceLevel = $this->pveGeminiMeta['gemini_lv']; $instanceLevel = $this->pveGeminiMeta['gemini_lv'];
$instanceRank = $this->instanceRank; $instanceRank = $this->instanceRank;
@ -756,8 +756,12 @@ class BattleDataService extends BaseService {
$propertyChgService = new services\PropertyChgService(); $propertyChgService = new services\PropertyChgService();
$awardService = new services\AwardService(); $awardService = new services\AwardService();
$matchMode = getReqVal('match_mode', 0); $matchMode = getReqVal('match_mode', 0);
$type = 0;
if ($matchMode == self::MATCH_MODE_PVE) {
$type = 1;
}
if ($dropIdx == 0) { if ($dropIdx == 0) {
$itemId = FragmentPool::dropHero(); $itemId = FragmentPool::dropHero($type);
if ($itemId) { if ($itemId) {
array_push($this->reward['items'], array_push($this->reward['items'],
array( array(
@ -781,7 +785,7 @@ class BattleDataService extends BaseService {
} }
} }
} else if ($dropIdx == 1) { } else if ($dropIdx == 1) {
$itemId = FragmentPool::dropGun(); $itemId = FragmentPool::dropGun($type);
if ($itemId) { if ($itemId) {
array_push($this->reward['items'], array_push($this->reward['items'],
array( array(