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();
foreach ($items as $item){
$awardItemMeta = \mt\Item::get($item['item_id']);
$this->sendNotice($awardItemMeta , $item['item_num']);
if (isset($hashItems[$item['item_id']])){
$hashItems[$item['item_id']]['item_num'] += $item['item_num'];
}else{
@ -452,16 +454,39 @@ class BagController extends BaseAuthedController {
));
}
private function proEffect($p,$b){
if ($p * $b > -1 && $b != 0) {
$x = floor($p) * $b;
$y = max($x+$b,-1);
$q = ($p * $b - $y) / ($x - $y);
$rnd = rand(1,100);
return $rnd < $q*100 ? $x : $y;
}else{
return 0;
private function sendNotice($itemMeta,$awardNum){
$elements = array(
array(
'ele_type' => 2,
'color' => '#ff3f3f',
'lang_key' => $itemMeta['name'],
'lang_params' => array(),
)
);
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);
}