1
This commit is contained in:
parent
28eea9a673
commit
66225baa4e
@ -105,7 +105,7 @@ class Fragment {
|
||||
const hour = Math.floor(hourSeconds / 3600);
|
||||
const remainHour = Math.min(24, Math.max(1, 24 - hour));
|
||||
|
||||
console.log(hour, remainHour);
|
||||
// console.log(hour, remainHour);
|
||||
|
||||
const allocResult = new Map();
|
||||
allocResult.set(PVP_TYPE, new Map());
|
||||
@ -141,7 +141,7 @@ class Fragment {
|
||||
};
|
||||
|
||||
const remainData = await this.getRemainData(daySeconds, nowTime, hourSeconds, allocedFragments);
|
||||
console.log(remainData);
|
||||
// console.log(remainData);
|
||||
remainData.forEach(
|
||||
(value, key) => {
|
||||
const allocNode = allocResult.get(key);
|
||||
@ -152,7 +152,7 @@ class Fragment {
|
||||
allocFunc(allocNode, constant.ALL_GUN_FRAGMENT, value, gunNum);
|
||||
});
|
||||
|
||||
console.log(allocResult);
|
||||
// console.log(allocResult);
|
||||
const items = [];
|
||||
allocResult.forEach(
|
||||
(value, key) => {
|
||||
@ -168,7 +168,7 @@ class Fragment {
|
||||
}
|
||||
);
|
||||
|
||||
console.log(items);
|
||||
// console.log(items);
|
||||
await utils.serial(
|
||||
items,
|
||||
async (element) => {
|
||||
|
@ -125,6 +125,7 @@ class RankingController extends BaseAuthedController {
|
||||
$lastSeasonRank = $userInfo['rank'];
|
||||
$lastSeasonScore = $userInfo['score'];
|
||||
$currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
$award = array();
|
||||
if ($currSeasonMeta && $userInfo['last_season_id'] > 0 && $currSeasonMeta['id'] > $userInfo['last_season_id']) {
|
||||
$rank = $userInfo['rank'];
|
||||
for ($i=$userInfo['last_season_id'];$i<$currSeasonMeta['id'];$i++){
|
||||
@ -148,6 +149,13 @@ class RankingController extends BaseAuthedController {
|
||||
$propertyChgService->addParachute();
|
||||
$cec = $this->calcCECSeasonAward($currSeasonMeta['id']-1);
|
||||
$award = array_merge($award,$cec);
|
||||
|
||||
error_log(json_encode(array(
|
||||
'user'=>$userInfo['account_id'],
|
||||
'Season' => $currSeasonMeta,
|
||||
'SeasonAward'=>$award,
|
||||
)));
|
||||
|
||||
if ($award){
|
||||
$this->_addItems($award,$awardService,$propertyChgService);
|
||||
}
|
||||
|
@ -142,6 +142,11 @@ class Chip extends BaseModel
|
||||
$row['today_get_gold'] = $todayGetGold;
|
||||
$row['last_get_gold_time'] = $lastGetGoldTime;
|
||||
// $row['belong_to_item_id'] = self::belongsToWhereOld($row);
|
||||
$nft_address = '';
|
||||
if ($row['token_id']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x73482411443E87CAC124C12A10B34e9Aaa2De168' : '0x26b4AFb60d6C903165150C6F0AA14F8016bE4aec';
|
||||
}
|
||||
$row['nft_address'] = $nft_address;
|
||||
return $row;
|
||||
}
|
||||
|
||||
@ -408,7 +413,7 @@ class Chip extends BaseModel
|
||||
switch ($type){
|
||||
case 1:{
|
||||
foreach ($chipIdsArr as $val){
|
||||
$chip = self::getChipByIdx($val);
|
||||
$chip = self::getChipByTokenId($val);
|
||||
$lucky = FormulaService::getChipLuckyValue($chip['chip_grade']);
|
||||
$MaxStrength+=FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip['chip_grade'],$lucky)*FormulaService::Hero_Chip_PSA_Value($chip)*FormulaService::Hero_Chip_GAC_PS_Value($chip['chip_grade']);
|
||||
}
|
||||
@ -416,7 +421,7 @@ class Chip extends BaseModel
|
||||
break;
|
||||
case 2:{
|
||||
foreach ($chipIdsArr as $val){
|
||||
$chip = self::getChipByIdx($val);
|
||||
$chip = self::getChipByTokenId($val);
|
||||
$lucky = FormulaService::getChipLuckyValue($chip['chip_grade']);
|
||||
$MaxStrength+=FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip['chip_grade'],$lucky)*FormulaService::Weapon_Chip_DA_Value($chip)*FormulaService::Weapon_Chip_GAC_PS_Value($chip['chip_grade']);
|
||||
}
|
||||
|
@ -31,6 +31,11 @@ class Fragment extends BaseModel
|
||||
'createtime' => $row['createtime'],
|
||||
'modifytime' => $row['modifytime'],
|
||||
);
|
||||
$nft_address = '';
|
||||
if ($row['token_id']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0xFc21A863bFb4E4534B246078772e2074e076f0a7' : '0x0E696947A06550DEf604e82C26fd9E493e576337';
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
return $dto;
|
||||
}
|
||||
|
||||
|
@ -289,6 +289,12 @@ class Gun extends BaseModel {
|
||||
$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']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x2F2Ed1c403cB7156617449795dE1CB47A0302a25' : '0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66';
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
return $dto;
|
||||
}
|
||||
|
||||
@ -630,4 +636,104 @@ class Gun extends BaseModel {
|
||||
return $gun;
|
||||
}
|
||||
|
||||
public static function toDtoInfo($row){
|
||||
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
||||
$itemMeta = mt\Item::get($row['gun_id']);
|
||||
$baseAttr=[];
|
||||
$attrPro=[];
|
||||
if ($itemMeta) {
|
||||
$baseAttr = mt\Equip::getGunBaseAttrs($itemMeta['relationship']);
|
||||
$attrPro1=[];
|
||||
if ($row['gun_lv']>1){
|
||||
$attrPro1 = self::getAttrProByLevel($row,$baseAttr,$attr);
|
||||
}
|
||||
$attrPro2=[];
|
||||
if ($row['quality']>1){
|
||||
$attrPro2 = self::getAttrProByQuality($row,$baseAttr);
|
||||
}
|
||||
$attrPro = self::mergeAttrPro($baseAttr,$attrPro1,$attrPro2);
|
||||
}
|
||||
$todayGetGold = $row['today_get_gold'];
|
||||
$lastGetGoldTime = $row['last_get_gold_time'];
|
||||
if (myself()->_getDaySeconds($lastGetGoldTime) < 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;
|
||||
}
|
||||
$gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']);
|
||||
$chipIds = ChipPlugin::getInlayChip($row['token_id']);
|
||||
$attr_chip= Chip::getChipAttr($chipIds)['attr_chip'];
|
||||
$chip_core= Chip::getChipAttr($chipIds)['chip_core'];
|
||||
|
||||
$rand_attr = $baseAttr;
|
||||
if ($attrPro){
|
||||
foreach ($rand_attr as $k=>$value){
|
||||
foreach ($attrPro as $val){
|
||||
if ($val['attr_id'] == $value['attr_id']){
|
||||
$rand_attr[$k]['val'] = $val['val'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($attr_chip){
|
||||
$rand_attr = self::_mergeArr(array_merge($rand_attr,$attr_chip));
|
||||
}
|
||||
if ($chip_core){
|
||||
$coreAttr = array();
|
||||
foreach ($chip_core as $value){
|
||||
array_push($coreAttr,array(
|
||||
'attr_id'=>$value['attr_id'],
|
||||
'type'=>$value['attr_add_type'],
|
||||
'val'=>$value['attr_number'],
|
||||
));
|
||||
}
|
||||
$rand_attr = self::_mergeArr(array_merge($rand_attr,$coreAttr));
|
||||
}
|
||||
$info = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
'gun_uniid' => $row['idx'],
|
||||
'gun_id' => $row['gun_id'],
|
||||
'gun_lv' => $row['gun_lv'],
|
||||
'state' => $row['state'],
|
||||
'quality' => $row['quality'],
|
||||
'lucky' => strval($gunLucky),
|
||||
'durability' => $row['durability'],
|
||||
'rand_attr' => $rand_attr,
|
||||
'chip_core' => $chip_core ? $coreAttr : $chip_core,
|
||||
'current_pvp_get_ceg' => $todayGetGold / 100,
|
||||
'current_pve_get_ceg' => $todayPveGetCeg / 100,
|
||||
'chip_ids' => $chipIds,
|
||||
'chip_strength_sum' => strval(Chip::getChipMaxStrength($row['chip_ids'],2)), //计算ceg上限所需参数
|
||||
);
|
||||
$info['durability_max'] = strval(round(FormulaService::Weapon_NFT_Maximum_Durability($info['quality'],$info['lucky']),3));
|
||||
$info['pvp_ceg_uplimit'] = strval( round(FormulaService::getWeaponPvpDailyCegUpLimit($info),2) );
|
||||
$info['pve_ceg_uplimit'] = strval( round(FormulaService::getWeaponPveDailyCegUpLimit($info),2) );
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
private static function _mergeArr($data){
|
||||
if ($data){
|
||||
$result = array();
|
||||
foreach ($data as $value){
|
||||
$key = $value['attr_id'];
|
||||
if(!isset($result[$key])){
|
||||
$result[$key] = array(
|
||||
'attr_id'=>$value['attr_id'],
|
||||
'type'=>$value['type'],
|
||||
'val'=>$value['val'],
|
||||
);
|
||||
}else{
|
||||
$result[$key]['val'] += $value['val'];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -292,6 +292,11 @@ class Hero extends BaseModel {
|
||||
$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']){
|
||||
$nft_address = SERVER_ENV == _ONLINE ? '0x3EBF5196dADC8F3F09C808333f98FE8A4b7d1e62' : '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0';
|
||||
}
|
||||
$dto['nft_address'] = $nft_address;
|
||||
return $dto;
|
||||
}
|
||||
|
||||
@ -667,5 +672,122 @@ class Hero extends BaseModel {
|
||||
return $hero;
|
||||
}
|
||||
|
||||
public static function toDtoInfo($row){
|
||||
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
||||
$todayGetGold = $row['today_get_gold'];
|
||||
$lastGetGoldTime = $row['last_get_gold_time'];
|
||||
if (myself()->_getDaySeconds($lastGetGoldTime) <
|
||||
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;
|
||||
}
|
||||
$baseAttr=[];
|
||||
$attrPro=[];
|
||||
$heroMeta = mt\Hero::get($row['hero_id']);
|
||||
if ($heroMeta) {
|
||||
$baseAttr = mt\Hero::getHeroAttr($heroMeta);
|
||||
$attrPro1=[];
|
||||
if ($row['hero_lv']>1){
|
||||
$attrPro1 = self::getAttrProByLevel($row,$baseAttr,$attr);
|
||||
}
|
||||
$attrPro2=[];
|
||||
if ($row['quality']>1){
|
||||
$attrPro2 = self::getAttrProByQuality($row,$baseAttr);
|
||||
}
|
||||
$attrPro = self::mergeAttrPro($baseAttr,$attrPro1,$attrPro2);
|
||||
}
|
||||
$skill_common = explode("|",$row['skill_common']);
|
||||
$attr_skill = [];
|
||||
foreach ($skill_common as $val){
|
||||
$item = mt\SkillCommon::getAttrBySkillCommon($val);
|
||||
if ($item){
|
||||
array_push($attr_skill,$item);
|
||||
}
|
||||
}
|
||||
$chipIds = ChipPlugin::getInlayChip($row['token_id']);
|
||||
$attr_chip= Chip::getChipAttr($chipIds)['attr_chip'];
|
||||
$chip_core= Chip::getChipAttr($chipIds)['chip_core'];
|
||||
|
||||
$rand_attr = $baseAttr;
|
||||
if ($attrPro){
|
||||
foreach ($rand_attr as $k=>$value){
|
||||
foreach ($attrPro as $val){
|
||||
if ($val['attr_id'] == $value['attr_id']){
|
||||
$rand_attr[$k]['val'] = $val['val'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($attr_skill){
|
||||
$rand_attr = self::_mergeArr(array_merge($rand_attr,$attr_skill));
|
||||
}
|
||||
if ($attr_chip){
|
||||
$rand_attr = self::_mergeArr(array_merge($rand_attr,$attr_chip));
|
||||
}
|
||||
if ($chip_core){
|
||||
$coreAttr = array();
|
||||
foreach ($chip_core as $value){
|
||||
array_push($coreAttr,array(
|
||||
'attr_id'=>$value['attr_id'],
|
||||
'type'=>$value['attr_add_type'],
|
||||
'val'=>$value['attr_number'],
|
||||
));
|
||||
}
|
||||
$rand_attr = self::_mergeArr(array_merge($rand_attr,$coreAttr));
|
||||
}
|
||||
$heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($row['quality']);
|
||||
$info = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
'hero_uniid' => $row['idx'],
|
||||
'hero_id' => $row['hero_id'],
|
||||
'hero_lv' => $row['hero_lv'],
|
||||
'hero_tili' => $row['hero_tili'],
|
||||
'quality' => $row['quality'],
|
||||
'rand_attr' => $rand_attr,
|
||||
'chip_core' => $chip_core ? $coreAttr : $chip_core,
|
||||
// 'attr_base' => $baseAttr,
|
||||
// 'attr_pro' => $attrPro,
|
||||
// 'attr_skill' => $attr_skill,
|
||||
// 'attr_chip' => Chip::getChipAttr($chipIds)['attr_chip'],
|
||||
// 'chip_core' => Chip::getChipAttr($chipIds)['chip_core'],
|
||||
'current_pvp_get_ceg' => $todayGetGold / 100,
|
||||
'current_pve_get_ceg' => $todayPveGetCeg / 100,
|
||||
'advanced_count' => $row['advanced_count'],
|
||||
'lucky' => strval($heroLucky),
|
||||
'chip_ids' => $chipIds,
|
||||
'chip_strength_sum' => strval(Chip::getChipMaxStrength($chipIds,1)), //计算ceg上限所需参数
|
||||
'skill_points' => $row['skill_points'],
|
||||
);
|
||||
$info['hero_tili_max'] = strval(round(FormulaService::Hero_NFT_Maximum_Physical_Strength($info['quality'],$info['lucky']),3));
|
||||
$info['pvp_ceg_uplimit'] =strval( round(FormulaService::getHeroPvpDailyCegUpLimit($info),2) );
|
||||
$info['pve_ceg_uplimit'] = strval( round(FormulaService::getHeroPveDailyCegUpLimit($info),2) );
|
||||
// return $dto;
|
||||
print_r($info);die;
|
||||
}
|
||||
|
||||
private static function _mergeArr($data){
|
||||
if ($data){
|
||||
$result = array();
|
||||
foreach ($data as $value){
|
||||
$key = $value['attr_id'];
|
||||
if(!isset($result[$key])){
|
||||
$result[$key] = array(
|
||||
'attr_id'=>$value['attr_id'],
|
||||
'type'=>$value['type'],
|
||||
'val'=>$value['val'],
|
||||
);
|
||||
}else{
|
||||
$result[$key]['val'] += $value['val'];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,6 +117,32 @@ class Nft extends BaseModel {
|
||||
return $nftList;
|
||||
}
|
||||
|
||||
public static function getNft1155List($account,$type){
|
||||
|
||||
switch ($type){
|
||||
case 3:{
|
||||
$sql = "select * from t_nft1155 where owner_address=:owner_address and token_id>10000000 and balance>0";
|
||||
};
|
||||
break;
|
||||
case 4:{
|
||||
$sql = "select * from t_nft1155 where owner_address=:owner_address and token_id<10000000 and balance>0";
|
||||
};
|
||||
break;
|
||||
default:{
|
||||
$sql = "";
|
||||
}
|
||||
}
|
||||
$whereKv =array(
|
||||
'owner_address' => $account,
|
||||
);
|
||||
if ($sql){
|
||||
$list = myself()->_getMarketMysql()->execQuery($sql,$whereKv);
|
||||
}else{
|
||||
$list = array();
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
public static function getNft($tokenId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
|
Loading…
x
Reference in New Issue
Block a user