1
This commit is contained in:
parent
384d677a6a
commit
42dc915959
@ -377,4 +377,20 @@ class BaseController {
|
|||||||
error_log('waring unsafe call---------------' . json_encode($_REQUEST));
|
error_log('waring unsafe call---------------' . json_encode($_REQUEST));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _mergeAlikeItemKey($items){
|
||||||
|
$hashItems = array();
|
||||||
|
foreach ($items as $item){
|
||||||
|
if (isset($hashItems[$item['item_id']])){
|
||||||
|
$hashItems[$item['item_id']]['item_num'] += $item['item_num'];
|
||||||
|
}else{
|
||||||
|
$hashItems[$item['item_id']] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$finalItems = array();
|
||||||
|
foreach ($hashItems as $hashItem){
|
||||||
|
array_push($finalItems,$hashItem);
|
||||||
|
}
|
||||||
|
return $finalItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,19 +26,20 @@ class LootService
|
|||||||
$items = array();
|
$items = array();
|
||||||
$depth = 0;
|
$depth = 0;
|
||||||
self::disposeLootIndex($dropIndex,$depth,$items);
|
self::disposeLootIndex($dropIndex,$depth,$items);
|
||||||
$hashItems = array();
|
// $hashItems = array();
|
||||||
foreach ($items as $item){
|
// foreach ($items as $item){
|
||||||
if (isset($hashItems[$item['item_id']])){
|
// if (isset($hashItems[$item['item_id']])){
|
||||||
$hashItems[$item['item_id']]['item_num'] += $item['item_num'];
|
// $hashItems[$item['item_id']]['item_num'] += $item['item_num'];
|
||||||
}else{
|
// }else{
|
||||||
$hashItems[$item['item_id']] = $item;
|
// $hashItems[$item['item_id']] = $item;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
$finalItems = array();
|
// $finalItems = array();
|
||||||
foreach ($hashItems as $hashItem){
|
// foreach ($hashItems as $hashItem){
|
||||||
array_push($finalItems,$hashItem);
|
// array_push($finalItems,$hashItem);
|
||||||
}
|
// }
|
||||||
return $finalItems;
|
// return $finalItems;
|
||||||
|
return myself()->_mergeAlikeItemKey($items);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function disposeLootIndex($dropIndex,&$depth,&$items){
|
private static function disposeLootIndex($dropIndex,&$depth,&$items){
|
||||||
|
@ -262,6 +262,7 @@ class RoomBattleDataService extends BaseService {
|
|||||||
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
|
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
|
||||||
//error_log(json_encode($member));
|
//error_log(json_encode($member));
|
||||||
if ($rate > 0 && !empty($member['box_num'])){
|
if ($rate > 0 && !empty($member['box_num'])){
|
||||||
|
$rewardBox = array();
|
||||||
for ($i = 0; $i < $member['box_num']; ++$i) {
|
for ($i = 0; $i < $member['box_num']; ++$i) {
|
||||||
$rand = $rate * 100;
|
$rand = $rate * 100;
|
||||||
$rnd = rand(1,100);
|
$rnd = rand(1,100);
|
||||||
@ -283,10 +284,17 @@ class RoomBattleDataService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($chestItems as $item){
|
foreach ($chestItems as $item){
|
||||||
array_push($reward,$item);
|
array_push($rewardBox,$item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (count($rewardBox) > 0){
|
||||||
|
$rewardBoxResult = myself()->_mergeAlikeItemKey($rewardBox);
|
||||||
|
foreach ($rewardBoxResult as $item){
|
||||||
|
array_push($reward,$item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
TGLog::writeToLog("game_2006_api","battleReport",array(
|
TGLog::writeToLog("game_2006_api","battleReport",array(
|
||||||
'account_id' => $userDb['account_id'],
|
'account_id' => $userDb['account_id'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user