1
This commit is contained in:
parent
2b483e0da4
commit
1686e136ba
@ -3,6 +3,7 @@
|
|||||||
require_once('phpcommon/tglog.php');
|
require_once('phpcommon/tglog.php');
|
||||||
|
|
||||||
require_once('mt/Item.php');
|
require_once('mt/Item.php');
|
||||||
|
require_once('mt/Parameter.php');
|
||||||
require_once('services/AwardService.php');
|
require_once('services/AwardService.php');
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
require_once('services/LootService.php');
|
require_once('services/LootService.php');
|
||||||
@ -217,12 +218,48 @@ END
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function lootTest($params){
|
private function lootTest($params){
|
||||||
$dropIndex = getXVal($params, 0, 0);
|
|
||||||
$dropNum = getXVal($params, 1, 0);
|
$lucky = getXVal($params, 0, 0);
|
||||||
for ($i=0; $i<$dropNum; $i++){
|
$itemId = getXVal($params, 1, 0);
|
||||||
$items = \services\LootService::dropOutItem($dropIndex);
|
$itemNum = getXVal($params, 2, 0);
|
||||||
|
$itemMeta = mt\Item::get($itemId);
|
||||||
|
if (!$itemMeta || $itemMeta['type'] != mt\Item::BATTLE_REWARD_BOX) {
|
||||||
|
$this->_rspErr(2, 'config error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
||||||
|
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
||||||
|
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
||||||
|
|
||||||
|
for ($i=0; $i<$itemNum; $i++){
|
||||||
|
$times = $this->proEffect($prob,1);
|
||||||
|
$temp = array(
|
||||||
|
"prob" => $prob,
|
||||||
|
"times" => $times
|
||||||
|
);
|
||||||
|
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
||||||
|
if ($times > 0){
|
||||||
|
foreach ($items as &$item){
|
||||||
|
$item['item_num'] += $item['item_num']*$times;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_unshift($items,$temp);
|
||||||
TGLog::writeToLog("game_2006_api","loot",$items);
|
TGLog::writeToLog("game_2006_api","loot",$items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user