Skip to content

Commit

Permalink
Merge pull request #100 from InfSein/dev
Browse files Browse the repository at this point in the history
Update to v2.1.7
  • Loading branch information
InfSein authored Jan 22, 2025
2 parents 300c0c5 + c2530c6 commit 66eecb1
Show file tree
Hide file tree
Showing 58 changed files with 38,796 additions and 35,540 deletions.
2 changes: 1 addition & 1 deletion docs/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ npm run dev

### Join in development

* **Find Problems**:If you find any errors/problems during use, or have suggestions for optimizing our interface/functionality/logic, please feel free to [new a issue](https://github.com/InfSein/hqhelper-dawntrail/issues/new)
* **Find Problems**:If you find any errors/problems during use, or have suggestions for optimizing our interface/functionality/logic, please feel free to [new a issue](https://github.com/InfSein/hqhelper-dawntrail/issues/new) .
* **Solve Problems**:If you have front-end programming skills, you can initiate a [Pull Request](https://github.com/InfSein/hqhelper-dawntrail/pulls) to join in the development of `HqHelper` through various means. The code may need to comply with general specifications and some additional rules, please refer to our [Wiki](https://github.com/InfSein/hqhelper-dawntrail/wiki) for more details.

### Donate us
Expand Down
13 changes: 11 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hqhelper-dawntrail",
"version": "2.1.6",
"version": "2.1.7",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -18,13 +18,14 @@
"dependencies": {
"@voerkai18n/runtime": "^2.1.13",
"@voerkai18n/vue": "^2.1.13",
"xlsx": "^0.17.0",
"xlsx-style": "^0.8.13",
"file-saver": "^2.0.5",
"lz-string": "^1.5.0",
"vue": "^3.4.38",
"vue-clipboard3": "^2.0.0",
"vue-router": "^4.4.0",
"vuex": "^4.0.2"
"vuex": "^4.0.2",
"xlsx": "^0.17.0",
"xlsx-style": "^0.8.13"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.10.4",
Expand Down
16 changes: 16 additions & 0 deletions public/data/sponsors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"sponsors_gen1": [
"小密峰",
"宁无恨",
"四期重建用的翻车鱼",
"·无言·",
"漫才",
"Sui",
"被joker偷心了",
"临渊羡鱼",
"聪明",
"江月渔火",
"湿宝"
],
"sponsors_gen2": []
}
Binary file added public/ui/fishing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/ui/gathering-limited.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/ui/gathering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hqhelper": "2.1.6",
"hqhelper": "2.1.7",
"electron": "v5a",
"dlink_hqhelper": "~PROXYhttps://github.com/InfSein/hqhelper-dawntrail/releases/download/v~VERSION/static-pages.zip",
"dlink_electron": "~PROXYhttps://github.com/InfSein/hqhelper-dawntrail/releases/download/electron.~VERSION/HqHelper.Setup.exe"
Expand Down
107 changes: 107 additions & 0 deletions scripts/compress-data.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/* eslint-disable no-undef */
const fs = require('fs')
const path = require('path')

console.log('[scripts/compress-data.cjs] Starting data compression...')

const placeNameFullPath = path.resolve(__dirname, '../src/assets/data/unpacks/raw/place-name.full.json')
const placeNamePath = path.resolve(__dirname, '../src/assets/data/unpacks/place-name.json')
const territoryFullPath = path.resolve(__dirname, '../src/assets/data/unpacks/raw/territory.full.json')
const territoryPath = path.resolve(__dirname, '../src/assets/data/unpacks/territory.json')

const placeNameFull = JSON.parse(fs.readFileSync(placeNameFullPath, 'utf8'))
const territoryFull = JSON.parse(fs.readFileSync(territoryFullPath, 'utf8'))

const gatheringItems = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../src/assets/data/unpacks/gathering-item.json'), 'utf8'))
const maps = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../src/assets/data/unpacks/maps.json'), 'utf8'))

console.log('[scripts/compress-data.cjs] Raw data have been loaded.')

// 获取用到的 territories
const territories = []
Object.values(gatheringItems).forEach(item => {
if (item.territory && !territories.includes(item.territory)) {
territories.push(item.territory)
}
})

// 获取用到的 place_ids
const placeIds = []
territories.forEach(territory => {
const territoryData = territoryFull[territory]
if (territoryData?.length > 2) {
const placeId = territoryFull[territory][2]
if (!placeIds.includes(placeId)) {
placeIds.push(placeId)
}
}
})
Object.values(gatheringItems).forEach(item => {
if (item.place && !placeIds.includes(item.place)) {
placeIds.push(item.place)
}
})
Object.values(maps).forEach(map => {
const keys = ['regionId', 'zoneId', 'placeId']
keys.forEach(key => {
if (map?.[key] && !placeIds.includes(map[key])) {
placeIds.push(map[key])
}
})
map?.aetherytes?.forEach(aetheryte => {
if (aetheryte?.placeId && !placeIds.includes(aetheryte.placeId)) {
placeIds.push(aetheryte.placeId)
}
})
})
placeIds.sort((a, b) => a - b)

// 组装压缩后的 territory.json
const territory = {}
for (const territoryId of territories) {
if (!territoryFull[territoryId]) {
console.error(`[scripts/compress-data.cjs] Missing territory for territoryId ${territoryId}`)
} else {
territory[territoryId] = territoryFull[territoryId]
}
}

// 与现存的 territory.json 对比,有变化才执行写入
const originTerritory = JSON.parse(fs.readFileSync(territoryPath, 'utf8'))
const territoryFileChanged = JSON.stringify(territory) !== JSON.stringify(originTerritory)
if (territoryFileChanged) {
console.log('[scripts/compress-data.cjs] territory.json has changed, writing to file...')
fs.writeFileSync(territoryPath, customStringify(territory), 'utf8')
} else {
console.log('[scripts/compress-data.cjs] territory.json has not changed.')
}

// 组装压缩后的 place-name.json
const placeName = {}
for (const placeId of placeIds) {
if (!placeNameFull[placeId]) {
console.error(`[scripts/compress-data.cjs] Missing place name for placeId ${placeId}`)
} else {
placeName[placeId] = placeNameFull[placeId]
}
}

// 与现存的 place-name.json 对比,有变化才执行写入
const originPlaceName = JSON.parse(fs.readFileSync(placeNamePath, 'utf8'))
const placeFileChanged = JSON.stringify(placeName) !== JSON.stringify(originPlaceName)

if (placeFileChanged) {
console.log('[scripts/compress-data.cjs] place-name.json has changed, writing to file...')
fs.writeFileSync(placeNamePath, customStringify(placeName), 'utf8')
} else {
console.log('[scripts/compress-data.cjs] place-name.json has not changed.')
}

/** 自定义输出模式 */
function customStringify(obj) {
const kvps = []
for (const key in obj) {
kvps.push(` "${key}": ${JSON.stringify(obj[key])}`)
}
return `{\n${kvps.join(',\n')}\n}`
}
5 changes: 5 additions & 0 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"scripts": {
"compress-data": "node compress-data.cjs"
}
}
10 changes: 10 additions & 0 deletions scripts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

## 脚本列表

### compress-data.cjs

此脚本用于压缩部分数据文件,目前包括:
* `src\assets\data\unpacks\raw\place-name.full.json`
* `src\assets\data\unpacks\raw\territory.full.json`

其内部逻辑会筛除掉不需要的数据,以减少程序更新包/网页资源体积 (节省量约0.15MB)。

只在更新了解包文件时需要调用,运行 `scripts\package.json` 中的 NPM 脚本 `compress-data` 即可执行。

### update-version.cjs

此脚本用于在本地 `npm i` 时自动更新 `public/version.json` 文件中的 `hqhelper` 版本,以便客户端判别是否需要更新。
Expand Down
4 changes: 4 additions & 0 deletions src/assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
display: flex;
flex-direction: column;
}
.flex-vac {
display: flex;
align-items: center;
}
.flex-center {
display: flex;
justify-content: center;
Expand Down
18 changes: 17 additions & 1 deletion src/assets/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ export const XivTranslatedPlaces = JsonXivTranslatedPlaces as Record<number, str

import JsonXivUnpackedGatheringItems from './unpacks/gathering-item.json'
export const XivUnpackedGatheringItems = JsonXivUnpackedGatheringItems as Record<number, {
level: number
/**
* 采集点类型I
* * 0=採掘,1=砕岩,2=伐採,3=草刈
*/
type: number
/**
* 采集点类型II
* * 1=常规点,2=收藏品,3=工艺馆,4=灵砂,5=传承录
*/
pointType?: number
territory?: number
place?: number
Expand All @@ -44,6 +53,12 @@ export const XivUnpackedGatheringItems = JsonXivUnpackedGatheringItems as Record
end3: string
} | false
coords?: { x: string, y: string }
/**
* 采集点是否需要习得传承录方可采集
* * 为数字时,代表所需传承录的道具ID
* * 为 false 或 undefined 时,代表不需要传承录或缺失数据
*/
folkloreBook?: number | false
}>

import JsonXivUnpackedItems from './unpacks/item.json'
Expand All @@ -58,7 +73,8 @@ export interface XivUnpackedItem {
hq: boolean
dye: number
act: number
bon: number
tradable: boolean
collectable: boolean
reduce: boolean
elv: number
jobs: number
Expand Down
Loading

0 comments on commit 66eecb1

Please sign in to comment.