2022-07-25 18:07:03 +00:00
|
|
|
import fetch from 'node-fetch'
|
|
|
|
import moment from 'moment'
|
2022-10-07 13:13:46 +00:00
|
|
|
import { Character, Material } from '../../models/index.js'
|
2022-09-05 03:48:45 +00:00
|
|
|
import { Data } from '../../components/index.js'
|
2022-07-25 18:07:03 +00:00
|
|
|
import lodash from 'lodash'
|
|
|
|
|
|
|
|
const ignoreIds = [495, // 有奖问卷调查开启!
|
|
|
|
1263, // 米游社《原神》专属工具一览
|
|
|
|
423, // 《原神》玩家社区一览
|
|
|
|
422, // 《原神》防沉迷系统说明
|
|
|
|
762, // 《原神》公平运营声明
|
|
|
|
762 // 《原神》公平运营声明
|
2022-05-07 21:01:18 +00:00
|
|
|
]
|
|
|
|
|
2022-08-22 13:38:34 +00:00
|
|
|
const ignoreReg = /(内容专题页|版本更新说明|调研|防沉迷|米游社|专项意见|更新修复与优化|问卷调查|版本更新通知|更新时间说明|预下载功能|周边限时|周边上新|角色演示)/
|
2022-07-25 18:07:03 +00:00
|
|
|
const fulltimeReg = /(魔神任务)/
|
2022-05-07 21:01:18 +00:00
|
|
|
|
|
|
|
let Cal = {
|
2022-07-25 18:07:03 +00:00
|
|
|
async reqCalData () {
|
|
|
|
let listApi = 'https://hk4e-api.mihoyo.com/common/hk4e_cn/announcement/api/getAnnList?game=hk4e&game_biz=hk4e_cn&lang=zh-cn&bundle_id=hk4e_cn&platform=pc®ion=cn_gf01&level=55&uid=100000000'
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let request = await fetch(listApi)
|
|
|
|
let listData = await request.json()
|
2022-05-20 08:01:46 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let timeMap
|
2022-09-18 20:54:01 +00:00
|
|
|
let timeMapCache = await redis.get('miao:calendar:detail')
|
2022-05-28 21:26:30 +00:00
|
|
|
if (timeMapCache) {
|
2022-07-25 18:07:03 +00:00
|
|
|
timeMap = JSON.parse(timeMapCache) || {}
|
2022-05-20 08:01:46 +00:00
|
|
|
} else {
|
2022-07-25 18:07:03 +00:00
|
|
|
let detailApi = 'https://hk4e-api.mihoyo.com/common/hk4e_cn/announcement/api/getAnnContent?game=hk4e&game_biz=hk4e_cn&lang=zh-cn&bundle_id=hk4e_cn&platform=pc®ion=cn_gf01&level=55&uid=100000000'
|
|
|
|
let request2 = await fetch(detailApi)
|
|
|
|
let detailData = await request2.json()
|
2022-05-20 08:01:46 +00:00
|
|
|
timeMap = {}
|
|
|
|
if (detailData && detailData.data && detailData.data.list) {
|
2022-05-31 21:16:10 +00:00
|
|
|
let versionTime = {
|
2022-07-25 18:07:03 +00:00
|
|
|
2.7: '2022-05-31 11:00:00',
|
2022-08-15 20:54:58 +00:00
|
|
|
2.8: '2022-07-13 11:00:00',
|
|
|
|
3.0: '2022-08-24 11:00:00',
|
|
|
|
3.1: '2022-09-28 11:00:00',
|
|
|
|
3.2: '2022-11-02 11:00:00',
|
|
|
|
3.3: '2022-12-07 11:00:00'
|
2022-07-25 18:07:03 +00:00
|
|
|
}
|
2022-05-20 08:01:46 +00:00
|
|
|
lodash.forEach(detailData.data.list, (ds) => {
|
2022-05-29 02:54:26 +00:00
|
|
|
let vRet = /(\d\.\d)版本更新通知/.exec(ds.title)
|
2022-05-28 21:18:13 +00:00
|
|
|
if (vRet && vRet[1]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
let content = /(?:更新时间)\s*〓([^〓]+)(?:〓|$)/.exec(ds.content)
|
2022-05-29 02:54:26 +00:00
|
|
|
if (content && content[1]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
let tRet = /([0-9\\/\\: ]){9,}/.exec(content[1])
|
2022-05-29 02:54:26 +00:00
|
|
|
if (tRet && tRet[0]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
versionTime[vRet[1]] = versionTime[vRet[1]] || tRet[0].replace('06:00', '11:00')
|
2022-05-29 02:54:26 +00:00
|
|
|
}
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
lodash.forEach(detailData.data.list, (ds) => {
|
2022-07-25 18:07:03 +00:00
|
|
|
let { ann_id: annId, content, title } = ds
|
2022-05-28 21:18:13 +00:00
|
|
|
if (ignoreReg.test(title)) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return true
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-07-25 18:07:03 +00:00
|
|
|
content = content.replace(/(<|<)[\w "%:;=\-\\/\\(\\),\\.]+(>|>)/g, '')
|
|
|
|
content = /(?:活动时间|祈愿介绍|任务开放时间|冒险....包|折扣时间)\s*〓([^〓]+)(〓|$)/.exec(content)
|
2022-05-28 21:18:13 +00:00
|
|
|
if (!content || !content[1]) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return true
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-07-25 18:07:03 +00:00
|
|
|
content = content[1]
|
|
|
|
let annTime = []
|
2022-05-28 21:18:13 +00:00
|
|
|
|
|
|
|
// 第一种简单格式
|
2022-07-25 18:07:03 +00:00
|
|
|
let timeRet = /(?:活动时间)?(?:〓|\s)*([0-9\\/\\: ~]{6,})/.exec(content)
|
2022-05-20 08:01:46 +00:00
|
|
|
if (timeRet && timeRet[1]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
annTime = timeRet[1].split('~')
|
2022-05-28 21:18:13 +00:00
|
|
|
} else if (/\d\.\d版本更新后/.test(content)) {
|
2022-07-25 18:07:03 +00:00
|
|
|
let vRet = /(\d\.\d)版本更新后/.exec(content)
|
|
|
|
let vTime = ''
|
2022-05-28 21:18:13 +00:00
|
|
|
if (vRet && vRet[1] && versionTime[vRet[1]]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
vTime = versionTime[vRet[1]]
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
|
|
|
if (!vTime) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return true
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
|
|
|
if (/永久开放/.test(content)) {
|
2022-07-25 18:07:03 +00:00
|
|
|
annTime = [vTime, '2099/01/01 00:00:00']
|
2022-05-28 21:18:13 +00:00
|
|
|
} else {
|
2022-07-25 18:07:03 +00:00
|
|
|
timeRet = /([0-9\\/\\: ]){9,}/.exec(content)
|
2022-05-28 21:18:13 +00:00
|
|
|
if (timeRet && timeRet[0]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
annTime = [vTime, timeRet[0]]
|
2022-05-20 08:01:46 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
|
|
|
if (annTime.length === 2) {
|
2022-07-25 18:07:03 +00:00
|
|
|
timeMap[annId] = {
|
|
|
|
start: annTime[0].trim().replace(/\//g, '-'),
|
|
|
|
end: annTime[1].trim().replace(/\//g, '-')
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-05-20 08:01:46 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2022-08-22 13:38:34 +00:00
|
|
|
let miaoApi = 'http://miaoapi.cn/api/calendar'
|
|
|
|
try {
|
|
|
|
request2 = await fetch(miaoApi)
|
|
|
|
let data = await request2.json()
|
|
|
|
if (data && data.status === 0 && data.data) {
|
|
|
|
lodash.forEach(data.data, (ds, id) => {
|
|
|
|
timeMap[id] = ds
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2022-09-18 20:54:01 +00:00
|
|
|
await Data.setCacheJSON('miao:calendar:detail', timeMap, 60 * 10)
|
2022-05-20 08:01:46 +00:00
|
|
|
}
|
2022-07-25 18:07:03 +00:00
|
|
|
return { listData, timeMap }
|
2022-05-07 21:01:18 +00:00
|
|
|
},
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
getDateList () {
|
|
|
|
let today = moment()
|
|
|
|
let temp = today.add(-7, 'days')
|
|
|
|
let dateList = []
|
|
|
|
let month = 0
|
|
|
|
let date = []
|
2022-10-06 22:20:46 +00:00
|
|
|
let week = []
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let startDate, endDate
|
2022-05-07 21:01:18 +00:00
|
|
|
|
|
|
|
for (let idx = 0; idx < 13; idx++) {
|
2022-07-25 18:07:03 +00:00
|
|
|
temp = today.add(1, 'days')
|
|
|
|
let m = temp.month() + 1
|
|
|
|
let d = temp.date()
|
2022-05-07 21:01:18 +00:00
|
|
|
if (month === 0) {
|
2022-07-25 18:07:03 +00:00
|
|
|
startDate = temp.format('YYYY-MM-DD')
|
|
|
|
month = m
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
if (month !== m && date.length > 0) {
|
|
|
|
dateList.push({
|
|
|
|
month,
|
2022-10-06 22:20:46 +00:00
|
|
|
date,
|
|
|
|
week
|
2022-05-07 21:01:18 +00:00
|
|
|
})
|
2022-07-25 18:07:03 +00:00
|
|
|
date = []
|
2022-10-06 22:20:46 +00:00
|
|
|
week = []
|
2022-07-25 18:07:03 +00:00
|
|
|
month = m
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
2022-07-25 18:07:03 +00:00
|
|
|
date.push(d)
|
2022-10-06 22:20:46 +00:00
|
|
|
week.push(temp.weekday())
|
2022-05-07 21:01:18 +00:00
|
|
|
if (idx === 12) {
|
|
|
|
dateList.push({
|
|
|
|
month,
|
2022-10-06 22:20:46 +00:00
|
|
|
date,
|
|
|
|
week
|
2022-05-07 21:01:18 +00:00
|
|
|
})
|
2022-07-25 18:07:03 +00:00
|
|
|
endDate = temp.format('YYYY-MM-DD')
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let startTime = moment(startDate + ' 00:00:00')
|
|
|
|
let endTime = moment(endDate + ' 23:59:59')
|
2022-05-07 21:01:18 +00:00
|
|
|
|
|
|
|
let totalRange = endTime - startTime
|
|
|
|
return {
|
|
|
|
dateList,
|
|
|
|
startTime,
|
|
|
|
endTime,
|
|
|
|
totalRange,
|
|
|
|
nowLeft: (moment() - startTime) / totalRange * 100
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-10-06 22:20:46 +00:00
|
|
|
// 深渊日历信息
|
2022-07-25 18:07:03 +00:00
|
|
|
getAbyssCal (s1, e1) {
|
|
|
|
let now = moment()
|
|
|
|
let check = []
|
|
|
|
let f = 'YYYY-MM'
|
|
|
|
let last = now.add(-1, 'M').format(f)
|
|
|
|
let lastM = now.format('MMMM')
|
|
|
|
let curr = now.add(1, 'M').format(f)
|
|
|
|
let currM = now.format('MMMM')
|
|
|
|
let next = now.add(1, 'M').format(f)
|
|
|
|
let nextM = now.format('MMMM')
|
|
|
|
|
|
|
|
check.push([moment(`${last}-16 04:00:00`), moment(`${curr}-01 03:59:59`), lastM + '下半'])
|
|
|
|
check.push([moment(`${curr}-01 04:00:00`), moment(`${curr}-16 03:59:59`), currM + '上半'])
|
|
|
|
check.push([moment(`${curr}-16 04:00:00`), moment(`${next}-01 03:59:59`), currM + '下半'])
|
|
|
|
check.push([moment(`${next}-01 04:00:00`), moment(`${next}-16 03:59:59`), nextM + '上半'])
|
|
|
|
|
|
|
|
let ret = []
|
2022-05-07 21:01:18 +00:00
|
|
|
lodash.forEach(check, (ds) => {
|
2022-07-25 18:07:03 +00:00
|
|
|
let [s2, e2] = ds
|
2022-05-07 21:01:18 +00:00
|
|
|
if ((s2 <= s1 && s1 <= e2) || (s2 <= e1 && e1 <= e2)) {
|
|
|
|
ret.push(ds)
|
|
|
|
}
|
|
|
|
})
|
2022-07-25 18:07:03 +00:00
|
|
|
return ret
|
2022-05-07 21:01:18 +00:00
|
|
|
},
|
|
|
|
|
2022-10-06 22:20:46 +00:00
|
|
|
getCharData (dateList) {
|
|
|
|
let charBirth = {}
|
2022-10-07 13:13:46 +00:00
|
|
|
let charTalent = {}
|
|
|
|
// 初始化生日数据
|
2022-10-06 22:20:46 +00:00
|
|
|
lodash.forEach(dateList, (m) => {
|
|
|
|
lodash.forEach(m.date, (d) => {
|
|
|
|
charBirth[`${m.month}-${d}`] = []
|
|
|
|
})
|
|
|
|
})
|
2022-10-07 13:13:46 +00:00
|
|
|
// 初始化天赋数据
|
|
|
|
let now = moment(new Date())
|
|
|
|
if (now.hour() < 4) {
|
|
|
|
now = now.add(-1, 'days')
|
|
|
|
}
|
|
|
|
let week = now.weekday()
|
|
|
|
Material.forEach('talent', (material) => {
|
|
|
|
let data = material.getData('name,abbr,city,icon,week,cid')
|
|
|
|
data.chars = []
|
|
|
|
charTalent[material.name] = data
|
|
|
|
}, (ds) => ds.star === 4 && (week === 6 || ds.week === week % 3 + 1))
|
|
|
|
// 遍历角色数据
|
2022-10-06 22:20:46 +00:00
|
|
|
Character.forEach((char) => {
|
2022-10-07 13:13:46 +00:00
|
|
|
if (charBirth[char.birth] && (char.isRelease || char.birth !== '1-1')) {
|
|
|
|
charBirth[char.birth].push(char.getData('id,name:sName,star,face'))
|
|
|
|
}
|
|
|
|
let t = char.materials?.talent
|
|
|
|
if (t && charTalent[t] && !char.isTraveler) {
|
|
|
|
let data = char.getData('id,name:sName,star,face')
|
|
|
|
data.weekly = char.getMaterials('weekly')?.icon
|
|
|
|
charTalent[t].chars.push(data)
|
2022-10-06 22:20:46 +00:00
|
|
|
}
|
2022-10-07 13:13:46 +00:00
|
|
|
}, 'official')
|
2022-10-06 22:20:46 +00:00
|
|
|
let charNum = 0
|
|
|
|
lodash.forEach(charBirth, (charList) => {
|
|
|
|
charNum = Math.max(charNum, charList.length)
|
|
|
|
})
|
2022-10-07 13:13:46 +00:00
|
|
|
charTalent = lodash.values(charTalent)
|
|
|
|
charTalent = lodash.sortBy(charTalent, 'cid')
|
|
|
|
lodash.forEach(charTalent, (ds) => {
|
|
|
|
ds.chars = lodash.sortBy(ds.chars, ['star', 'id']).reverse()
|
|
|
|
})
|
|
|
|
return { charBirth, charNum, charTalent }
|
2022-10-06 22:20:46 +00:00
|
|
|
},
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
getList (ds, target, { startTime, endTime, totalRange, now, timeMap = {} }, isAct = false) {
|
|
|
|
let type = isAct ? 'activity' : 'normal'
|
|
|
|
let id = ds.ann_id
|
|
|
|
let title = ds.title
|
|
|
|
let banner = isAct ? ds.banner : ''
|
|
|
|
let extra = { sort: isAct ? 5 : 10 }
|
|
|
|
let detail = timeMap[id] || {}
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-08-22 13:38:34 +00:00
|
|
|
if (ignoreIds.includes(id) || ignoreReg.test(title) || detail.display === false) {
|
2022-09-30 12:20:04 +00:00
|
|
|
return false
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (/神铸赋形/.test(title)) {
|
2022-07-25 18:07:03 +00:00
|
|
|
type = 'weapon'
|
|
|
|
title = title.replace(/(单手剑|双手剑|长柄武器|弓|法器|·)/g, '')
|
|
|
|
extra.sort = 2
|
2022-05-07 21:01:18 +00:00
|
|
|
} else if (/祈愿/.test(title)) {
|
2022-07-25 18:07:03 +00:00
|
|
|
type = 'character'
|
|
|
|
let regRet = /·(.*)\(/.exec(title)
|
2022-05-07 21:01:18 +00:00
|
|
|
if (regRet[1]) {
|
2022-07-25 18:07:03 +00:00
|
|
|
let char = Character.get(regRet[1])
|
2022-09-03 21:08:57 +00:00
|
|
|
extra.banner2 = char.getImgs()?.card
|
|
|
|
extra.face = char.face
|
2022-07-25 18:07:03 +00:00
|
|
|
extra.character = regRet[1]
|
|
|
|
extra.elem = char.elem
|
|
|
|
extra.sort = 1
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
2022-08-22 13:38:34 +00:00
|
|
|
} else if (/纪行/.test(title)) {
|
|
|
|
type = 'pass'
|
|
|
|
} else if (title === '深渊') {
|
|
|
|
type = 'abyss'
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let getDate = (d1, d2) => moment(d1 && d1.length > 6 ? d1 : d2)
|
|
|
|
let sDate = getDate(detail.start, ds.start_time)
|
|
|
|
let eDate = getDate(detail.end, ds.end_time)
|
|
|
|
let sTime = moment.max(sDate, startTime)
|
|
|
|
let eTime = moment.min(eDate, endTime)
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let sRange = sTime - startTime
|
|
|
|
let eRange = eTime - startTime
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let left = sRange / totalRange * 100
|
|
|
|
let width = eRange / totalRange * 100 - left
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let label = ''
|
2022-05-28 21:18:13 +00:00
|
|
|
if (fulltimeReg.test(title) || eDate - sDate > 365 * 24 * 3600 * 1000) {
|
|
|
|
if (sDate < now) {
|
2022-08-22 13:38:34 +00:00
|
|
|
label = sDate.format('MM-DD HH:mm') + ' 后永久有效'
|
|
|
|
} else {
|
|
|
|
label = '永久有效'
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-05-07 21:01:18 +00:00
|
|
|
} else if (now > sDate && eDate > now) {
|
2022-07-25 18:07:03 +00:00
|
|
|
label = eDate.format('MM-DD HH:mm') + ' (' + moment.duration(eDate - now).humanize() + '后结束)'
|
2022-05-07 21:01:18 +00:00
|
|
|
if (width > (isAct ? 38 : 55)) {
|
2022-07-25 18:07:03 +00:00
|
|
|
label = sDate.format('MM-DD HH:mm') + ' ~ ' + label
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
} else if (sDate > now) {
|
2022-07-25 18:07:03 +00:00
|
|
|
label = sDate.format('MM-DD HH:mm') + ' (' + moment.duration(sDate - now).humanize() + '后开始)'
|
2022-05-16 21:32:31 +00:00
|
|
|
} else if (isAct) {
|
2022-07-25 18:07:03 +00:00
|
|
|
label = sDate.format('MM-DD HH:mm') + ' ~ ' + eDate.format('MM-DD HH:mm')
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
target.push({
|
|
|
|
...extra,
|
|
|
|
id,
|
|
|
|
title,
|
|
|
|
type,
|
2022-08-22 13:38:34 +00:00
|
|
|
mergeStatus: ['activity', 'normal'].includes(type) ? 1 : 0,
|
2022-05-07 21:01:18 +00:00
|
|
|
banner,
|
|
|
|
icon: ds.tag_icon,
|
|
|
|
left,
|
|
|
|
width,
|
|
|
|
label,
|
|
|
|
duration: eTime - sTime,
|
2022-07-25 18:07:03 +00:00
|
|
|
start: sDate.format('MM-DD HH:mm'),
|
|
|
|
end: eDate.format('MM-DD HH:mm')
|
|
|
|
})
|
2022-05-07 21:01:18 +00:00
|
|
|
},
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
async get () {
|
|
|
|
moment.locale('zh-cn')
|
|
|
|
let now = moment()
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let { listData, timeMap } = await Cal.reqCalData()
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let dl = Cal.getDateList()
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let list = []
|
|
|
|
let abyss = []
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-05-20 08:01:46 +00:00
|
|
|
lodash.forEach(listData.data.list[1].list, (ds) => Cal.getList(ds, list, { ...dl, now, timeMap }, true))
|
2022-07-25 18:07:03 +00:00
|
|
|
lodash.forEach(listData.data.list[0].list, (ds) => Cal.getList(ds, list, { ...dl, now, timeMap }, false))
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let abyssCal = Cal.getAbyssCal(dl.startTime, dl.endTime)
|
2022-05-07 21:01:18 +00:00
|
|
|
lodash.forEach(abyssCal, (t) => {
|
|
|
|
Cal.getList({
|
|
|
|
title: `「深境螺旋」· ${t[2]}`,
|
2022-07-25 18:07:03 +00:00
|
|
|
start_time: t[0].format('YYYY-MM-DD HH:mm'),
|
|
|
|
end_time: t[1].format('YYYY-MM-DD HH:mm')
|
2022-05-07 21:01:18 +00:00
|
|
|
}, abyss, { ...dl, now }, true)
|
2022-07-25 18:07:03 +00:00
|
|
|
})
|
2022-05-07 21:01:18 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
list = lodash.sortBy(list, ['sort', 'start', 'duration'])
|
2022-05-28 21:18:13 +00:00
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
let charCount = 0
|
|
|
|
let charOld = 0
|
|
|
|
let weaponCount = 0
|
2022-08-22 13:38:34 +00:00
|
|
|
let ret = []
|
2022-05-28 21:18:13 +00:00
|
|
|
lodash.forEach(list, (li) => {
|
2022-07-25 18:07:03 +00:00
|
|
|
if (li.type === 'character') {
|
|
|
|
charCount++
|
|
|
|
li.left === 0 && charOld++
|
|
|
|
li.idx = charCount
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-07-25 18:07:03 +00:00
|
|
|
if (li.type === 'weapon') {
|
|
|
|
weaponCount++
|
|
|
|
li.idx = weaponCount
|
2022-05-28 21:18:13 +00:00
|
|
|
}
|
2022-08-22 13:38:34 +00:00
|
|
|
if (li.mergeStatus === 1) {
|
|
|
|
lodash.forEach(list, (li2) => {
|
|
|
|
if (li2.mergeStatus === 1 && li.left + li.width <= li2.left) {
|
|
|
|
li.mergeStatus = 2
|
|
|
|
li2.mergeStatus = 2
|
|
|
|
ret.push([li, li2])
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (li.mergeStatus !== 2) {
|
|
|
|
li.mergeStatus = 2
|
|
|
|
ret.push([li])
|
|
|
|
}
|
2022-05-28 21:18:13 +00:00
|
|
|
})
|
2022-05-07 21:01:18 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
...dl,
|
2022-10-06 22:20:46 +00:00
|
|
|
...Cal.getCharData(dl.dateList),
|
2022-08-22 13:38:34 +00:00
|
|
|
list: ret,
|
2022-05-07 21:01:18 +00:00
|
|
|
abyss,
|
2022-05-28 21:18:13 +00:00
|
|
|
charMode: `char-${charCount}-${charOld}`,
|
2022-07-25 18:07:03 +00:00
|
|
|
nowTime: now.format('YYYY-MM-DD HH:mm'),
|
|
|
|
nowDate: now.date()
|
2022-05-07 21:01:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-25 18:07:03 +00:00
|
|
|
export default Cal
|