diff --git a/webapp/models/Gun.php b/webapp/models/Gun.php index c3ca498b..55901bc1 100644 --- a/webapp/models/Gun.php +++ b/webapp/models/Gun.php @@ -271,7 +271,7 @@ class Gun extends BaseModel { if (myself()->_getDaySeconds($lastMissionGetCegTime) < myself()->_getNowDaySeconds()) { $todayMissionGetCeg = 0; } -// $gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']); + $gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']); $dto = array( 'idx' => $row['idx'], 'token_id' => $row['token_id'], @@ -280,7 +280,6 @@ class Gun extends BaseModel { 'gun_lv' => $row['gun_lv'], 'state' => $row['state'], 'quality' => $row['quality'], -// 'lucky' => strval($gunLucky), 'durability' => $row['durability'], 'ceg_uplimit' => 0, 'pve_ceg_uplimit' => 0, @@ -301,11 +300,13 @@ class Gun extends BaseModel { 'unlock_trade_time' => $row['unlock_trade_time'], 'offer_reward_state' => 0, 'tags' => $row['tags']?:'', + + 'lucky' => strval($gunLucky), ); -// $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) ); + $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) ); $nft_address = ''; if ($row['token_id']){ diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 6e1fb446..7b9dee0f 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -239,17 +239,23 @@ class Hero extends BaseModel { myself()->_getNowDaySeconds()) { $todayGetGold = 0; } -// $todayPveGetCeg = $row['today_pve_get_ceg']; -// $lastPveGetCegTime = $row['last_pve_get_ceg_time']; -// if (myself()->_getDaySeconds($lastPveGetCegTime) < -// 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; -// } + + { + $todayPveGetCeg = $row['today_pve_get_ceg']; + $lastPveGetCegTime = $row['last_pve_get_ceg_time']; + if (myself()->_getDaySeconds($lastPveGetCegTime) < + 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']); @@ -265,7 +271,7 @@ class Hero extends BaseModel { } $attrPro = self::mergeAttrPro($baseAttr,$attrPro1,$attrPro2); } -// $heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($row['quality']); + $heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($row['quality']); $dto = array( 'idx' => $row['idx'], 'token_id' => $row['token_id'], @@ -280,7 +286,6 @@ class Hero extends BaseModel { 'skill_lv2' => $row['skill_lv2'], 'attr_base' => $baseAttr, 'attr_pro' => $attrPro, - 'try_count' => $row['try_count'], 'lock_type' => $lockType, 'unlock_time' => $unlockTime, @@ -289,20 +294,25 @@ class Hero extends BaseModel { 'current_get_gold' => $todayGetGold / 100, 'last_get_gold_time' => $lastGetGoldTime, 'gold_uplimit' => $levelMeta['gold_limit'], -// '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, 'offer_reward_state' => 0, 'tags' => $row['tags']?:'', + + //暂留(以下弃用字段) + 'current_pvp_get_ceg' => $todayGetGold / 100, + '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, + 'lucky' => $heroLucky, + ); -// $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) ); + $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) ); $nft_address = ''; if ($row['token_id']){ @@ -384,69 +394,6 @@ class Hero extends BaseModel { ); } - public static function addTryHero($heroMeta, $tryCount) - { - $realHeroMeta = mt\Hero::get($heroMeta['id']); - $randAttr = array(); - { - $initQualityMeta = mt\HeroQuality::getByQuality(1); - if ($initQualityMeta) { - $randAttr = mt\HeroQuality::getRandAttr($initQualityMeta); - } - } - SqlHelper::upsert( - myself()->_getSelfMysql(), - 't_hero', - array( - 'account_id' => myself()->_getAccountId(), - 'hero_id' => $heroMeta['id'] - ), - array( - ), - array( - 'account_id' => myself()->_getAccountId(), - 'hero_id' => $heroMeta['id'], - 'hero_lv' => 1, - 'quality' => 1, - 'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0, - 'state' => self::FREE_STATE, - 'try_count' => $tryCount, - 'skill_lv1' => 1, - 'skill_lv2' => 1, - 'rand_attr' => json_encode($randAttr), - 'lock_type' => self::NO_LOCK, - 'unlock_time' => 0, - 'unlock_trade_time' => 0, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - - public static function takeonSkin($heroUniId, $skinId) - { - self::update($heroUniId, array( - 'skin_id' => $skinId, - 'modifytime' => myself()->_getNowTime() - )); - } - - public static function upgradeSkill($heroUniId, $skillIdx,$skill_points) - { - if (!in_array($skillIdx, array(0, 1))) { - return; - } - $fieldName = 'skill_lv' . ($skillIdx + 1); - self::update($heroUniId, array( - $fieldName => function () use($fieldName) { - return "${fieldName} + 1"; - }, - 'skill_points' => function() use ($skill_points){ - return "GREATEST(0, skill_points - ${skill_points})"; - }, - 'modifytime' => myself()->_getNowTime() - )); - } public static function update($heroUniId, $fieldsKv) { @@ -641,13 +588,6 @@ class Hero extends BaseModel { foreach ($baseAttr as $val){ foreach ($attr as $v){ $coef_level = mt\HeroLevelAttr::getByCoefficient($coefficient_level,$val['attr_id']); -// if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_Atk){ //18 //18.941564456287 //20.847692307692 -// array_push($attrPro1,[ -// 'attr_id' => $val['attr_id'], -// 'type'=> $val['type'], -// 'val' => strval($val['val']*$v['val']+$v['val']/$coef_level['val']*100-100/$coef_level['val']), -// ]); -// } //&& $val['attr_id'] != kHAT_Atk if ( $val['attr_id'] == $v['attr_id'] ){ array_push($attrPro1,[ @@ -668,20 +608,6 @@ class Hero extends BaseModel { foreach ($baseAttr as $val){ $coef_quality = mt\HeroQuality::getByCoefficient($coefficient_quality,$val['attr_id']); if ($coef_quality){ -// if ($val['attr_id'] == kHAT_Atk){ -// array_push($attrPro2,[ -// 'attr_id' => $val['attr_id'], -// 'type'=> $val['type'], -// 'val' => strval($val['val']*$qualityMeta['promote_val']+$qualityMeta['promote_val']/$coef_quality['val']*100-100/$coef_quality['val']), -// ]); -// } -// if ($val['attr_id'] != kHAT_Atk) { -// array_push($attrPro2, [ -// 'attr_id' => $val['attr_id'], -// 'type' => $val['type'], -// 'val' => strval($val['val'] * pow($qualityMeta['promote_val'], $coef_quality['val'])), -// ]); -// } array_push($attrPro2, [ 'attr_id' => $val['attr_id'], 'type' => $val['type'],