1
This commit is contained in:
parent
1686e136ba
commit
d9ed2ba11e
@ -4,6 +4,7 @@ require_once('mt/Parameter.php');
|
|||||||
require_once('mt/Item.php');
|
require_once('mt/Item.php');
|
||||||
require_once('mt/Drop.php');
|
require_once('mt/Drop.php');
|
||||||
require_once('mt/Hero.php');
|
require_once('mt/Hero.php');
|
||||||
|
require_once('mt/LootConfig.php');
|
||||||
|
|
||||||
require_once('models/Bag.php');
|
require_once('models/Bag.php');
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
@ -135,6 +136,8 @@ class BagController extends BaseAuthedController {
|
|||||||
$this->openGiftPackage($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
|
$this->openGiftPackage($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3);
|
||||||
} else if ($itemMeta['type'] == mt\Item::TREASURE_BOX) {
|
} else if ($itemMeta['type'] == mt\Item::TREASURE_BOX) {
|
||||||
$this->openTreasureBox($itemDb, $itemMeta, $itemNum);
|
$this->openTreasureBox($itemDb, $itemMeta, $itemNum);
|
||||||
|
}else if ($itemMeta['type'] == mt\Item::GOLD_SYN) {
|
||||||
|
$this->resolveGolds($itemDb, $itemMeta, $itemNum);
|
||||||
} else if ($itemMeta['type'] == mt\Item::BATTLE_REWARD_BOX) {
|
} else if ($itemMeta['type'] == mt\Item::BATTLE_REWARD_BOX) {
|
||||||
$this->openBattleBox($itemDb, $itemMeta, $itemNum);
|
$this->openBattleBox($itemDb, $itemMeta, $itemNum);
|
||||||
} else {
|
} else {
|
||||||
@ -380,32 +383,30 @@ class BagController extends BaseAuthedController {
|
|||||||
'property_chg' => $this->propertyChgService->toDto(),
|
'property_chg' => $this->propertyChgService->toDto(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// public function test(){
|
|
||||||
// $itemMeta = mt\Item::get(400001);
|
|
||||||
// $itemDb= 0;
|
|
||||||
// $itemNum= 0;
|
|
||||||
// $this->openBattleBox($itemDb,$itemMeta,$itemNum);
|
|
||||||
//// print_r($itemMeta);
|
|
||||||
// }
|
|
||||||
|
|
||||||
private function openBattleBox($itemDb,$itemMeta,$itemNum){
|
private function openBattleBox($itemDb,$itemMeta,$itemNum){
|
||||||
|
$lootMeta = mt\LootConfig::find($itemMeta['loot']);
|
||||||
|
if ($lootMeta['isAffected']){
|
||||||
$lucky = Hero::getAccountLucky(myself()->_getAddress());
|
$lucky = Hero::getAccountLucky(myself()->_getAddress());
|
||||||
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
||||||
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
||||||
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
||||||
$times = $this->proEffect($prob,1);
|
$times = $this->proEffect($prob,1);
|
||||||
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
||||||
|
if ($times > 0){
|
||||||
|
foreach ($items as &$item){
|
||||||
|
$item['item_num'] += $item['item_num']*$times;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
||||||
|
}
|
||||||
$this->_decItems(array(
|
$this->_decItems(array(
|
||||||
array(
|
array(
|
||||||
'item_id' => $itemMeta['id'],
|
'item_id' => $itemMeta['id'],
|
||||||
'item_num' => 1
|
'item_num' => 1
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
if ($times > 0){
|
|
||||||
foreach ($items as &$item){
|
|
||||||
$item['item_num'] += $item['item_num']*$times;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->_addItems($items,$this->awardService,$this->propertyChgService);
|
$this->_addItems($items,$this->awardService,$this->propertyChgService);
|
||||||
$this->propertyChgService->addBagChg();
|
$this->propertyChgService->addBagChg();
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
@ -591,4 +592,49 @@ class BagController extends BaseAuthedController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resolveGolds($itemDb,$itemMeta,$itemNum){
|
||||||
|
$paramMeta = mt\Parameter::getVal('gold_synthesis_rank',0);
|
||||||
|
if (!$paramMeta){
|
||||||
|
$this->_rspErr(1,"config error");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$consume = explode("|",$paramMeta);
|
||||||
|
switch ($itemMeta['id']){
|
||||||
|
case V_ITEM_GOLDS :{
|
||||||
|
$items = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $consume[0]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case V_ITEM_GOLDBRICK :{
|
||||||
|
$items = array(
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_GOLD,
|
||||||
|
'item_num' => $consume[1]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:{
|
||||||
|
$this->_rspErr(1,"param error");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_decItems(array(
|
||||||
|
array(
|
||||||
|
'item_id' => $itemMeta['id'],
|
||||||
|
'item_num' => 1
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$this->_addItems($items, $this->awardService, $this->propertyChgService);
|
||||||
|
$this->propertyChgService->addUserChg();
|
||||||
|
$this->propertyChgService->addBagChg();
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $this->propertyChgService->toDto(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ require_once('phpcommon/tglog.php');
|
|||||||
|
|
||||||
require_once('mt/Item.php');
|
require_once('mt/Item.php');
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
|
require_once('mt/LootConfig.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');
|
||||||
@ -227,11 +228,11 @@ END
|
|||||||
$this->_rspErr(2, 'config error');
|
$this->_rspErr(2, 'config error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$lootMeta = mt\LootConfig::find($itemMeta['loot']);
|
||||||
|
if ($lootMeta['isAffected']){
|
||||||
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
$luckyParam = \mt\Parameter::getVal('economy_account_luck_K',0);
|
||||||
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
$luckyMaxPro = \mt\Parameter::getVal('economy_account_luck_E',0);
|
||||||
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
$prob = $luckyMaxPro * ($lucky / ($lucky+$luckyParam));
|
||||||
|
|
||||||
for ($i=0; $i<$itemNum; $i++){
|
for ($i=0; $i<$itemNum; $i++){
|
||||||
$times = $this->proEffect($prob,1);
|
$times = $this->proEffect($prob,1);
|
||||||
$temp = array(
|
$temp = array(
|
||||||
@ -247,7 +248,12 @@ END
|
|||||||
array_unshift($items,$temp);
|
array_unshift($items,$temp);
|
||||||
TGLog::writeToLog("game_2006_api","loot",$items);
|
TGLog::writeToLog("game_2006_api","loot",$items);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
for ($i=0; $i<$itemNum; $i++){
|
||||||
|
$items = \services\LootService::dropOutItem($itemMeta['loot']);
|
||||||
|
TGLog::writeToLog("game_2006_api","loot",$items);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function proEffect($p,$b){
|
private function proEffect($p,$b){
|
||||||
|
@ -108,6 +108,7 @@ class Item {
|
|||||||
const PLANET_TYPE = 28;
|
const PLANET_TYPE = 28;
|
||||||
const AVATAR_TYPE = 29;
|
const AVATAR_TYPE = 29;
|
||||||
const TREASURE_BOX = 30;
|
const TREASURE_BOX = 30;
|
||||||
|
const GOLD_SYN = 31;
|
||||||
const BATTLE_REWARD_BOX = 32;
|
const BATTLE_REWARD_BOX = 32;
|
||||||
|
|
||||||
const FUNC_RENAME_CARD_SUBTYPE = 1;
|
const FUNC_RENAME_CARD_SUBTYPE = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user