This commit is contained in:
hujiabin 2024-08-18 16:20:58 +08:00
parent 77e63c0191
commit 3a75e04c7b

View File

@ -417,6 +417,8 @@ class BagController extends BaseAuthedController {
} }
$hashItems = array(); $hashItems = array();
foreach ($items as $item){ foreach ($items as $item){
$awardItemMeta = \mt\Item::get($item['item_id']);
$this->sendNotice($awardItemMeta , $item['item_num']);
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{
@ -452,16 +454,39 @@ class BagController extends BaseAuthedController {
)); ));
} }
private function proEffect($p,$b){ private function sendNotice($itemMeta,$awardNum){
if ($p * $b > -1 && $b != 0) { $elements = array(
$x = floor($p) * $b; array(
$y = max($x+$b,-1); 'ele_type' => 2,
$q = ($p * $b - $y) / ($x - $y); 'color' => '#ff3f3f',
$rnd = rand(1,100); 'lang_key' => $itemMeta['name'],
return $rnd < $q*100 ? $x : $y; 'lang_params' => array(),
}else{ )
return 0; );
if ($itemMeta['id'] == V_ITEM_BCEG){
array_push($elements, array(
'ele_type' => 1,
'color' => '#ff3f3f',
'text' => $awardNum,
));
$this->_send($elements);
}elseif($itemMeta['id'] == 901004){
$this->_send($elements);
}elseif($itemMeta['type'] == \mt\Item::APPOINT_PROP_TYPE && $itemMeta['sub_type'] == \mt\Item::APPOINT_HERO_SUBTYPE){
$this->_send($elements);
}elseif($itemMeta['type'] == \mt\Item::APPOINT_PROP_TYPE && $itemMeta['sub_type'] == \mt\Item::APPOINT_CHIP_SUBTYPE && $itemMeta['quality'] > 3){
$this->_send($elements);
} }
}
private function _send($elements){
$content = myself()->_callServiceStatic('NoticeService', 'buildCustom', $elements);
$loop = 1;
$interval = 1;
myself()->_callServiceStatic('NoticeService', 'send', $content, $loop, $interval);
} }