悬赏BUG

This commit is contained in:
hujiabin 2022-10-09 15:26:09 +08:00
parent 52bc929de1
commit c5aebbbaa8
5 changed files with 80 additions and 16 deletions

View File

@ -151,6 +151,8 @@ CREATE TABLE `t_hero` (
`last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间',
`today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币',
`last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间',
`today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币',
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
@ -289,6 +291,8 @@ CREATE TABLE `t_gun` (
`last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间',
`today_pve_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT 'pve金币',
`last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间',
`today_mission_get_ceg` bigint NOT NULL DEFAULT '0' COMMENT '悬赏任务获得金币',
`last_mission_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后悬赏任务获取金币的时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
`chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组',
@ -493,7 +497,7 @@ CREATE TABLE `t_season_card` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_season_card`
-- Table structure for table `t_used_name`
--
DROP TABLE IF EXISTS `t_used_name`;

View File

@ -101,7 +101,7 @@ class MissionController extends BaseAuthedController {
if ($specMissionDto &&
$specMissionDto['state'] == Mission::NOT_FINISHED_STATE &&
$notFinishedCount <= 1) {
$specMissionDto['state'] == Mission::RECEIVEABLE_STATE;
$specMissionDto['state'] = Mission::RECEIVEABLE_STATE;
}
$this->_rspData(array(
'current_active_value' => min($this->_getV(TN_ACTIVE, 0), mt\Parameter::getVal('max_activity', 0)),
@ -156,7 +156,7 @@ class MissionController extends BaseAuthedController {
$this->_rspErr(10, 'server internal error:' . $missionMeta['reward']);
return;
}
$this->_scatterDrop('mission:' . $missionId, $dropMeta, $this->awardService, $this->propertyChgService);print_r($missionDto);die;
$this->_scatterDrop('mission:' . $missionId, $dropMeta, $this->awardService, $this->propertyChgService);
$this->procSpecMissionCommit($missionDto, $missionMeta);
Mission::add($missionId);
$missionDb = Mission::find($missionId);
@ -292,8 +292,8 @@ class MissionController extends BaseAuthedController {
'count' => $count,
'ceg' => $gold
)));
myself()->_addVirtualItem(V_ITEM_GOLD, round($gold));
$this->awardService->addItem(V_ITEM_GOLD, round($gold));
myself()->_addVirtualItem(V_ITEM_GOLD, round($gold,2));
$this->awardService->addItem(V_ITEM_GOLD, round($gold,2));
}
break;
case mt\Task::OFFER_REWARD_MISSON_TYPE:

View File

@ -171,6 +171,11 @@ class Gun extends BaseModel {
myself()->_getNowDaySeconds()) {
$todayPveGetCeg = 0;
}
$todayMissionGetCeg = $row['today_mission_get_ceg'];
$lastMissionGetCegTime = $row['last_mission_get_ceg_time'];
if (myself()->_getDaySeconds($lastMissionGetCegTime) < myself()->_getNowDaySeconds()) {
$todayMissionGetCeg = 0;
}
$gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']);
$dto = array(
'idx' => $row['idx'],
@ -193,6 +198,8 @@ class Gun extends BaseModel {
'last_pvp_get_ceg_time' => $lastGetGoldTime,
'current_pve_get_ceg' => $todayPveGetCeg / 100,
'last_pve_get_ceg_time' => $lastPveGetCegTime,
'current_mission_get_ceg' => $todayMissionGetCeg / 100,
'last_mission_get_ceg_time' => $lastMissionGetCegTime,
'lock_type' => $lockType,
'unlock_time' => $unlockTime,
'unlock_lefttime' => max(0,
@ -205,6 +212,7 @@ class Gun extends BaseModel {
$dto['durability_max'] = strval(round(FormulaService::Weapon_NFT_Maximum_Durability($dto['quality'],$dto['lucky']),3));
$dto['pvp_ceg_uplimit'] = strval( round(FormulaService::getWeaponPvpDailyCegUpLimit($dto),2) );
$dto['pve_ceg_uplimit'] = strval( round(FormulaService::getWeaponPveDailyCegUpLimit($dto),2) );
$dto['mission_ceg_uplimit'] = strval( round(FormulaService::getWeaponMissionDailyCegUpLimit($dto),2) );
return $dto;
}
@ -488,6 +496,33 @@ class Gun extends BaseModel {
return $newAttrPro;
}
public static function calcMissionGainGold($gunDto, $count)
{
if ($count <= 0) {
return 0;
}
$newGold = min($gunDto['mission_ceg_uplimit'],
$gunDto['current_mission_get_ceg'] +
$gunDto['mission_ceg_uplimit'] / $count);
$finalyAddGold = max(0, $newGold - $gunDto['current_mission_get_ceg']);
return $finalyAddGold;
}
public static function gainGoldMission($gunDto, $addGold)
{
$newGold = min($gunDto['mission_ceg_uplimit'],
$gunDto['current_mission_get_ceg'] + $addGold);
$finalyAddGold = max(0, $newGold - $gunDto['current_mission_get_ceg']);
if ($finalyAddGold > 0) {
self::update($gunDto['gun_uniid'],
array(
'today_mission_get_ceg' => $newGold * 100,
'last_mission_get_ceg_time' => myself()->_getNowTime()
));
}
return $finalyAddGold;
}
public static function calcPveGainGold($gunDto, $count)
{
return 0;

View File

@ -153,6 +153,11 @@ class Hero extends BaseModel {
myself()->_getNowDaySeconds()) {
$todayPveGetCeg = 0;
}
$todayMissionGetCeg = $row['today_mission_get_ceg'];
$lastMissionGetCegTime = $row['last_mission_get_ceg_time'];
if (myself()->_getDaySeconds($lastMissionGetCegTime) < myself()->_getNowDaySeconds()) {
$todayMissionGetCeg = 0;
}
$baseAttr=[];
$attrPro=[];
$heroMeta = mt\Hero::get($row['hero_id']);
@ -204,6 +209,8 @@ class Hero extends BaseModel {
'last_pvp_get_ceg_time' => $lastGetGoldTime,
'current_pve_get_ceg' => $todayPveGetCeg / 100,
'last_pve_get_ceg_time' => $lastPveGetCegTime,
'current_mission_get_ceg' => $todayMissionGetCeg / 100,
'last_mission_get_ceg_time' => $lastMissionGetCegTime,
'unlock_trade_time' => $row['unlock_trade_time'],
'advanced_count' => $row['advanced_count'],
'lucky' => $heroLucky,
@ -216,6 +223,7 @@ class Hero extends BaseModel {
$dto['hero_tili_max'] = strval(round(FormulaService::Hero_NFT_Maximum_Physical_Strength($dto['quality'],$dto['lucky']),3));
$dto['pvp_ceg_uplimit'] =strval( round(FormulaService::getHeroPvpDailyCegUpLimit($dto),2) );
$dto['pve_ceg_uplimit'] = strval( round(FormulaService::getHeroPveDailyCegUpLimit($dto),2) );
$dto['mission_ceg_uplimit'] = strval( round(FormulaService::getHeroMissionDailyCegUpLimit($dto),2) );
return $dto;
}
@ -406,15 +414,30 @@ class Hero extends BaseModel {
return $finalyAddGold;
}
public static function calcPveGainGold($heroDto, $count)
public static function gainGoldMission($heroDto, $addGold)
{
$newGold = min($heroDto['mission_ceg_uplimit'],
$heroDto['current_mission_get_ceg'] + $addGold);
$finalyAddGold = max(0, $newGold - $heroDto['current_mission_get_ceg']);
if ($finalyAddGold > 0) {
self::update($heroDto['hero_uniid'],
array(
'today_mission_get_ceg' => $newGold * 100,
'last_mission_get_ceg_time' => myself()->_getNowTime()
));
}
return $finalyAddGold;
}
public static function calcMissionGainGold($heroDto, $count)
{
if ($count <= 0) {
return 0;
}
$newGold = min($heroDto['pve_ceg_uplimit'],
$heroDto['current_pve_get_ceg'] +
round($heroDto['pve_ceg_uplimit'] / $count));
$finalyAddGold = max(0, $newGold - $heroDto['current_pve_get_ceg']);
$newGold = min($heroDto['mission_ceg_uplimit'],
$heroDto['current_mission_get_ceg'] +
$heroDto['mission_ceg_uplimit'] / $count);
$finalyAddGold = max(0, $newGold - $heroDto['current_mission_get_ceg']);
return $finalyAddGold;
}

View File

@ -921,7 +921,8 @@ class MissionService extends BaseService {
$gunDb = Gun::find($obj['id']);
if ($gunDb) {
$gunDto = Gun::toDto($gunDb);
$totalGunUpLimit += Gun::pveGainGold($gunDto, $count);
$addGold = Gun::calcMissionGainGold($gunDto,$count);
$totalGunUpLimit += Gun::gainGoldMission($gunDto, $addGold);
Gun::Update
($obj['id'],
array(
@ -937,7 +938,8 @@ class MissionService extends BaseService {
$heroDb = Hero::find($obj['id']);
if ($heroDb) {
$heroDto = Hero::toDto($heroDb);
$totalHeroUpLimit += Hero::pveGainGold($heroDto, $count);
$addGold = Hero::calcMissionGainGold($heroDto,$count);
$totalHeroUpLimit += Hero::gainGoldMission($heroDto, $addGold);
Hero::Update
($obj['id'],
array(
@ -955,8 +957,8 @@ class MissionService extends BaseService {
}//end foreach
$ceg = $totalHeroUpLimit + $totalGunUpLimit;
if ($count > 0 && $ceg > 0) {
myself()->_addVirtualItem(V_ITEM_GOLD, round($ceg));
$awardService->addItem(V_ITEM_GOLD, round($ceg));
myself()->_addVirtualItem(V_ITEM_GOLD, round($ceg,2));
$awardService->addItem(V_ITEM_GOLD, round($ceg,2));
}
$this->updateOfferRewardMission($missionId);
$this->saveOfferRewardMission();
@ -992,7 +994,7 @@ class MissionService extends BaseService {
$gunDb = Gun::find($id);
if ($gunDb) {
$gunDto = Gun::toDto($gunDb);
$cegNum += Gun::calcPveGainGold($gunDto, $count);
$cegNum += Gun::calcMissionGainGold($gunDto, $count);
}
}
break;
@ -1002,7 +1004,7 @@ class MissionService extends BaseService {
$heroDb = Hero::find($id);
if ($heroDb) {
$heroDto = Hero::toDto($heroDb);
$cegNum += Hero::calcPveGainGold($heroDto, $count);
$cegNum += Hero::calcMissionGainGold($heroDto, $count);
}
}
break;