1
This commit is contained in:
parent
5b4e6113d1
commit
f475f86f28
@ -1877,6 +1877,7 @@ CREATE TABLE `t_server_task_battle_count` (
|
|||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
||||||
|
`loot_index` int(11) NOT NULL DEFAULT '0' COMMENT '掉落包索引',
|
||||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
||||||
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
@ -6,6 +6,7 @@ CREATE TABLE `t_server_task_battle_count` (
|
|||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
||||||
|
`loot_index` int(11) NOT NULL DEFAULT '0' COMMENT '掉落包索引',
|
||||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
||||||
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
@ -10,30 +10,31 @@ class ServerTaskBattleCount extends BaseModel
|
|||||||
const TOTAL_COUNT = 1; //总计数
|
const TOTAL_COUNT = 1; //总计数
|
||||||
const LOOP_COUNT = 2; //循环计数
|
const LOOP_COUNT = 2; //循环计数
|
||||||
|
|
||||||
public static function getV($period, $state, $defVal = 0)
|
public static function getV($period,$lootIndex, $state, $defVal = 0)
|
||||||
{
|
{
|
||||||
$valData = self::internalGetV($period, $state, $defVal);
|
$valData = self::internalGetV($period, $lootIndex,$state, $defVal);
|
||||||
return $valData['val'];
|
return $valData['val'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setV($period, $state, $defVal)
|
public static function setV($period,$lootIndex, $state, $defVal)
|
||||||
{
|
{
|
||||||
self::internalSetV($period, $state, $defVal);
|
self::internalSetV($period,$lootIndex, $state, $defVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function incV($period, $state, $val)
|
public static function incV($period,$lootIndex, $state, $val)
|
||||||
{
|
{
|
||||||
$oldVal = self::getV($period, $state);
|
$oldVal = self::getV($period,$lootIndex, $state);
|
||||||
self::internalSetV($period, $state, $oldVal + $val);
|
self::internalSetV($period,$lootIndex, $state, $oldVal + $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function internalGetV($period, $state, $defVal = 0){
|
private static function internalGetV($period,$lootIndex, $state, $defVal = 0){
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getSelfMysql(),
|
||||||
't_server_task_battle_count',
|
't_server_task_battle_count',
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
|
'loot_index' => $lootIndex,
|
||||||
'state' => $state,
|
'state' => $state,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -43,7 +44,7 @@ class ServerTaskBattleCount extends BaseModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function internalSetV($period,$state, $val)
|
private static function internalSetV($period,$lootIndex,$state, $val)
|
||||||
{
|
{
|
||||||
SqlHelper::upsert
|
SqlHelper::upsert
|
||||||
(myself()->_getSelfMysql(),
|
(myself()->_getSelfMysql(),
|
||||||
@ -51,6 +52,7 @@ class ServerTaskBattleCount extends BaseModel
|
|||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
|
'loot_index' => $lootIndex,
|
||||||
'state' => $state
|
'state' => $state
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -60,6 +62,7 @@ class ServerTaskBattleCount extends BaseModel
|
|||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
|
'loot_index' => $lootIndex,
|
||||||
'state' => $state,
|
'state' => $state,
|
||||||
'val' => $val,
|
'val' => $val,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
@ -82,9 +82,9 @@ class LootService
|
|||||||
$period = $serverTaskMeta?$serverTaskMeta['id']:0;
|
$period = $serverTaskMeta?$serverTaskMeta['id']:0;
|
||||||
|
|
||||||
// $totalTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,0);
|
// $totalTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,0);
|
||||||
$totalTimes = ServerTaskBattleCount::getV($period,ServerTaskBattleCount::TOTAL_COUNT);
|
$totalTimes = ServerTaskBattleCount::getV($period,$lootMeta['id'],ServerTaskBattleCount::TOTAL_COUNT);
|
||||||
// $recycleTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,1);
|
// $recycleTimes = myself()->_getV(TN_TOTAL_LOOT_TIMES,1);
|
||||||
$recycleTimes = ServerTaskBattleCount::getV(0,ServerTaskBattleCount::LOOP_COUNT);
|
$recycleTimes = ServerTaskBattleCount::getV(0,$lootMeta['id'],ServerTaskBattleCount::LOOP_COUNT);
|
||||||
$contentArr = explode("|",$lootMeta['content']);
|
$contentArr = explode("|",$lootMeta['content']);
|
||||||
$initTimes = $contentArr[0];
|
$initTimes = $contentArr[0];
|
||||||
$po = $contentArr[1];
|
$po = $contentArr[1];
|
||||||
@ -97,15 +97,22 @@ class LootService
|
|||||||
}
|
}
|
||||||
$p = min($po + ($recycleTimes-1) * $pd,$pm) * 100 ;
|
$p = min($po + ($recycleTimes-1) * $pd,$pm) * 100 ;
|
||||||
$rnd = rand(1,100);
|
$rnd = rand(1,100);
|
||||||
|
error_log("LOOT".json_encode(array(
|
||||||
|
'totalTimes' => $lootMeta['id'].'|'.$totalTimes,
|
||||||
|
'recycleTimes' => $lootMeta['id'].'|'.$recycleTimes,
|
||||||
|
'rnd' => $rnd,
|
||||||
|
'rate' => $p,
|
||||||
|
'lootMeta' => $lootMeta,
|
||||||
|
)));
|
||||||
// myself()->_incV(TN_TOTAL_LOOT_TIMES,0,1);
|
// myself()->_incV(TN_TOTAL_LOOT_TIMES,0,1);
|
||||||
ServerTaskBattleCount::incV($period,ServerTaskBattleCount::TOTAL_COUNT,1);
|
ServerTaskBattleCount::incV($period,$lootMeta['id'],ServerTaskBattleCount::TOTAL_COUNT,1);
|
||||||
if ($rnd <= $p){
|
if ($rnd <= $p){
|
||||||
// myself()->_setV(TN_TOTAL_LOOT_TIMES,1,1);
|
// myself()->_setV(TN_TOTAL_LOOT_TIMES,1,1);
|
||||||
ServerTaskBattleCount::setV(0,ServerTaskBattleCount::LOOP_COUNT,1);
|
ServerTaskBattleCount::setV(0,$lootMeta['id'],ServerTaskBattleCount::LOOP_COUNT,1);
|
||||||
self::disposeLootIndex($index1,$depth,$items);
|
self::disposeLootIndex($index1,$depth,$items);
|
||||||
}else{
|
}else{
|
||||||
// myself()->_incV(TN_TOTAL_LOOT_TIMES,1,1);
|
// myself()->_incV(TN_TOTAL_LOOT_TIMES,1,1);
|
||||||
ServerTaskBattleCount::incV(0,ServerTaskBattleCount::LOOP_COUNT,1);
|
ServerTaskBattleCount::incV(0,$lootMeta['id'],ServerTaskBattleCount::LOOP_COUNT,1);
|
||||||
self::disposeLootIndex($index2,$depth,$items);
|
self::disposeLootIndex($index2,$depth,$items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,6 +167,7 @@ class RoomBattleDataService extends BaseService {
|
|||||||
$gold = 0;
|
$gold = 0;
|
||||||
// $accountLucky = Hero::getAccountLucky($userDb['address']);
|
// $accountLucky = Hero::getAccountLucky($userDb['address']);
|
||||||
$accountLucky = Hero::getAccountLuckyTemp();
|
$accountLucky = Hero::getAccountLuckyTemp();
|
||||||
|
error_log("LootLucky:".$accountLucky);
|
||||||
$rewardMeta = mt\BattleReward::find($mapModeMeta['rewardMode'],$accountLucky);
|
$rewardMeta = mt\BattleReward::find($mapModeMeta['rewardMode'],$accountLucky);
|
||||||
if (!$rewardMeta){
|
if (!$rewardMeta){
|
||||||
return ;
|
return ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user