From 68481fc610767e44c0e72a833dac8a735097df7c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 17:35:58 +0800 Subject: [PATCH 01/22] 1 --- webapp/models/FragmentPool.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index 7e4599cd..7afbb456 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -9,12 +9,14 @@ class FragmentPool extends BaseModel { public static function dropHero() { + $allocTime = myself()->_getNowDaySeconds() + + intval((myself()->_getNowTime() - myself()->_getNowDaySeconds()) / 3600) * 3600; $rows = SqlHelper::ormSelect (myself()->_getMysql($targetId), 't_fragment_pool', array( 'fragment_type' => 0, - 'alloc_time' => 0, + 'alloc_time' => $allocTime, ) ); if ($rows) { From 5aeb8b691bc73695c3405533a42bdb251a826b6a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 17:38:51 +0800 Subject: [PATCH 02/22] 1 --- webapp/models/FragmentPool.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index 7afbb456..edf62d89 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -9,20 +9,6 @@ class FragmentPool extends BaseModel { public static function dropHero() { - $allocTime = myself()->_getNowDaySeconds() + - intval((myself()->_getNowTime() - myself()->_getNowDaySeconds()) / 3600) * 3600; - $rows = SqlHelper::ormSelect - (myself()->_getMysql($targetId), - 't_fragment_pool', - array( - 'fragment_type' => 0, - 'alloc_time' => $allocTime, - ) - ); - if ($rows) { - - } - return null; } public static function dropGun() @@ -30,4 +16,19 @@ class FragmentPool extends BaseModel { } + private static function internalGet($type) + { + $allocTime = myself()->_getNowDaySeconds() + + intval((myself()->_getNowTime() - myself()->_getNowDaySeconds()) / 3600) * 3600; + $rows = SqlHelper::ormSelect + (myself()->_getMysql($targetId), + 't_fragment_pool', + array( + 'fragment_type' => $type, + 'alloc_time' => $allocTime, + ) + ); + return $rows ? $rows : array(); + } + } From ed3db8ad4fea2dab9f7f4c44e50cdc8b9ba5f7a8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 17:40:48 +0800 Subject: [PATCH 03/22] 1 --- webapp/models/FragmentPool.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index edf62d89..4dcb9464 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -9,11 +9,12 @@ class FragmentPool extends BaseModel { public static function dropHero() { + $items = self::internalGet(0); } public static function dropGun() { - + $items = self::internalGet(1); } private static function internalGet($type) From 9bbce806332448f939b3a5eb4d9156cbfe303a08 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 18:22:16 +0800 Subject: [PATCH 04/22] 1 --- webapp/models/FragmentPool.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index 4dcb9464..e499c24a 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -29,7 +29,15 @@ class FragmentPool extends BaseModel { 'alloc_time' => $allocTime, ) ); - return $rows ? $rows : array(); + $items = array(); + if ($rows) { + foreach ($rows as $row) { + if ($row['fragment_num'] > 0) { + array_push($items, $row); + } + } + } + return $items; } } From 74da8ff34de181a68aa092abe5546304c571834d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 18:55:00 +0800 Subject: [PATCH 05/22] 1 --- webapp/models/FragmentPool.php | 42 +++++++++++++++++++++++++-- webapp/services/BattleDataService.php | 1 + 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index e499c24a..68292c93 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -10,17 +10,30 @@ class FragmentPool extends BaseModel { public static function dropHero() { $items = self::internalGet(0); + if (count($items)) { + $idx = array_rand($items, 1); + $fragmentId = $items[$idx]['fragment_id']; + self::decNum($fragmentId); + return $fragmentId; + } + return 0; } public static function dropGun() { $items = self::internalGet(1); + if (count($items)) { + $idx = array_rand($items, 1); + $fragmentId = $items[$idx]['fragment_id']; + self::decNum($fragmentId); + return $fragmentId; + } + return 0; } private static function internalGet($type) { - $allocTime = myself()->_getNowDaySeconds() + - intval((myself()->_getNowTime() - myself()->_getNowDaySeconds()) / 3600) * 3600; + $allocTime = self::getAllocTime(); $rows = SqlHelper::ormSelect (myself()->_getMysql($targetId), 't_fragment_pool', @@ -40,4 +53,29 @@ class FragmentPool extends BaseModel { return $items; } + private static function decNum($itemId) + { + $allocTime = self::getAllocTime(); + SqlHelper::update + (myself()->_getMysql($targetId), + 't_fragment_pool', + array( + 'fragment_id' => $itemId, + 'alloc_time' => $allocTime, + ), + array( + 'fragment_num' => function () { + return 'GREATEST(0, fragment_num - 1)'; + }, + ) + ); + } + + private static function getAllocTime() + { + $allocTime = myself()->_getNowDaySeconds() + + intval((myself()->_getNowTime() - myself()->_getNowDaySeconds()) / 3600) * 3600; + return $allocTime; + } + } diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 7baa4843..fc2a73a3 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -34,6 +34,7 @@ use models\Bag; use models\Hero; use models\Gun; use models\RealtimeData; +use models\FragmentPool; use services\FormulaService; class BattleDataService extends BaseService { From 3a8b989fb4467134b5aeac074931ed45fb604bbf Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 18:57:51 +0800 Subject: [PATCH 06/22] 1 --- webapp/models/FragmentPool.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index 68292c93..be0368a4 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -31,6 +31,26 @@ class FragmentPool extends BaseModel { return 0; } + public static function getHeroNum() + { + $items = self::internalGet(0); + $num = 0; + foreach ($items as $item) { + $num += $item['fragment_num']; + } + return $num; + } + + public static function getGunNum() + { + $items = self::internalGet(1); + $num = 0; + foreach ($items as $item) { + $num += $item['fragment_num']; + } + return $num; + } + private static function internalGet($type) { $allocTime = self::getAllocTime(); From 37c759ac4ac58a29cc225c50c4a7c54ea98b26a8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:03:59 +0800 Subject: [PATCH 07/22] 1 --- webapp/services/BattleDataService.php | 44 ++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index fc2a73a3..8e359ea0 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -532,7 +532,27 @@ class BattleDataService extends BaseService { return; } - + 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); + } + } } private function rewardFragmentPve() @@ -569,6 +589,28 @@ class BattleDataService extends BaseService { return; } + if ($dropIdx == 0) { + $itemId = FragmentPool::dropHero(); + if ($itemId) { + array_push($this->reward['items'], + array( + 'item_id' => $itemId, + 'item_num' => 1 + )); + $this->_incDailyV(TN_DAILY_PVE_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_PVE_GET_FRAGMENT_NUM, 1); + } + } + } private function rewardCegPvp() From 4d7637e575d403197068bb86119ccb1ce67723a0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:11:33 +0800 Subject: [PATCH 08/22] 1 --- webapp/services/BattleDataService.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 8e359ea0..2a521e31 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -497,6 +497,8 @@ class BattleDataService extends BaseService { } $onlineNum = RealtimeData::getOnline(); + $heroFragmentNum = FragmentPool::getHeroNum(); + $gunFragmentNum = FragmentPool::getGunNum(); $rankedTopX= getXVal($params, 'ranked_topx'); $meta = mt\FormulaPvp::getByRanked($rankedTopX); @@ -504,7 +506,7 @@ class BattleDataService extends BaseService { return; } - $heroProbability = min($heroFragment[$now].total / $onlineNum * + $heroProbability = min($heroFragmentNum / $onlineNum * 5 * ( 0.5*$meta['ranked_topx'] + @@ -513,7 +515,7 @@ class BattleDataService extends BaseService { 0.05*$meta['weapon_topx'] ) * pow(2, ($todayPvpBattleTimes % 10) - 1), 1); - $gunProbability = min($gunFragment[$now].total / $onlineNum * + $gunProbability = min($gunFragmentNum / $onlineNum * 5 * ( 0.5*$meta['ranked_topx'] + @@ -568,6 +570,9 @@ class BattleDataService extends BaseService { } $onlineNum = RealtimeData::getOnline(); + $heroFragmentNum = FragmentPool::getHeroNum(); + $gunFragmentNum = FragmentPool::getGunNum(); + $instanceLevel = $this->pveGeminiMeta['gemini_lv']; $instanceRank = $this->instanceRank; $instanceRankRate = $this->getInstanceRankRate(); @@ -577,8 +582,12 @@ class BattleDataService extends BaseService { $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; - $heroProbability = min($heroFragment[$now].total / $onlineNum * $dropRate * ($instanceRankRate + $bossReward*0.2) * pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); - $gunProbability = min($gunFragment[$now].total / $onlineNum * $dropRate * ($instanceRankRate + $bossReward*0.2) * pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); + $heroProbability = min($heroFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); + $gunProbability = min($gunFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); $heroProbability = max($heroProbability, 0); $gunProbability = max($gunProbability, 0); From 43a916c235aa6da0e75eb60baa19120bdf6918c6 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:33:12 +0800 Subject: [PATCH 09/22] 1 --- webapp/services/BattleDataService.php | 38 ++++++-------------- webapp/services/FormulaService.php | 52 ++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 2a521e31..e2ed29c6 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -500,40 +500,22 @@ class BattleDataService extends BaseService { $heroFragmentNum = FragmentPool::getHeroNum(); $gunFragmentNum = FragmentPool::getGunNum(); - $rankedTopX= getXVal($params, 'ranked_topx'); - $meta = mt\FormulaPvp::getByRanked($rankedTopX); - if (!$meta) { - return; - } - - $heroProbability = min($heroFragmentNum / $onlineNum * - 5 * - ( - 0.5*$meta['ranked_topx'] + - 0.25*$meta['kills_topx'] + - 0.15*$meta['hero_topx'] + - 0.05*$meta['weapon_topx'] - ) * - pow(2, ($todayPvpBattleTimes % 10) - 1), 1); - $gunProbability = min($gunFragmentNum / $onlineNum * - 5 * - ( - 0.5*$meta['ranked_topx'] + - 0.25*$meta['kills_topx'] + - 0.15*$meta['hero_topx'] + - 0.05*$meta['weapon_topx'] - ) * - pow(2, ($todayPvpBattleTimes % 10) - 1), 1); + $heroProbability = FormulaService::calcHeroFragmentProbabilityPvp + ($_REQUEST, + $onlineNum, + $heroFragmentNum, + $todayPvpBattleTimes); + $gunProbability = FormulaService::calcGunFragmentProbabilityPvp + ($_REQUEST, + $onlineNum, + $gunFragmentNum, + $todayPvpBattleTimes); $heroProbability = max($heroProbability, 0); $gunProbability = max($gunProbability, 0); $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); - if ($dropIdx < 0 || $dropIdx == 2) { - return; - } - if ($dropIdx == 0) { $itemId = FragmentPool::dropHero(); if ($itemId) { diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index e02b889c..8fc161f5 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -20,7 +20,7 @@ class FormulaService extends BaseService { $kills = getXVal($params, 'kills'); $aliveTime = getXVal($params, 'alive_time'); - $rankedTopX= getXVal($params, 'ranked_topx'); + $rankedTopX = getXVal($params, 'ranked_topx'); $killsTopX = getXVal($params, 'kills_topx'); $heroTopX = getXVal($params, 'hero_topx'); $weaponTopX = getXVal($params, 'weapon_topx'); @@ -96,6 +96,56 @@ class FormulaService extends BaseService { return round(ceg); } + public static function calcHeroFragmentProbabilityPvp($params, + $onlineNum, + $heroFragmentNum, + $todayPvpBattleTimes) + { + $rankedTopX = getXVal($params, 'ranked_topx'); + $killsTopX = getXVal($params, 'kills_topx'); + $heroTopX = getXVal($params, 'hero_topx'); + $weaponTopX = getXVal($params, 'weapon_topx'); + $meta = mt\FormulaPvp::getByRanked($rankedTopX); + if (!$meta) { + return 0; + } + $heroProbability = min($heroFragmentNum / $onlineNum * + 5 * + ( + 0.5 * $rankedTopX * $meta['ranked_topx'] + + 0.25 * $killsTopX * $meta['kills_topx'] + + 0.15 * $heroTopX * $meta['hero_topx'] + + 0.05 * $weaponTopX * $meta['weapon_topx'] + ) * + pow(2, ($todayPvpBattleTimes % 10) - 1), 1); + return $heroProbability; + } + + public static function calcWeaponFragmentProbabilityPvp($params, + $onlineNum, + $weaponFragmentNum, + $todayPvpBattleTimes) + { + $rankedTopX = getXVal($params, 'ranked_topx'); + $killsTopX = getXVal($params, 'kills_topx'); + $heroTopX = getXVal($params, 'hero_topx'); + $weaponTopX = getXVal($params, 'weapon_topx'); + $meta = mt\FormulaPvp::getByRanked($rankedTopX); + if (!$meta) { + return 0; + } + $weaponProbability = min($FragmentNum / $onlineNum * + 5 * + ( + 0.5 * $rankedTopX * $meta['ranked_topx'] + + 0.25 * $killsTopX * $meta['kills_topx'] + + 0.15 * $heroTopX * $meta['hero_topx'] + + 0.05 * $weaponTopX * $meta['weapon_topx'] + ) * + pow(2, ($todayPvpBattleTimes % 10) - 1), 1); + return $weaponProbability; + } + public static function getHeroPvpTiliTotalValue($heroDb) { //ROUND((0.0241*角色NFT阶数^3-0.5675*角色NFT阶数^2+7.1798*角色NFT阶数+2.4114)+(0.0161*角色幸运值^3-1.2943*角色幸运值^2+36.5664*角色幸运值-336.144),0)+系统参数 From c19b4a1fb61e8a0e16c9351b2ac7e19684176ead Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:36:49 +0800 Subject: [PATCH 10/22] 1 --- webapp/services/BattleDataService.php | 88 ++++++++++++++------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index e2ed29c6..2ff45541 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -39,6 +39,8 @@ use services\FormulaService; class BattleDataService extends BaseService { + const MAX_DROP_NUM = 2; + private $seasonDb = array(); private $heroDto = null; private $heroMeta = null; @@ -488,54 +490,33 @@ class BattleDataService extends BaseService { private function rewardFragmentPvp() { - $todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); $todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); $todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); - if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum > 2) { - return; - } + if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { + $todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); - $onlineNum = RealtimeData::getOnline(); - $heroFragmentNum = FragmentPool::getHeroNum(); - $gunFragmentNum = FragmentPool::getGunNum(); + $onlineNum = RealtimeData::getOnline(); + $heroFragmentNum = FragmentPool::getHeroNum(); + $gunFragmentNum = FragmentPool::getGunNum(); - $heroProbability = FormulaService::calcHeroFragmentProbabilityPvp - ($_REQUEST, - $onlineNum, - $heroFragmentNum, - $todayPvpBattleTimes); - $gunProbability = FormulaService::calcGunFragmentProbabilityPvp - ($_REQUEST, - $onlineNum, - $gunFragmentNum, - $todayPvpBattleTimes); + $heroProbability = FormulaService::calcHeroFragmentProbabilityPvp + ($_REQUEST, + $onlineNum, + $heroFragmentNum, + $todayPvpBattleTimes); + $gunProbability = FormulaService::calcGunFragmentProbabilityPvp + ($_REQUEST, + $onlineNum, + $gunFragmentNum, + $todayPvpBattleTimes); - $heroProbability = max($heroProbability, 0); - $gunProbability = max($gunProbability, 0); - $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); + $heroProbability = max($heroProbability, 0); + $gunProbability = max($gunProbability, 0); + $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); - $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); - 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); - } + $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); + $this->procDrop($dropIdx); } } @@ -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); + } + } + } + } From 55846eabd3232c882f03982c972159ff3998b458 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:38:16 +0800 Subject: [PATCH 11/22] 1 --- webapp/services/BattleDataService.php | 83 +++++++++------------------ 1 file changed, 27 insertions(+), 56 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 2ff45541..690053f3 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -522,67 +522,38 @@ class BattleDataService extends BaseService { private function rewardFragmentPve() { - $pveRankScore = getReqVal('pve_rank_score', 0); - $todayPveBattleTimes = $this->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0); $todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); $todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); - if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum > 2) { - return; + if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { + $onlineNum = RealtimeData::getOnline(); + $heroFragmentNum = FragmentPool::getHeroNum(); + $gunFragmentNum = FragmentPool::getGunNum(); + + $instanceLevel = $this->pveGeminiMeta['gemini_lv']; + $instanceRank = $this->instanceRank; + $instanceRankRate = $this->getInstanceRankRate(); + $bossReward = getReqVal('pve_kill_boss', 0) ? 1 : 0; + $heroQuality = $this->heroDto['quality']; + + $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); + $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; + + $heroProbability = min($heroFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); + $gunProbability = min($gunFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); + + $heroProbability = max($heroProbability, 0); + $gunProbability = max($gunProbability, 0); + $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); + + $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); + $this->procDrop($dropIdx); } - - $onlineNum = RealtimeData::getOnline(); - $heroFragmentNum = FragmentPool::getHeroNum(); - $gunFragmentNum = FragmentPool::getGunNum(); - - $instanceLevel = $this->pveGeminiMeta['gemini_lv']; - $instanceRank = $this->instanceRank; - $instanceRankRate = $this->getInstanceRankRate(); - $bossReward = getReqVal('pve_kill_boss', 0) ? 1 : 0; - $heroQuality = $this->heroDto['quality']; - - $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); - $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; - - $heroProbability = min($heroFragmentNum / $onlineNum * - $dropRate * ($instanceRankRate + $bossReward*0.2) * - pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); - $gunProbability = min($gunFragmentNum / $onlineNum * - $dropRate * ($instanceRankRate + $bossReward*0.2) * - pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); - - $heroProbability = max($heroProbability, 0); - $gunProbability = max($gunProbability, 0); - $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); - - $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); - if ($dropIdx < 0 || $dropIdx == 2) { - return; - } - - if ($dropIdx == 0) { - $itemId = FragmentPool::dropHero(); - if ($itemId) { - array_push($this->reward['items'], - array( - 'item_id' => $itemId, - 'item_num' => 1 - )); - $this->_incDailyV(TN_DAILY_PVE_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_PVE_GET_FRAGMENT_NUM, 1); - } - } - } private function rewardCegPvp() From 0ded0384afa1da6de1e7e0e74d63b4eaa3dc8409 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:42:32 +0800 Subject: [PATCH 12/22] 1 --- webapp/services/BattleDataService.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 690053f3..5926e539 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -41,6 +41,10 @@ class BattleDataService extends BaseService { const MAX_DROP_NUM = 2; + const MATCH_MODE_PVP = 0; + const MATCH_MODE_MATCH = 1; + const MATCH_MODE_PVE = 2; + private $seasonDb = array(); private $heroDto = null; private $heroMeta = null; @@ -82,7 +86,8 @@ class BattleDataService extends BaseService { return false; } $this->reward['hero']['hero_uniid'] = $this->heroDto['hero_uniid']; - $this->reward['hero']['ceg_uplimit'] = $matchMode == 2 ? $this->heroDto['pve_ceg_uplimit'] : $this->heroDto['pvp_ceg_uplimit']; + $this->reward['hero']['ceg_uplimit'] = $matchMode == self::MATCH_MODE_PVE ? + $this->heroDto['pve_ceg_uplimit'] : $this->heroDto['pvp_ceg_uplimit']; } { $weaponUuid1 = getReqVal('weapon_uuid1', ''); @@ -93,7 +98,8 @@ class BattleDataService extends BaseService { } $this->weapon1Dto = Gun::toDto($weaponDb); $this->reward['weapon1']['gun_uniid'] = $this->weapon1Dto['gun_uniid']; - $this->reward['weapon1']['ceg_uplimit'] = $matchMode == 2 ? $this->weapon1Dto['pve_ceg_uplimit'] : $this->weapon1Dto['pvp_ceg_uplimit']; + $this->reward['weapon1']['ceg_uplimit'] = $matchMode == self::MATCH_MODE_PVE ? + $this->weapon1Dto['pve_ceg_uplimit'] : $this->weapon1Dto['pvp_ceg_uplimit']; } } { @@ -105,7 +111,8 @@ class BattleDataService extends BaseService { } $this->weapon2Dto = Gun::toDto($weaponDb); $this->reward['weapon2']['gun_uniid'] = $this->weapon2Dto['gun_uniid']; - $this->reward['weapon2']['ceg_uplimit'] = $matchMode == 2 ? $this->weapon2Dto['pve_ceg_uplimit'] : $this->weapon2Dto['pvp_ceg_uplimit']; + $this->reward['weapon2']['ceg_uplimit'] = $matchMode == self::MATCH_MODE_PVE ? + $this->weapon2Dto['pve_ceg_uplimit'] : $this->weapon2Dto['pvp_ceg_uplimit']; } } switch ($matchMode) { @@ -697,6 +704,7 @@ class BattleDataService extends BaseService { private function procDrop($dropIdx) { + $matchMode = getReqVal('match_mode'); if ($dropIdx == 0) { $itemId = FragmentPool::dropHero(); if ($itemId) { @@ -705,7 +713,11 @@ class BattleDataService extends BaseService { 'item_id' => $itemId, 'item_num' => 1 )); - $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + if ($matchMode == self::MATCH_MODE_PVE) { + $this->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 1); + } else { + $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + } } } else if ($dropIdx == 1) { $itemId = FragmentPool::dropGun(); @@ -715,7 +727,11 @@ class BattleDataService extends BaseService { 'item_id' => $itemId, 'item_num' => 1 )); - $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + if ($matchMode == self::MATCH_MODE_PVE) { + $this->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 1); + } else { + $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + } } } } From a3fe93b04c59d24253caa5559f8dba4cf6210c9a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:45:57 +0800 Subject: [PATCH 13/22] 1 --- webapp/services/BattleDataService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 5926e539..526b5714 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -116,7 +116,7 @@ class BattleDataService extends BaseService { } } switch ($matchMode) { - case 0: + case self::MATCH_MODE_PVP: { //匹配赛模式 $this->updatePvpData(); @@ -125,12 +125,12 @@ class BattleDataService extends BaseService { $this->_incDailyV(TN_DAILY_PVP_BATTLE_TIMES, 1); } break; - case 1: + case self::MATCH_MODE_MATCH: { //排位赛 } break; - case 2: + case self::MATCH_MODE_PVE: { //pve $this>updatePveData(); From 3d7a98c617d7c1347ac64701651bede821580922 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:51:46 +0800 Subject: [PATCH 14/22] 1 --- webapp/services/BattleDataService.php | 3 --- webapp/services/FormulaService.php | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 526b5714..76174ddc 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -517,9 +517,6 @@ class BattleDataService extends BaseService { $onlineNum, $gunFragmentNum, $todayPvpBattleTimes); - - $heroProbability = max($heroProbability, 0); - $gunProbability = max($gunProbability, 0); $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 8fc161f5..7d01a6cd 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -118,7 +118,7 @@ class FormulaService extends BaseService { 0.05 * $weaponTopX * $meta['weapon_topx'] ) * pow(2, ($todayPvpBattleTimes % 10) - 1), 1); - return $heroProbability; + return max(0, $heroProbability); } public static function calcWeaponFragmentProbabilityPvp($params, @@ -135,15 +135,15 @@ class FormulaService extends BaseService { return 0; } $weaponProbability = min($FragmentNum / $onlineNum * - 5 * - ( - 0.5 * $rankedTopX * $meta['ranked_topx'] + - 0.25 * $killsTopX * $meta['kills_topx'] + - 0.15 * $heroTopX * $meta['hero_topx'] + - 0.05 * $weaponTopX * $meta['weapon_topx'] - ) * - pow(2, ($todayPvpBattleTimes % 10) - 1), 1); - return $weaponProbability; + 5 * + ( + 0.5 * $rankedTopX * $meta['ranked_topx'] + + 0.25 * $killsTopX * $meta['kills_topx'] + + 0.15 * $heroTopX * $meta['hero_topx'] + + 0.05 * $weaponTopX * $meta['weapon_topx'] + ) * + pow(2, ($todayPvpBattleTimes % 10) - 1), 1); + return max(0, $weaponProbability); } public static function getHeroPvpTiliTotalValue($heroDb) From 7a94f56644c8f32ac9534e7925cb10404128ae78 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 19:56:30 +0800 Subject: [PATCH 15/22] 1 --- webapp/services/FormulaService.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 7d01a6cd..b54e070f 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -105,6 +105,7 @@ class FormulaService extends BaseService { $killsTopX = getXVal($params, 'kills_topx'); $heroTopX = getXVal($params, 'hero_topx'); $weaponTopX = getXVal($params, 'weapon_topx'); + $survivalTopX = getXVal($params, 'survival_topx'); $meta = mt\FormulaPvp::getByRanked($rankedTopX); if (!$meta) { return 0; @@ -115,7 +116,8 @@ class FormulaService extends BaseService { 0.5 * $rankedTopX * $meta['ranked_topx'] + 0.25 * $killsTopX * $meta['kills_topx'] + 0.15 * $heroTopX * $meta['hero_topx'] + - 0.05 * $weaponTopX * $meta['weapon_topx'] + 0.05 * $weaponTopX * $meta['weapon_topx'] + + 0.05 * $survivalTopX * $meta['survival_topx'] ) * pow(2, ($todayPvpBattleTimes % 10) - 1), 1); return max(0, $heroProbability); @@ -130,6 +132,7 @@ class FormulaService extends BaseService { $killsTopX = getXVal($params, 'kills_topx'); $heroTopX = getXVal($params, 'hero_topx'); $weaponTopX = getXVal($params, 'weapon_topx'); + $survivalTopX = getXVal($params, 'survival_topx'); $meta = mt\FormulaPvp::getByRanked($rankedTopX); if (!$meta) { return 0; @@ -140,7 +143,8 @@ class FormulaService extends BaseService { 0.5 * $rankedTopX * $meta['ranked_topx'] + 0.25 * $killsTopX * $meta['kills_topx'] + 0.15 * $heroTopX * $meta['hero_topx'] + - 0.05 * $weaponTopX * $meta['weapon_topx'] + 0.05 * $weaponTopX * $meta['weapon_topx'] + + 0.05 * $survivalTopX * $meta['survival_topx'] ) * pow(2, ($todayPvpBattleTimes % 10) - 1), 1); return max(0, $weaponProbability); From 7635c820e7815678f9d1da25d801f9165161bcab Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 20:08:11 +0800 Subject: [PATCH 16/22] 1 --- webapp/services/BattleDataService.php | 36 ++++++++++++++++--------- webapp/services/FormulaService.php | 38 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 76174ddc..b4efcfcf 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -541,18 +541,30 @@ class BattleDataService extends BaseService { $bossReward = getReqVal('pve_kill_boss', 0) ? 1 : 0; $heroQuality = $this->heroDto['quality']; - $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); - $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; - - $heroProbability = min($heroFragmentNum / $onlineNum * - $dropRate * ($instanceRankRate + $bossReward*0.2) * - pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); - $gunProbability = min($gunFragmentNum / $onlineNum * - $dropRate * ($instanceRankRate + $bossReward*0.2) * - pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum -1), 1); - - $heroProbability = max($heroProbability, 0); - $gunProbability = max($gunProbability, 0); + $heroProbability = FormulaService::calcHeroFragmentProbabilityPve + ( + $heroQuality, + $onlineNum, + $heroFragmentNum, + $todayPveBattleTimes, + $instanceLevel, + $instanceRank, + $instanceRankRate, + $bossReward, + $todayPveGetFragmentNum + ); + $gunProbability = FormulaService::calcWeaponFragmentProbabilityPve + ( + $heroQuality, + $onlineNum, + $gunFragmentNum, + $todayPveBattleTimes, + $instanceLevel, + $instanceRank, + $instanceRankRate, + $bossReward, + $todayPveGetFragmentNum + ); $emptyProbability = max(1 - $heroProbability - $gunProbability, 0); $dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability)); diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index b54e070f..bf67b5c7 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -150,6 +150,44 @@ class FormulaService extends BaseService { return max(0, $weaponProbability); } + public static function calcHeroFragmentProbabilityPve($heroQuality, + $onlineNum, + $heroFragmentNum, + $todayPvpBattleTimes, + $instanceLevel, + $instanceRank, + $instanceRankRate, + $bossReward, + $todayPveGetFragmentNum) + { + $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); + $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; + + $heroProbability = min($heroFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum - 1), 1); + return max(0, $heroProbability); + } + + public static function calcWeaponFragmentProbabilityPve($heroQuality, + $onlineNum, + $gunFragmentNum, + $todayPvpBattleTimes, + $instanceLevel, + $instanceRank, + $instanceRankRate, + $bossReward, + $todayPveGetFragmentNum) + { + $dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0); + $dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2; + + $gunProbability = min($gunFragmentNum / $onlineNum * + $dropRate * ($instanceRankRate + $bossReward*0.2) * + pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum - 1), 1); + return max(0, $gunProbability); + } + public static function getHeroPvpTiliTotalValue($heroDb) { //ROUND((0.0241*角色NFT阶数^3-0.5675*角色NFT阶数^2+7.1798*角色NFT阶数+2.4114)+(0.0161*角色幸运值^3-1.2943*角色幸运值^2+36.5664*角色幸运值-336.144),0)+系统参数 From 0a29ccac7b097b59f7c5631accdda2d2aa88dcce Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 20:46:25 +0800 Subject: [PATCH 17/22] 1 --- sql/gamedb.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index ce5dbfbf..e14de11b 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -615,7 +615,7 @@ CREATE TABLE `t_fragment_pool` ( `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), - KEY `alloc_time_fragment_type` (`alloc_time`, `fragment_type`), + KEY `alloc_time_fragment_type` (`alloc_time`, `fragment_type`) ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; From 28dec0c565e3e5caafe94e77d780d0ff764bd7ad Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 21:18:08 +0800 Subject: [PATCH 18/22] 1 --- webapp/models/FragmentPool.php | 4 ++-- webapp/models/RealtimeData.php | 2 +- webapp/services/BattleDataService.php | 30 +++++++++++++-------------- webapp/services/FormulaService.php | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index be0368a4..df6a18b1 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -55,7 +55,7 @@ class FragmentPool extends BaseModel { { $allocTime = self::getAllocTime(); $rows = SqlHelper::ormSelect - (myself()->_getMysql($targetId), + (myself()->_getSelfMysql(), 't_fragment_pool', array( 'fragment_type' => $type, @@ -77,7 +77,7 @@ class FragmentPool extends BaseModel { { $allocTime = self::getAllocTime(); SqlHelper::update - (myself()->_getMysql($targetId), + (myself()->_getSelfMysql(), 't_fragment_pool', array( 'fragment_id' => $itemId, diff --git a/webapp/models/RealtimeData.php b/webapp/models/RealtimeData.php index 6753fb1a..5c3e00cb 100644 --- a/webapp/models/RealtimeData.php +++ b/webapp/models/RealtimeData.php @@ -17,7 +17,7 @@ class RealtimeData extends BaseModel { private static function internalGet($name) { $row = SqlHelper::ormSelectOne - (myself()->_getMysql($targetId), + (myself()->_getSelfMysql(), 't_realtime_data', array( 'name' => $name diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index b4efcfcf..826fa1b0 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -71,7 +71,7 @@ class BattleDataService extends BaseService { public function updateBattleData() { error_log(json_encode($_REQUEST)); - $matchMode = getReqVal('match_mode'); + $matchMode = getReqVal('match_mode', 0); { $heroDb = Hero::find(getReqVal('hero_uniid', 0)); if (!$heroDb) { @@ -122,7 +122,7 @@ class BattleDataService extends BaseService { $this->updatePvpData(); $this->rewardCegPvp(); $this->rewardFragmentPvp(); - $this->_incDailyV(TN_DAILY_PVP_BATTLE_TIMES, 1); + myself()->_incDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0, 1); } break; case self::MATCH_MODE_MATCH: @@ -139,7 +139,7 @@ class BattleDataService extends BaseService { $this->rewardCegPve(); $this->rewardFragmentPve(); } - $this->_incDailyV(TN_DAILY_PVE_BATTLE_TIMES, 1); + myself()->_incDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0, 1); } break; default: @@ -497,11 +497,11 @@ class BattleDataService extends BaseService { private function rewardFragmentPvp() { - $todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); - $todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); + $todayPveGetFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); + $todayPvpGetFragmentNum = myself()->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { - $todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); + $todayPvpBattleTimes = myself()->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0); $onlineNum = RealtimeData::getOnline(); $heroFragmentNum = FragmentPool::getHeroNum(); @@ -512,7 +512,7 @@ class BattleDataService extends BaseService { $onlineNum, $heroFragmentNum, $todayPvpBattleTimes); - $gunProbability = FormulaService::calcGunFragmentProbabilityPvp + $gunProbability = FormulaService::calcWeaponFragmentProbabilityPvp ($_REQUEST, $onlineNum, $gunFragmentNum, @@ -526,9 +526,9 @@ class BattleDataService extends BaseService { private function rewardFragmentPve() { - $todayPveBattleTimes = $this->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0); - $todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); - $todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); + $todayPveBattleTimes = myself()->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0); + $todayPveGetFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0); + $todayPvpGetFragmentNum = myself()->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0); if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) { $onlineNum = RealtimeData::getOnline(); @@ -713,7 +713,7 @@ class BattleDataService extends BaseService { private function procDrop($dropIdx) { - $matchMode = getReqVal('match_mode'); + $matchMode = getReqVal('match_mode', 0); if ($dropIdx == 0) { $itemId = FragmentPool::dropHero(); if ($itemId) { @@ -723,9 +723,9 @@ class BattleDataService extends BaseService { 'item_num' => 1 )); if ($matchMode == self::MATCH_MODE_PVE) { - $this->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 1); + myself()->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0, 1); } else { - $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + myself()->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0, 1); } } } else if ($dropIdx == 1) { @@ -737,9 +737,9 @@ class BattleDataService extends BaseService { 'item_num' => 1 )); if ($matchMode == self::MATCH_MODE_PVE) { - $this->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 1); + myself()->_incDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0, 1); } else { - $this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1); + myself()->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0, 1); } } } diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index bf67b5c7..71e91332 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -137,7 +137,7 @@ class FormulaService extends BaseService { if (!$meta) { return 0; } - $weaponProbability = min($FragmentNum / $onlineNum * + $weaponProbability = min($weaponFragmentNum / $onlineNum * 5 * ( 0.5 * $rankedTopX * $meta['ranked_topx'] + From a914535cc70d6020ad8c119655ad8c57f55af6ef Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 21:26:56 +0800 Subject: [PATCH 19/22] 1 --- webapp/models/DynData.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/models/DynData.php b/webapp/models/DynData.php index 1aa4d4d5..82e1e9d2 100644 --- a/webapp/models/DynData.php +++ b/webapp/models/DynData.php @@ -159,7 +159,7 @@ class DynData extends BaseModel { private static function internalGetV($x, $y, $defVal = 0) { $key = self::calcKey($x, $y); - if (self::$dynData) { + if (!is_null(self::$dynData)) { if (isset(self::$dynData[$key])) { return self::$dynData[$key]; } else { @@ -172,7 +172,7 @@ class DynData extends BaseModel { ++self::$hitCount; if (self::$hitCount > 5 && is_null(self::$dynData)) { self::preload(); - return self::getV($x, $y, $defVal); + return self::internalGetV($x, $y, $defVal); } else { $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), From 8982855ac9cb28aca8ec2b87d29f4c6a016d0291 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 21:28:33 +0800 Subject: [PATCH 20/22] 1 --- webapp/controller/BattleController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index d32340dc..4da151dc 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -38,7 +38,7 @@ class BattleController extends BaseAuthedController { 'modifytime' => $this->_getNowTime(), ) ); - $this->_rspOk(); + $this->_rspData($battleDataService->getReward()); } public function battleReportNew() From b1b9cf2cc147b1e7b64e5a8ac281f95f673e0f94 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 21:35:46 +0800 Subject: [PATCH 21/22] 1 --- webapp/services/BattleDataService.php | 8 ++++---- webapp/services/FormulaService.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 826fa1b0..da25bd42 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -578,10 +578,10 @@ class BattleDataService extends BaseService { $ranked = getReqVal('ranked', 0); $kills = getReqVal('kills', 0); $aliveTime = getReqVal('alive_time', 0); - $cond = (1 - ($ranked > 30 ? 1 : 0)) * - ($kills > 1 ? 1 : 0) * - ($aliveTime > 30 ? 1 : 0); - if ($cond) { + $cond = (1 - ($ranked >= 30 ? 1 : 0)) * + ($kills >= 1 ? 1 : 0) * + ($aliveTime >= 30 ? 1 : 0); + if (!$cond) { return; } } diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 71e91332..f93648ab 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -37,9 +37,9 @@ class FormulaService extends BaseService { (0.5 * $weaponTopX * $meta['weapon_topx']) + (0.5 * $survivalTopX * $meta['survival_topx']) ) * - (1 - ($ranked > 30 ? 1 : 0)) * - ($kills > 1 ? 1 : 0) * - ($aliveTime > 30 ? 1 : 0); + (1 - ($ranked >= 30 ? 1 : 0)) * + ($kills >= 1 ? 1 : 0) * + ($aliveTime >= 30 ? 1 : 0); return round($ceg); } @@ -77,9 +77,9 @@ class FormulaService extends BaseService { (0.5 * $weaponTopX * $meta['weapon_topx']) + (0.5 * $survivalTopX * $meta['survival_topx']) ) * - (1 - ($ranked > 30 ? 1 : 0)) * - ($kills > 1 ? 1 : 0) * - ($aliveTime > 30 ? 1 : 0); + (1 - ($ranked >= 30 ? 1 : 0)) * + ($kills >= 1 ? 1 : 0) * + ($aliveTime >= 30 ? 1 : 0); return round($ceg); } From 602ca758a11af08b58fb29548962e12dea65d19b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 21:45:04 +0800 Subject: [PATCH 22/22] 1 --- webapp/models/Hero.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 2ab7de20..c2a70119 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -384,8 +384,8 @@ class Hero extends BaseModel { if ($finalyAddGold > 0) { self::update($heroDto['hero_uniid'], array( - 'current_pvp_get_ceg' => $newGold, - 'last_pvp_get_ceg_time' => myself()->_getNowTime() + 'today_get_gold' => $newGold, + 'last_get_gold_time' => myself()->_getNowTime() )); } return $finalyAddGold; @@ -399,7 +399,7 @@ class Hero extends BaseModel { if ($finalyAddGold > 0) { self::update($heroDto['hero_uniid'], array( - 'current_pve_get_ceg' => $newGold, + 'today_pve_get_ceg' => $newGold, 'last_pve_get_ceg_time' => myself()->_getNowTime() )); }