Compare commits

..
14 Commits
Author SHA1 Message Date
GaCy 70ab5fac42 Merge pull request 'fix(showcase): allow card width to adapt to content and capture full dimensions on export' (#2) from test-gay into Main
Reviewed-on: #2
2026-11-01 00:27:04 +07:00
CAtlas0784 dc7d7cadaa fix(showcase): allow card width to adapt to content and capture full dimensions on export 2026-11-01 00:15:23 +07:00
GaCy 8fb7b9c270 Merge pull request 'Test gay' (#1) from test-gay into Main
Reviewed-on: #1
2026-10-31 22:09:07 +07:00
CAtlas0784 c88efd9053 feat: rename GaC / GaC-hkrpg-go to GaCy / GaCy GO in srtool branding and UI 2026-10-31 22:08:36 +07:00
CAtlas0784 a3b722e132 Merge remote-tracking branch 'origin/Main' into test-gay 2026-10-31 22:04:22 +07:00
CAtlas0784 e8dbafb19d feat: support Currency Wars damage reports, King Pom-Pom metadata and CW commands 2026-10-31 21:44:48 +07:00
CAtlas0784 6bb1b18d50 Update dashboard controls and add command argument completion 2026-10-30 15:02:49 +07:00
CAtlas0784 1719781711 Document Vercel URL and camera controls 2026-10-29 00:49:41 +07:00
CAtlas0784 4108cd04b3 Add camera settings and Vercel deployment 2026-10-29 00:13:34 +07:00
CAtlas0784 62a529ef3f feat: select Anomaly Arbitration round 2026-10-25 00:45:23 +07:00
CAtlas0784 feb18074fe feat: add monster settings and AA room selection controls 2026-10-24 19:12:10 +07:00
CAtlas0784 ffd6b2e853 cw cmd and unstuck and more 2026-10-21 16:30:08 +07:00
CAtlas0784 ca5831c928 fix: show memosprite contribution and Other damage category 2026-10-20 00:40:04 +07:00
CAtlas0784 e03e5b1f14 fix: preserve battle slot order and display native damage categories 2026-10-19 19:42:42 +07:00
22 changed files with 3402 additions and 215 deletions

No files matched your search

+5
View File
@@ -16,9 +16,14 @@ Thumbs.db
*.swo
.vscode/
.idea/
__pycache__/
# Local custom configs (environment / machine specific)
config.local.json
config.local.js
.env
.env.local
# Python
__pycache__/
*.py[cod]
+9
View File
@@ -0,0 +1,9 @@
.git
.github
.vercel
node_modules
dist
tools
.env*
config.local.*
*.log
+50 -6
View File
@@ -1,6 +1,14 @@
# GaC-Srtool 🌌
# GaCy-Srtool 🌌
เว็บแอปพลิเคชันแดชบอร์ด (Web Dashboard & Management Tool) สำหรับจัดการข้อมูลตัวละคร, จัดทีม, ปรับแต่งรีลิกส์/กรวยแสง, วิเคราะห์ดาเมจจากการต่อสู้จริง และจัดการไฟล์เซฟ (`freesr-data.json`, `persistent`) ของเซิร์ฟเวอร์ **GaC-hkrpg-go** (และเซิร์ฟเวอร์มาตรฐาน FreeSR)
ใช้งานเว็บได้ที่ [GaCy Srtool บน Vercel](https://gacy-srtool.vercel.app/) เปิดหน้าตั้งค่าเพื่อเชื่อมต่อ SDK ของเซิร์ฟเวอร์ที่ใช้งานอยู่
ในโหมด GaCy หน้า **ตั้งค่าตัวละคร / สวิตช์ระบบพิเศษ** เลือก Freecam หรือ FaceCam และตั้งระยะเริ่มต้นของ FaceCam ได้ หลังบันทึกให้กด Tab ในเกมเพื่อเปิดหรือปิดกล้อง; ลูกกลิ้งปรับระยะชั่วคราวและกลับเป็นค่าที่ตั้งไว้เมื่อเปิดใหม่
## Unstuck / แก้ตัวหมุนค้าง
เมื่อเชื่อมต่อเซิร์ฟเวอร์ GaCy GO ใช้ปุ่ม **Unstuck** ใน GM Command Console หรือพิมพ์ `/unstuck` ได้ เว็บจะรอผลตอบรับจากเกมก่อนแสดงว่าสำเร็จ ต้องเปิดเกมและเชื่อมต่อเซิร์ฟเวอร์อยู่ คำสั่งนี้ปลดการบล็อก UI ระหว่างรอแพ็กเก็ตผ่าน heartbeat โดยไม่ลบเซฟ CW หรือเปลี่ยนแมพ และไม่แทนการแก้ handler ที่ขาด ต้องใช้ SDK server ที่รองรับ `/api/client/unstuck`
เว็บแอปพลิเคชันแดชบอร์ด (Web Dashboard & Management Tool) สำหรับจัดการข้อมูลตัวละคร, จัดทีม, ปรับแต่งรีลิกส์/กรวยแสง, วิเคราะห์ดาเมจจากการต่อสู้จริง และจัดการไฟล์เซฟ (`freesr-data.json`, `persistent`) ของเซิร์ฟเวอร์ **GaCy GO** (และเซิร์ฟเวอร์มาตรฐาน FreeSR)
ทำงานแบบ Client-side 100% สามารถเปิดใช้งานผ่านเบราว์เซอร์ได้ทันทีโดยไม่ต้องติดตั้งโปรแกรมเพิ่มเติม
@@ -56,9 +64,16 @@
- ค้นหารายการจาก Item ID ใน catalog ของ Client ที่เซิร์ฟเวอร์กำลังใช้ พร้อมแก้จำนวนได้หลายรายการก่อนบันทึกครั้งเดียว
- ค่าในช่องที่ว่างใช้ค่าที่เซิร์ฟเวอร์สร้างตามปกติ; ล้างค่าที่เคยกำหนดเองเพื่อกลับไปใช้ค่าเริ่มต้นได้
- การบันทึกแก้เฉพาะจำนวนไอเทมใน `freesr-data.json` ไม่เขียนทับตัวละคร, LC, Relic หรือ Battle Config
- รองรับเฉพาะ GaC-hkrpg-go ผ่าน `/api/inventory/materials`; บันทึกลงไฟล์ทันทีและต้องเข้าเกมใหม่เพื่อโหลด session พร้อมจำนวนที่แก้แล้ว
- รองรับเฉพาะ GaCy GO ผ่าน `/api/inventory/materials`; บันทึกลงไฟล์ทันทีและต้องเข้าเกมใหม่เพื่อโหลด session พร้อมจำนวนที่แก้แล้ว
### 💾 7. จัดการไฟล์เซฟ GaC (Persistent & FreeSR Data)
### 👾 6.1 Monster Setting
- แยก Memory of Chaos, Pure Fiction, Apocalyptic Shadow และ Anomaly Arbitration เพื่อดูชื่อด่าน/มอนสเตอร์ รูป, level และ wave จาก metadata Nanoka ที่ตรงกับ `client_version` ของเซิร์ฟเวอร์และ resource `challenge_data.json` / `resources/StageConfig.json` (อ่านอย่างเดียว); เมื่อ Client เปลี่ยนเวอร์ชัน API จะดึง metadata ของเวอร์ชันนั้นให้อัตโนมัติ โดยไม่ใช้ข้อมูลจากเวอร์ชันอื่น
- เปลี่ยนการเลือกกลุ่ม/ด่านเป็นการ์ด และ Custom Enemy ค้นมอนด้วยชื่อหรือ ID พร้อมรูป/ชื่อจาก Nanoka; พิมพ์ ID เองได้ และแสดงรูปตัวอย่างขนาดใหญ่ขึ้น
- Anomaly Arbitration เป็นโหมด Endgame ที่อ่าน stage จาก resource เช่นเดียวกับโหมดอื่น ไม่ใช่ Custom Enemy; Aha's Help มีแท็บแยกจาก AA
- แก้ Custom Enemy ได้เฉพาะ Golden / Crimson Calyx และต้องเชื่อมต่อ GaCy-Srtool; การกดใช้ stage จาก Client จะล้าง custom waves เพื่อให้กลับไปใช้ resource
- Weekly Boss, Stagnant Shadow, Cavern of Corrosion, Endgame และ Simulated Universe ไม่รับ custom waves จากหน้านี้
### 💾 7. จัดการไฟล์เซฟ GaCy (Persistent & FreeSR Data)
- **ตั้งค่าตัวเอก (ผู้บุกเบิก):** สลับเพศ (Caelus / Stelle) และเปลี่ยนธาตุ (กายภาพ, ไฟ, จินตภาพ, ความจำ)
- **สลับพาธ March 7th:** เลือกระหว่างพาธการอนุรักษ์ (น้ำแข็ง) และพาธล่าสังหาร (จินตภาพ)
- **สวิตช์ระบบพิเศษ Ex-Rank:** จัดการเปิด/ปิดความสามารถพิเศษ Ex-Rank สำหรับตัวละครเฉพาะ (เช่น Jing Yuan, Dan Heng • IL, Acheron)
@@ -102,9 +117,9 @@
---
## 🔗 การเชื่อมต่อกับเซิร์ฟเวอร์ GaC-hkrpg-go
## 🔗 การเชื่อมต่อกับเซิร์ฟเวอร์ GaCy GO
GaC-Srtool สื่อสารกับเซิร์ฟเวอร์ GaC-hkrpg-go ผ่าน REST API:
GaCy-Srtool สื่อสารกับเซิร์ฟเวอร์ GaCy GO ผ่าน REST API:
| Endpoint | Method | คำอธิบาย |
| --- | --- | --- |
@@ -122,6 +137,8 @@ GaC-Srtool สื่อสารกับเซิร์ฟเวอร์ GaC-h
### บันทึกตัวละครและ Traces
Damage Analyst เรียงการ์ดตาม `report.avatars[].slot` จาก Battle จริง ไม่เปลี่ยนตามทีมหน้าโลก รายงานเก่าที่ไม่มี slot คงลำดับเดิม และแสดงประเภทดาเมจเพิ่มเติมที่ API ส่งมา เช่น Elation Damage / True Damage ทดสอบลำดับด้วย `node --test tests/damage-order.test.cjs` ข้อมูลสดต้องใช้ SDK และ `damage_analyst_live.lua` ฉบับที่อ่าน StatisticsComponent ของ Battle ปัจจุบัน
การบันทึกจากหน้ารายละเอียดส่งข้อมูลตัวละครทั้งชุดผ่าน `/api/freesr` ในคำขอเดียว รวมถึง `data.skills` และ `data.skills_by_anchor_type` สำหรับ Traces เพื่อไม่ให้ server sync ข้อมูลระดับ/Eidolon ระหว่างทางก่อนข้อมูล Trace จะถูกบันทึก `saveAvatarDetails(closeModal = true)` ยังรองรับการเรียกจากปุ่ม build ที่ไม่ต้องปิดหน้าต่าง ถ้า server ตอบผิดพลาดจะแสดงข้อความบันทึกไม่สำเร็จแทนการแจ้งว่าสำเร็จ
### ข้อมูล Build และแหล่งที่มา
@@ -129,3 +146,30 @@ GaC-Srtool สื่อสารกับเซิร์ฟเวอร์ GaC-h
หน้า **รายละเอียดตัวละคร → แนวทางบิลด์** แสดงอุปกรณ์และออฟหลักที่พบบ่อยในตัวอย่าง Endgame จากข้อมูลที่แสดงบน Prydwen โดยใส่โหมด/จำนวนผู้เล่นและวันที่เก็บ snapshot ไว้กำกับ ตัวเลขเป็นสัดส่วนการใช้งานในกลุ่มตัวอย่าง ไม่ใช่คะแนนจัดอันดับหรือคำแนะนำทางการ ตัวละครที่ snapshot ไม่มีตัวอย่างจะแสดงลิงก์ไปคู่มือของ Prydwen แทนการแสดงข้อมูลสำรองที่อาจทำให้เข้าใจผิด
ข้อมูลที่สร้างไว้ใน `js/build-guides-data.js` ใช้ชุดข้อมูล MIT จาก [LvlUrArti/MocDataProcessed](https://huggingface.co/datasets/LvlUrArti/MocDataProcessed) ซึ่งระบุว่าเป็นข้อมูลที่ประมวลผลจากเว็บไซต์ Prydwen โปรดให้เครดิต LvlUrArti เมื่อเผยแพร่หรือวิเคราะห์ข้อมูลต่อ สามารถอัปเดต snapshot ด้วย `npm run sync-build-guides` ได้ โดยสคริปต์จะเลือกเวอร์ชันล่าสุดที่มีใน dataset และจับคู่ตัวละครตาม ID จาก `js/avatars-data.js`.
### Item Book
The **Item Book** scans the pinned game-data revision for every `ItemConfig`-named table that contains item-definition rows. In this revision, 26 candidate tables were checked and 18 supplied item rows: 5,472 rows resolve to 5,414 unique item IDs. The **GaCy supported** badge is derived from the Go server's `InventoryItemConfig.json`; other entries are browse-only.
Click an item's image to open its details, including its ID, source table, type, game description, and a quantity selector. The selected quantity is local to the dialog and does not call the server or add an item. Where the game table defines `PileLimit`, the selector uses it as the maximum.
Names and descriptions come from the pinned game TextMap and StarRailRes indexes for all 13 Srtool languages. At this revision, 5,150 of 5,414 item names have source-localized text; missing source names fall back to English or the item ID. Icons load from the pinned StarRailRes revision: 5,261 entries have a verified image file, while the remaining 153 retain their original game icon paths and show the missing-image state. The installed client stores these missing images inside encrypted `.block` bundles, so they are not extracted by this catalog builder.
Regenerate `assets/item-catalog.json` from the inventory catalog revision used by the Go server:
```bash
python tools/build-item-catalog.py --inventory-config <path-to-GaC-hkrpg-go>/resources/InventoryItemConfig.json
```
## CW GM commands
In the connected GM Console: `/cw status`, `/cw gold <total>`, `/cw hp <total>`. Values affect only the active CW run. Changes are queued and applied during Preparation; they wait while fighting. Gold sets the total, rather than adding repeatedly. HP must fit the run limit. Check the server's `CW_GM applied` log or query status to confirm application. Commands are also included in console suggestions and `/help`.
## ตัวช่วยคำสั่ง GM
ช่อง Console แสดง preview คำสั่งและอธิบาย argument ที่กำลังพิมพ์ รองรับคำสั่ง GM, `/unstuck`, `/faketime` และคำสั่งย่อย `/cw` ทุกแบบใน SDK ปัจจุบัน ใช้ ↑/↓ เลื่อนรายการ, Tab เติมค่าที่เลือกและไปช่องถัดไป, Shift+Tab ย้อนรายการ และ Esc ปิดรายการ คลิกรายการเพื่อเติมค่าได้; Tab ไม่ส่งคำสั่ง ให้กด Enter หรือ Run เพื่อส่ง
พิมพ์ชื่อหรือ ID เพื่อกรองตัวละคร รายการไอเท็ม/Plane/Floor/ของ CW มาจาก `GET /api/command-completions` ของ SDK จึงต้องเชื่อมต่อ SDK ฉบับที่รองรับก่อน รายการดาวของ CW กรองตาม Role ที่เลือก รองรับการแก้ argument กลางบรรทัดโดยเก็บข้อความช่องอื่นไว้
ตรวจตัวช่วยแบบไม่รันคำสั่งเกม: `node --test tools/command-assistant.test.mjs`
+1
View File
@@ -0,0 +1 @@
{"source":{"gameRepository":"https://gitlab.com/Dimbreath/turnbasedgamedata","gameRevision":"312b4597691e0a29cf9828a15b592757dba86949","candidateTables":26,"gameTables":["ExcelOutput/ActivityItemConfigAvatar.json","ExcelOutput/ActivityItemConfigAvatarLD.json","ExcelOutput/ItemConfig.json","ExcelOutput/ItemConfigAvatar.json","ExcelOutput/ItemConfigAvatarLD.json","ExcelOutput/ItemConfigAvatarPlayerIcLD.json","ExcelOutput/ItemConfigAvatarPlayerIcon.json","ExcelOutput/ItemConfigAvatarRank.json","ExcelOutput/ItemConfigAvatarRankLD.json","ExcelOutput/ItemConfigAvatarSkin.json","ExcelOutput/ItemConfigBadge.json","ExcelOutput/ItemConfigBook.json","ExcelOutput/ItemConfigDisk.json","ExcelOutput/ItemConfigEquipment.json","ExcelOutput/ItemConfigLD.json","ExcelOutput/ItemConfigPlayerRoomDynamic.json","ExcelOutput/ItemConfigRelic.json","ExcelOutput/ItemConfigTrainDynamic.json"],"tableScan":[{"table":"ExcelOutput/ActivityItemConfigAvatar.json","rows":19,"itemRows":19},{"table":"ExcelOutput/ActivityItemConfigAvatarLD.json","rows":6,"itemRows":6},{"table":"ExcelOutput/AvatarExpItemConfig.json","rows":3,"itemRows":0},{"table":"ExcelOutput/EquipmentExpItemConfig.json","rows":3,"itemRows":0},{"table":"ExcelOutput/EventMuseumItemConfig.json","rows":18,"itemRows":0},{"table":"ExcelOutput/GMAccountItemConfig.json","rows":0,"itemRows":0},{"table":"ExcelOutput/ItemConfig.json","rows":2941,"itemRows":2941},{"table":"ExcelOutput/ItemConfigAvatar.json","rows":99,"itemRows":99},{"table":"ExcelOutput/ItemConfigAvatarLD.json","rows":4,"itemRows":4},{"table":"ExcelOutput/ItemConfigAvatarPlayerIcLD.json","rows":4,"itemRows":4},{"table":"ExcelOutput/ItemConfigAvatarPlayerIcon.json","rows":94,"itemRows":94},{"table":"ExcelOutput/ItemConfigAvatarRank.json","rows":94,"itemRows":94},{"table":"ExcelOutput/ItemConfigAvatarRankLD.json","rows":4,"itemRows":4},{"table":"ExcelOutput/ItemConfigAvatarSkin.json","rows":8,"itemRows":8},{"table":"ExcelOutput/ItemConfigAvatarTest.json","rows":70,"itemRows":0},{"table":"ExcelOutput/ItemConfigAvatarTestRank.json","rows":65,"itemRows":0},{"table":"ExcelOutput/ItemConfigBadge.json","rows":21,"itemRows":21},{"table":"ExcelOutput/ItemConfigBook.json","rows":762,"itemRows":762},{"table":"ExcelOutput/ItemConfigDisk.json","rows":272,"itemRows":272},{"table":"ExcelOutput/ItemConfigEquipment.json","rows":170,"itemRows":170},{"table":"ExcelOutput/ItemConfigLD.json","rows":69,"itemRows":69},{"table":"ExcelOutput/ItemConfigPlayerRoomDynamic.json","rows":79,"itemRows":79},{"table":"ExcelOutput/ItemConfigRelic.json","rows":774,"itemRows":774},{"table":"ExcelOutput/ItemConfigTrainDynamic.json","rows":52,"itemRows":52},{"table":"ExcelOutput/MessageItemConfig.json","rows":13779,"itemRows":0},{"table":"ExcelOutput/RestaurantShopItemConfig.json","rows":6,"itemRows":0}],"assetRepository":"Mar-7th/StarRailRes","assetRevision":"dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487","assetBaseUrl":"https://cdn.jsdelivr.net/gh/Mar-7th/StarRailRes@dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487/","assetFallbackBaseUrl":"https://raw.githubusercontent.com/Mar-7th/StarRailRes/dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487/","languages":["th","en","zh-CN","zh-TW","ja","ko","vi","id","es","fr","de","ru","pt"],"notes":"Includes every ItemConfig table with item-definition rows at the pinned game-data revision. Items absent from InventoryItemConfig are browse-only; the catalog does not add or summon items. Icons use only files present in the pinned public StarRailRes tree. gameIconPaths retain the source paths for items without a mapped public icon."},"counts":{"total":5414,"definitionRows":5472,"uniqueIds":5414,"supported":3550,"withImages":5261,"withoutConfiguredImage":153,"withDescriptions":4647,"nameCoverageByLanguage":{"th":5150,"en":5150,"zh-CN":5150,"zh-TW":5150,"ja":5150,"ko":5150,"vi":5150,"id":5150,"es":5150,"fr":5150,"de":5150,"ru":5150,"pt":5150},"descriptionCoverageByLanguage":{"th":3080,"en":3080,"zh-CN":3080,"zh-TW":3080,"ja":3080,"ko":3080,"vi":3080,"id":3080,"es":3080,"fr":3080,"de":3080,"ru":3080,"pt":3080},"backgroundDescriptionCoverageByLanguage":{"th":4328,"en":4328,"zh-CN":4328,"zh-TW":4328,"ja":4328,"ko":4328,"vi":4328,"id":4328,"es":4328,"fr":4328,"de":4328,"ru":4328,"pt":4328},"candidateTables":26,"definitionTables":18},"items":[{"id":1,"category":"item","type":"Virtual","subType":"Virtual","rarity":5,"names":{"th":"Stellar Jade","en":"Stellar Jade","zh-CN":"星琼","zh-TW":"星瓊","ja":"星玉","ko":"성옥","vi":"Ngọc Ánh Sao","id":"Stellar Jade","es":"Jade estelar","fr":"Jade stellaire","de":"Stellare Jade","ru":"Звёздный нефрит","pt":"Jade Estelar"},"descriptions":{},"backgroundDescriptions":{"th":"ประกายแสงอันล้ำค่าพุ่งผ่านท้องฟ้ายามราตรีราวกับดาวตก คว้าเอาไว้ก่อนที่มันจะดับสูญ บางทีอาจจะใช้แลกเป็นบางสิ่งไLine truncated
+217
View File
@@ -0,0 +1,217 @@
.item-catalog-toolbar {
display: flex;
align-items: center;
gap: .65rem;
flex-wrap: wrap;
margin-top: 1rem;
}
.item-catalog-toolbar .form-input { flex: 1 1 260px; min-width: 200px; }
.item-catalog-toolbar .form-select { flex: 0 1 230px; min-width: 190px; }
.item-catalog-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
gap: .75rem;
}
.item-catalog-card {
min-width: 0;
display: grid;
grid-template-columns: 68px minmax(0, 1fr);
align-items: center;
gap: .8rem;
padding: .8rem;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
transition: border-color .15s ease, background .15s ease;
}
.item-catalog-card:hover {
border-color: rgba(56, 189, 248, .45);
background: var(--bg-card-hover);
}
.item-catalog-art {
width: 68px;
height: 68px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: .15rem;
overflow: hidden;
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
background: rgba(255, 255, 255, .035);
}
.item-catalog-art-button {
padding: 0;
border: 0;
border-radius: var(--radius-sm);
background: transparent;
cursor: pointer;
}
.item-catalog-art-button:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 3px; }
.item-catalog-art-button:hover .item-catalog-art { border-color: var(--accent-gold); transform: translateY(-1px); }
.item-catalog-image {
width: 62px;
height: 62px;
object-fit: contain;
}
.item-catalog-art-missing {
color: var(--text-muted);
text-align: center;
padding: .2rem;
}
.item-catalog-art-missing span { font-size: 1.25rem; line-height: 1; color: var(--accent-cyan); }
.item-catalog-art-missing small { font-size: .55rem; line-height: 1.1; }
.item-catalog-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
.item-catalog-name {
max-width: 100%;
color: var(--text-primary);
font-size: .84rem;
line-height: 1.25;
font-weight: 750;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow-wrap: anywhere;
}
.item-catalog-id { color: var(--accent-cyan); font: 700 .75rem/1.2 monospace; }
.item-catalog-details {
max-width: 100%;
color: var(--text-muted);
font-size: .65rem;
line-height: 1.2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-catalog-support {
margin-top: .12rem;
padding: .14rem .4rem;
border-radius: 999px;
font-size: .59rem;
line-height: 1.25;
font-weight: 750;
}
.item-catalog-support.is-supported { color: #34d399; background: rgba(16, 185, 129, .12); }
.item-catalog-support.is-browse-only { color: #fbbf24; background: rgba(245, 158, 11, .11); }
.item-catalog-empty { grid-column: 1 / -1; padding: 2rem 1rem; text-align: center; color: var(--text-muted); }
.item-catalog-pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: .75rem;
padding: .75rem 1rem;
border-top: 1px solid var(--border-color);
}
@media (max-width: 540px) {
.item-catalog-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.item-catalog-toolbar .form-select { flex: 1 1 100%; }
}
.inventory-mode-switch {
display: flex;
gap: .5rem;
margin-bottom: 1rem;
padding: .35rem;
width: fit-content;
max-width: 100%;
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
background: var(--bg-secondary);
}
.inventory-mode-btn {
border: 1px solid transparent;
border-radius: var(--radius-sm);
padding: .55rem .85rem;
color: var(--text-muted);
background: transparent;
font: inherit;
font-size: .8rem;
font-weight: 750;
cursor: pointer;
}
.inventory-mode-btn:hover { color: var(--text-primary); }
.inventory-mode-btn.active {
color: var(--accent-cyan);
background: rgba(56, 189, 248, .1);
border-color: rgba(56, 189, 248, .25);
}
.inventory-mode-panel[hidden] { display: none !important; }
.item-catalog-dialog {
width: min(660px, calc(100vw - 2rem));
max-width: none;
max-height: min(86vh, 760px);
padding: 0;
color: var(--text-primary);
border: 1px solid rgba(244, 190, 86, .45);
border-radius: 14px;
background: linear-gradient(145deg, #202333, #11141f 68%);
box-shadow: 0 24px 90px rgba(0, 0, 0, .72), 0 0 36px rgba(244, 190, 86, .09);
}
.item-catalog-dialog::backdrop { background: rgba(4, 6, 14, .78); backdrop-filter: blur(5px); }
.item-catalog-detail-shell { overflow: auto; max-height: min(86vh, 760px); }
.item-catalog-detail-header,
.item-catalog-detail-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: .8rem;
padding: .85rem 1rem;
background: rgba(255, 255, 255, .035);
}
.item-catalog-detail-header { color: var(--accent-gold); font-weight: 800; border-bottom: 1px solid var(--border-color); }
.item-catalog-dialog-close {
width: 2rem;
height: 2rem;
border: 1px solid var(--border-color);
border-radius: 50%;
color: var(--text-primary);
background: rgba(255, 255, 255, .06);
font-size: 1.3rem;
line-height: 1;
cursor: pointer;
}
.item-catalog-detail-body { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: 1rem; padding: 1.15rem; }
.item-catalog-detail-art {
width: 144px;
height: 144px;
display: grid;
place-items: center;
align-self: start;
overflow: hidden;
border: 1px solid rgba(244, 190, 86, .38);
border-radius: 12px;
background: radial-gradient(circle, rgba(244, 190, 86, .13), rgba(255, 255, 255, .03) 70%);
color: var(--text-muted);
text-align: center;
font-size: .8rem;
}
.item-catalog-detail-art img { width: 90%; height: 90%; object-fit: contain; }
.item-catalog-detail-copy { min-width: 0; }
.item-catalog-detail-copy h2 { margin: .05rem 0 .35rem; font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; }
.item-catalog-detail-id { color: var(--accent-cyan); font: 700 .78rem/1.3 monospace; }
.item-catalog-detail-source { margin-top: .25rem; color: var(--text-muted); font-size: .66rem; line-height: 1.35; overflow-wrap: anywhere; }
.item-catalog-detail-meta { margin-top: .5rem; color: var(--accent-gold); font-size: .78rem; line-height: 1.5; }
.item-catalog-detail-section { margin-top: .85rem; }
.item-catalog-detail-section h3 { margin: 0 0 .3rem; color: var(--text-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.item-catalog-detail-description,
.item-catalog-detail-lore { color: #e1e4ee; font-size: .83rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.item-catalog-detail-quantity { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.15rem; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.item-catalog-detail-quantity > label { color: var(--text-primary); font-size: .82rem; font-weight: 750; }
.item-catalog-amount-stepper { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--border-color); border-radius: 8px; background: rgba(0, 0, 0, .22); }
.item-catalog-amount-stepper button { width: 2.2rem; height: 2.2rem; border: 0; color: var(--accent-gold); background: transparent; font-size: 1.25rem; cursor: pointer; }
.item-catalog-amount-stepper button:hover { background: rgba(244, 190, 86, .12); }
.item-catalog-amount-stepper input { width: 5.2rem; height: 2.2rem; border: 0; border-right: 1px solid var(--border-color); border-left: 1px solid var(--border-color); outline: 0; color: var(--text-primary); background: transparent; text-align: center; font: 700 .95rem/1 monospace; }
.item-catalog-amount-limit { color: var(--text-muted); font-size: .72rem; }
.item-catalog-detail-footer { justify-content: flex-end; }
.item-catalog-detail-lore[hidden] { display: none !important; }
@media (max-width: 480px) {
.inventory-mode-switch { width: 100%; }
.inventory-mode-btn { flex: 1; padding-inline: .45rem; }
}
@media (max-width: 520px) {
.item-catalog-detail-body { grid-template-columns: 88px minmax(0, 1fr); gap: .75rem; padding: .85rem; }
.item-catalog-detail-art { width: 88px; height: 88px; }
.item-catalog-detail-quantity { flex-wrap: wrap; gap: .55rem; }
}
+385 -1
View File
@@ -233,6 +233,11 @@ body {
margin: 0 auto;
}
/* Give the stage browser the full available width when it is active. */
.main-container:has(#tab-monster-settings.active) {
max-width: none;
}
.tab-content {
display: none;
animation: fadeIn 0.25s ease-out;
@@ -845,6 +850,202 @@ body {
border-color: rgba(99, 120, 160, 0.45);
}
/* Aha's Help level picker */
.aha-help-card {
position: relative;
display: flex;
flex-direction: column;
gap: 1.1rem;
margin: 0.25rem 0 1rem;
padding: clamp(1rem, 2.2vw, 1.5rem);
border: 1px solid rgba(245, 180, 75, 0.28);
border-radius: 18px;
background:
radial-gradient(ellipse at 100% 0, rgba(245, 158, 11, 0.09), transparent 42%),
linear-gradient(145deg, rgba(25, 29, 42, 0.96), rgba(15, 19, 30, 0.96));
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.aha-help-heading {
display: flex;
align-items: flex-start;
gap: 1rem;
}
.aha-help-emblem {
display: grid;
place-items: center;
flex: 0 0 48px;
width: 48px;
height: 48px;
border: 1px solid rgba(251, 191, 36, 0.4);
border-radius: 15px;
background: linear-gradient(145deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.06));
color: #fcd34d;
font-size: 1.65rem;
text-shadow: 0 0 16px rgba(251, 191, 36, 0.55);
}
.aha-help-heading-copy {
min-width: 0;
}
.aha-help-eyebrow {
margin: 0 0 0.3rem;
color: #fbbf24;
font-size: 0.68rem;
font-weight: 800;
letter-spacing: 0.12em;
}
.aha-help-heading h3 {
margin: 0;
color: var(--text-highlight);
font-size: clamp(1.1rem, 2vw, 1.35rem);
line-height: 1.25;
}
.aha-help-heading p {
max-width: 760px;
margin: 0.4rem 0 0;
color: var(--text-muted);
font-size: 0.9rem;
line-height: 1.55;
}
.aha-help-options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
gap: 0.75rem;
}
.aha-help-option {
position: relative;
display: flex;
min-width: 0;
min-height: 112px;
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 0.45rem;
padding: 1rem 2.4rem 1rem 1rem;
border: 1px solid rgba(110, 123, 148, 0.28);
border-radius: 13px;
background: rgba(9, 13, 22, 0.62);
color: var(--text-main);
text-align: left;
cursor: pointer;
transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.aha-help-option:hover {
transform: translateY(-2px);
border-color: rgba(251, 191, 36, 0.55);
background: rgba(32, 34, 42, 0.92);
}
.aha-help-option:focus-visible {
outline: 3px solid rgba(56, 189, 248, 0.8);
outline-offset: 2px;
}
.aha-help-option.is-selected {
border-color: rgba(251, 191, 36, 0.88);
background: linear-gradient(145deg, rgba(120, 82, 22, 0.34), rgba(37, 31, 27, 0.82));
box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.18), 0 8px 24px rgba(0, 0, 0, 0.17);
}
.aha-help-option[data-kind="off"].is-selected {
border-color: rgba(148, 163, 184, 0.7);
background: linear-gradient(145deg, rgba(71, 85, 105, 0.3), rgba(24, 29, 40, 0.88));
box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.15);
}
.aha-help-option-title {
color: var(--text-highlight);
font-size: 1.05rem;
font-weight: 800;
line-height: 1.25;
}
.aha-help-option-detail {
color: var(--text-muted);
font-size: 0.82rem;
line-height: 1.45;
}
.aha-help-option-check {
position: absolute;
top: 0.8rem;
right: 0.85rem;
display: grid;
width: 25px;
height: 25px;
place-items: center;
border: 1px solid rgba(148, 163, 184, 0.28);
border-radius: 50%;
color: transparent;
font-size: 0.8rem;
font-weight: 900;
}
.aha-help-option.is-selected .aha-help-option-check {
border-color: #fbbf24;
background: #fbbf24;
color: #171717;
}
.aha-help-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-top: 0.15rem;
}
.aha-help-save-state {
display: inline-flex;
min-width: 0;
align-items: center;
gap: 0.6rem;
color: var(--text-muted);
font-size: 0.86rem;
line-height: 1.45;
}
.aha-help-state-dot {
flex: 0 0 9px;
width: 9px;
height: 9px;
border-radius: 50%;
background: #94a3b8;
box-shadow: 0 0 9px currentColor;
}
.aha-help-save-state[data-state="saved"] .aha-help-state-dot { background: #34d399; }
.aha-help-save-state[data-state="unsaved"] .aha-help-state-dot { background: #fbbf24; }
.aha-help-save-state[data-state="error"] .aha-help-state-dot { background: #fb7185; }
.aha-help-save-state[data-state="unavailable"] .aha-help-state-dot { background: #94a3b8; }
.aha-help-save-button {
display: inline-flex;
min-height: 46px;
align-items: center;
justify-content: center;
gap: 0.55rem;
padding: 0.7rem 1.15rem;
white-space: nowrap;
}
.aha-help-native-select {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.switch {
position: relative;
display: inline-block;
@@ -903,6 +1104,11 @@ input:checked + .slider:before {
letter-spacing: 0.05em;
}
#btn-save-aha-help:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.form-input, .form-select {
width: 100%;
padding: 0.65rem 0.85rem;
@@ -1350,7 +1556,7 @@ input:checked + .slider:before {
Modal Avatar Detail Widescreen Expansion
========================================================================== */
#modal-avatar-detail .modal-content {
max-width: 980px !important;
max-width: 1120px !important;
width: 96% !important;
max-height: 92vh !important;
overflow-y: auto !important;
@@ -3390,4 +3596,182 @@ input:checked + .slider:before {
.build-guide-stat-grid {
grid-template-columns: minmax(0, 1fr);
}
.aha-help-actions {
align-items: stretch;
flex-direction: column;
}
.aha-help-save-button {
width: 100%;
}
}
@media (max-width: 390px) {
.aha-help-options {
grid-template-columns: minmax(0, 1fr);
}
.aha-help-heading {
gap: 0.7rem;
}
.aha-help-emblem {
flex-basis: 40px;
width: 40px;
height: 40px;
}
}
/* Anomaly Arbitration monster wave editor */
.monster-settings-intro { margin-bottom: 1rem; }
.monster-settings-rule { display: flex; gap: .65rem; align-items: flex-start; margin-top: .8rem; padding: .8rem 1rem; border: 1px solid rgba(251, 191, 36, .28); border-radius: 10px; background: rgba(245, 158, 11, .08); color: var(--text-main); line-height: 1.55; }
.monster-settings-tabs { display: flex; gap: .5rem; margin: 1rem 0; padding: .45rem; overflow-x: auto; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-secondary); }
.monster-settings-tab { flex: 1 0 auto; min-height: 44px; padding: .65rem .9rem; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-muted); font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.monster-settings-tab:hover { color: var(--text-main); background: rgba(148, 163, 184, .08); }
.monster-settings-tab.active { color: var(--text-highlight); border-color: rgba(56, 189, 248, .36); background: rgba(14, 165, 233, .13); }
.monster-settings-tab-aha.active { color: #fcd34d; border-color: rgba(251, 191, 36, .45); background: rgba(245, 158, 11, .12); }
.monster-settings-status { margin: .75rem 0; padding: .8rem 1rem; border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-muted); background: var(--bg-card); line-height: 1.5; }
.monster-settings-status[data-state="saved"] { color: #6ee7b7; }
.monster-settings-status[data-state="error"] { color: #fda4af; }
.monster-settings-status[data-state="loading"] { color: #7dd3fc; }
.monster-settings-view { display: grid; gap: 1rem; }
.monster-settings-picker-section { display: grid; gap: .65rem; }
.monster-settings-picker-title { margin: 0; color: var(--text-muted); font-size: .88rem; font-weight: 800; letter-spacing: .02em; }
.monster-settings-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: .75rem; }
.monster-settings-group-card { display: flex; min-width: 0; min-height: 78px; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem .85rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); color: var(--text-main); text-align: left; cursor: pointer; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.monster-settings-group-card:hover, .monster-settings-stage-card:hover { transform: translateY(-1px); border-color: rgba(56, 189, 248, .45); background: rgba(25, 35, 51, .95); }
.monster-settings-group-card.active { border-color: rgba(56, 189, 248, .72); background: linear-gradient(125deg, rgba(14, 165, 233, .16), rgba(15, 23, 42, .9)); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .1); }
.monster-settings-group-copy, .monster-settings-stage-copy { display: grid; gap: .3rem; min-width: 0; }
.monster-settings-group-name { color: var(--text-main); font-size: .91rem; line-height: 1.3; overflow-wrap: anywhere; }
.monster-settings-group-meta, .monster-settings-stage-meta { color: var(--text-muted); font-size: .75rem; line-height: 1.3; }
.monster-settings-monster.group-feature { flex: 0 0 56px; width: 56px; padding: 0; border: 0; background: transparent; }
.monster-settings-monster.group-feature .monster-settings-monster-portrait { width: 56px; height: 56px; flex-basis: 56px; }
.monster-settings-monster.group-feature .monster-settings-monster-copy { display: none; }
.monster-settings-stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: .75rem; }
.monster-settings-stage-card { display: flex; min-width: 0; min-height: 144px; align-items: center; gap: .9rem; padding: .85rem; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card); color: var(--text-main); text-align: left; cursor: pointer; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.monster-settings-stage-card.active { border-color: rgba(56, 189, 248, .76); background: linear-gradient(125deg, rgba(14, 165, 233, .16), rgba(15, 23, 42, .94)); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .12); }
.monster-settings-stage-card.is-boss { border-color: rgba(251, 191, 36, .3); }
.monster-settings-stage-card.is-boss.active { border-color: rgba(251, 191, 36, .78); background: linear-gradient(125deg, rgba(245, 158, 11, .16), rgba(15, 23, 42, .94)); }
.monster-settings-stage-card:focus-visible, .monster-settings-group-card:focus-visible { outline: 2px solid rgba(56, 189, 248, .75); outline-offset: 2px; }
.monster-settings-monster.stage-feature { flex: 0 0 92px; width: 92px; flex-direction: column; align-items: center; padding: 0; border: 0; background: transparent; }
.monster-settings-monster.stage-feature .monster-settings-monster-portrait { width: 88px; height: 88px; flex-basis: 88px; border-radius: 12px; }
.monster-settings-monster.stage-feature .monster-settings-monster-copy { display: none; }
.monster-settings-stage-copy { flex: 1; }
.monster-settings-stage-copy strong { color: var(--text-main); font-size: .92rem; line-height: 1.28; overflow-wrap: anywhere; }
.monster-settings-stage-card.is-boss .monster-settings-stage-meta:first-of-type { color: #fcd34d; }
.monster-settings-view[hidden] { display: none; }
.monster-aa-round-control { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr); align-items: center; gap: 1.25rem; padding: 1rem 1.1rem; border: 1px solid rgba(56, 189, 248, .28); border-radius: 14px; background: linear-gradient(120deg, rgba(14, 165, 233, .1), rgba(15, 23, 42, .72)); }
.monster-aa-round-header { display: grid; gap: .6rem; min-width: 0; }
.monster-aa-round-copy h3 { margin: 0; color: var(--text-highlight); font-size: 1rem; }
.monster-aa-round-copy p { margin: .35rem 0 0; color: var(--text-muted); line-height: 1.5; }
.monster-aa-round-status { color: var(--text-muted); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.monster-aa-round-status.is-pending { color: #86efac; }
.monster-aa-round-status.is-error { color: #fda4af; }
.monster-aa-round-picker-wrap { display: grid; gap: .5rem; min-width: 0; }
.monster-aa-round-picker-label { color: var(--text-muted); font-size: .82rem; font-weight: 800; }
.monster-aa-round-picker { min-height: 46px; width: 100%; }
.monster-aa-round-picker:disabled { opacity: .55; cursor: not-allowed; }
.monster-settings-stage-heading { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.monster-settings-stage-heading h3 { margin: 0; color: var(--text-highlight); font-size: 1.1rem; }
.monster-settings-badge { padding: .25rem .55rem; border: 1px solid rgba(192, 132, 252, .3); border-radius: 999px; color: #d8b4fe; background: rgba(168, 85, 247, .1); font-size: .75rem; font-weight: 700; }
.monster-settings-battle { display: grid; gap: .7rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); }
.monster-settings-battle h4 { margin: 0; color: var(--text-main); }
.monster-settings-encounter-heading { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.monster-settings-id-badge { color: var(--text-muted); font-size: .76rem; }
.monster-settings-meta { display: flex; gap: .55rem; flex-wrap: wrap; color: var(--text-muted); font-size: .8rem; }
.monster-settings-wave { display: flex; align-items: flex-start; gap: .8rem; padding: .7rem; border: 1px solid rgba(148, 163, 184, .13); border-radius: 9px; background: rgba(148, 163, 184, .035); }
.monster-settings-wave strong { flex: 0 0 85px; color: var(--text-muted); font-size: .82rem; }
.monster-settings-monsters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .65rem; flex: 1; min-width: 0; }
.monster-settings-monster { display: flex; align-items: center; gap: .75rem; min-width: 0; padding: .5rem .65rem; border: 1px solid rgba(56, 189, 248, .16); border-radius: 10px; background: rgba(14, 165, 233, .055); }
.monster-settings-monster-portrait { position: relative; display: grid; flex: 0 0 72px; width: 72px; height: 72px; place-items: center; overflow: hidden; border-radius: 10px; background: rgba(15, 23, 42, .8); font-size: 1.55rem; }
.monster-settings-monster-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.monster-settings-monster-copy { display: grid; gap: .18rem; min-width: 0; }
.monster-settings-monster-copy strong { overflow-wrap: anywhere; color: var(--text-main); font-size: .86rem; line-height: 1.25; }
.monster-settings-monster-copy code { width: fit-content; color: var(--text-muted); font-size: .72rem; }
.monster-settings-monster.compact { padding: .25rem; }
.monster-settings-empty { padding: 1.4rem; border: 1px dashed rgba(148, 163, 184, .3); border-radius: 12px; color: var(--text-muted); background: var(--bg-card); text-align: center; line-height: 1.6; }
.monster-settings-aha-help[hidden] { display: none; }
.monster-settings-aha-help { margin-top: 1rem; }
.monster-custom-card { display: grid; gap: .85rem; }
.monster-custom-card h3 { margin: 0; color: var(--text-highlight); }
.monster-custom-card > .card-subtitle { margin: 0; }
.monster-settings-source { color: var(--text-muted); font-size: .82rem; }
.monster-custom-wave-list { display: grid; gap: .8rem; }
.monster-custom-wave { display: grid; gap: .75rem; padding: .9rem; border: 1px solid rgba(110, 123, 148, .23); border-radius: 12px; background: rgba(9, 13, 22, .5); }
.monster-custom-wave-heading, .monster-custom-row, .monster-custom-toolbar, .monster-custom-actions, .monster-custom-save-actions { display: flex; align-items: center; gap: .65rem; }
.monster-custom-wave-heading, .monster-custom-toolbar { justify-content: space-between; }
.monster-custom-wave-heading strong { color: var(--text-highlight); }
.monster-custom-rows { display: grid; gap: .55rem; }
.monster-custom-row { align-items: flex-end; padding: .7rem; border: 1px solid rgba(110, 123, 148, .16); border-radius: 10px; background: rgba(255, 255, 255, .018); }
.monster-custom-field { display: flex; min-width: 0; flex: 1 1 0; flex-direction: column; gap: .35rem; color: var(--text-muted); font-size: .76rem; font-weight: 700; }
.monster-custom-field input { width: 100%; min-height: 42px; padding: .55rem .65rem; border: 1px solid rgba(110, 123, 148, .32); border-radius: 8px; background: rgba(7, 10, 17, .76); color: var(--text-main); }
.monster-custom-field input:focus { outline: 2px solid rgba(56, 189, 248, .55); outline-offset: 1px; }
.monster-custom-monster-preview { min-height: 62px; }
.monster-custom-monster-field { min-width: 250px; }
.monster-custom-picker { position: relative; width: 100%; }
.monster-custom-picker-results { position: absolute; z-index: 30; top: calc(100% + .35rem); left: 0; right: 0; display: grid; max-height: 340px; overflow-y: auto; padding: .35rem; border: 1px solid rgba(92, 115, 148, .55); border-radius: 12px; background: #111827; box-shadow: 0 18px 42px rgba(0, 0, 0, .5); }
.monster-custom-picker-results[hidden] { display: none; }
.monster-custom-picker-option { display: flex; width: 100%; min-width: 0; padding: .25rem; border: 0; border-radius: 8px; background: transparent; color: var(--text-main); text-align: left; cursor: pointer; }
.monster-custom-picker-option:hover, .monster-custom-picker-option:focus-visible { outline: none; background: rgba(56, 189, 248, .14); }
.monster-custom-picker-option .monster-settings-monster { width: 100%; padding: .25rem .35rem; border: 0; background: transparent; }
.monster-custom-picker-option .monster-settings-monster-portrait { flex-basis: 52px; width: 52px; height: 52px; }
.monster-custom-picker-option .monster-settings-monster-copy strong { font-size: .84rem; }
.monster-custom-picker-option .monster-settings-monster-copy code { font-size: .7rem; }
.monster-custom-monster-preview .monster-settings-monster { width: fit-content; max-width: 100%; padding: .2rem .35rem; }
.monster-custom-monster-preview .monster-settings-monster-portrait { flex-basis: 80px; width: 80px; height: 80px; }
.monster-custom-monster-preview .monster-settings-monster-copy strong { font-size: .76rem; }
.monster-custom-monster-preview .monster-settings-monster-copy code { font-size: .66rem; }
.monster-custom-remove { min-width: 42px; min-height: 42px; }
.monster-custom-add-enemy { justify-self: start; }
.monster-custom-save-actions { justify-content: flex-end; }
.monster-custom-save-actions .monster-settings-status { margin: 0; }
.monster-custom-card button:disabled, .monster-custom-card input:disabled { cursor: not-allowed; opacity: .55; }
@media (max-width: 700px) {
.monster-settings-wave { flex-direction: column; }
.monster-settings-monsters { width: 100%; }
.monster-settings-stage-grid { grid-template-columns: 1fr; }
.monster-aa-round-control { grid-template-columns: 1fr; align-items: stretch; }
.monster-custom-toolbar, .monster-custom-save-actions { align-items: stretch; flex-direction: column; }
.monster-custom-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.monster-custom-save-actions .btn { width: 100%; }
.monster-custom-row { align-items: stretch; flex-wrap: wrap; }
.monster-custom-field { flex-basis: calc(50% - .65rem); }
.monster-custom-monster-field { flex-basis: 100%; }
.monster-custom-remove { margin-left: auto; }
}
@media (max-width: 390px) {
.monster-settings-wave { flex-direction: column; }
.monster-custom-field { flex-basis: 100%; }
}
/* Argument-aware command assistant */
.console-command-preview-box { border:1px solid var(--border-color); border-left:3px solid var(--accent-cyan); border-radius:6px; padding:.7rem .85rem; background:rgba(56,189,248,.045); min-width:0; }
.console-preview-label { font-size:.65rem; font-weight:800; letter-spacing:.1em; color:var(--accent-cyan); margin-bottom:.3rem; }
#console-command-preview { display:block; color:var(--text-primary); overflow-wrap:anywhere; font-size:.9rem; }
#console-command-description { font-size:.75rem; color:var(--text-muted); margin-top:.35rem; }
#console-command-argument { font-size:.8rem; color:var(--accent-gold); margin-top:.4rem; overflow-wrap:anywhere; }
#console-suggestion-options { max-height:16rem; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.console-suggestion-option { min-height:2.4rem; }
.console-suggestion-command { min-width:0; overflow-wrap:anywhere; }
.console-suggestion-description { max-width:55%; }
@media(max-width:640px) { .console-suggestion-option { flex-wrap:wrap; gap:.2rem .5rem; } .console-suggestion-description { display:block; width:100%; max-width:100%; margin-left:1.1rem; } }
/* การ์ดกว้างตามเนื้อหาจริง ไม่ล็อก 1050px และไม่ตัดขอบ */
.showcase-card-layout {
width: max-content; /* เดิม: width/min-width 1050px */
min-width: 0;
overflow: visible; /* เดิม: hidden ทำให้ส่วนเกินโดนตัด */
grid-template-columns: 360px 340px max-content;
gap: 1.25rem;
padding: 1.5rem;
}
.showcase-splash-col { width: 360px; }
/* คอลัมน์รีลิกส์ขยายตามชื่อเซ็ตและ main stat ที่ยาวที่สุด */
.showcase-relics-col { min-width: 420px; }
.showcase-relic-card:hover { transform: none; }
+167 -16
View File
@@ -3,8 +3,9 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GaC-Srtool</title>
<link rel="stylesheet" href="css/styles.css?v=2.3">
<title>GaCy-Srtool</title>
<link rel="stylesheet" href="css/styles.css?v=2.19">
<link rel="stylesheet" href="css/item-catalog.css?v=2">
<link rel="icon" type="image/png" href="assets/logo.png">
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
</head>
@@ -13,10 +14,10 @@
<!-- App Header -->
<header class="app-header">
<div class="brand">
<img src="assets/logo.png" alt="GaC Logo" class="brand-logo-img">
<img src="assets/logo.png" alt="GaCy Logo" class="brand-logo-img">
<div>
<div class="brand-title" style="display: flex; align-items: center; gap: 0.5rem;">
<span>GaC-Srtool</span>
<span>GaCy-Srtool</span>
<span class="badge-branch" id="header-branch-badge" style="display: none;"></span>
</div>
<div class="brand-subtitle" data-i18n="appSubtitle">Star Rail FreeSR & Server Controller</div>
@@ -28,9 +29,9 @@
<div class="server-mode-badge" title="โหมดการเชื่อมต่อเซิร์ฟเวอร์" data-i18n-title="lblServerModeActive">
<span>🌐</span>
<select id="server-mode-select" class="server-mode-select">
<option value="gac" selected>GaC-hkrpg-go</option>
<option value="firefly">FireflyGo</option>
<option value="robin">RobinSR</option>
<option value="gac" selected>GaCy GO</option>
<option value="firefly" disabled data-i18n="serverModeFireflyPaused">FireflyGo (กำลังพัฒนา)</option>
<option value="robin" disabled data-i18n="serverModeRobinPaused">RobinSR (กำลังพัฒนา)</option>
</select>
</div>
@@ -56,8 +57,9 @@
<button class="tab-btn" data-tab="tab-avatars" data-i18n="tabAvatars">👥 ตัวละคร</button>
<button class="tab-btn" data-tab="tab-equipment" data-i18n="tabEquipment">🗡️ กรวยแสง & รีลิกส์</button>
<button class="tab-btn" data-tab="tab-inventory" data-i18n="tabInventory">🎒 ไอเทมในกระเป๋า</button>
<button class="tab-btn" data-tab="tab-monster-settings" id="tab-btn-monster-settings" data-i18n="tabMonsterSettings">👾 Monster Setting</button>
<button class="tab-btn" data-tab="tab-damage-analyst" id="tab-btn-damage-analyst" data-i18n="tabDamageAnalyst">💥 Damage Analyst</button>
<button class="tab-btn" data-tab="tab-persistent" id="tab-btn-persistent" data-i18n="tabPersistent">💾 จัดการเซฟ GaC</button>
<button class="tab-btn" data-tab="tab-persistent" id="tab-btn-persistent" data-i18n="tabPersistent">💾 จัดการเซฟ GaCy</button>
<button class="tab-btn" data-tab="tab-exrank" id="tab-btn-exrank" data-i18n="tabExrank">⚡ สกิลพิเศษ Ex-Rank</button>
<button class="tab-btn" data-tab="tab-json" data-i18n="tabJson">📝 จัดการไฟล์ JSON</button>
<button class="tab-btn" data-tab="tab-settings" data-i18n="tabSettings">⚙️ ตั้งค่า</button>
@@ -240,6 +242,11 @@
</div>
</div>
<p class="card-subtitle" style="margin-bottom: 0.25rem;">Send GM and server commands, with live status and packet logs.</p>
<div style="display:flex; align-items:center; gap:0.65rem; flex-wrap:wrap;">
<button type="button" class="btn btn-sm btn-secondary" id="btn-client-unstuck">Unstuck</button>
<span id="client-unstuck-description" style="font-size:0.75rem; color:var(--text-muted);">Clear a stuck loading spinner without restarting the game. Keeps saved CW progress.</span>
</div>
<div id="client-unstuck-status" role="status" aria-live="polite" style="font-size:0.75rem; color:var(--text-muted);"></div>
<!-- Interactive Terminal Screen -->
<div class="console-terminal-wrapper">
@@ -247,7 +254,7 @@
<span class="terminal-dot dot-red"></span>
<span class="terminal-dot dot-yellow"></span>
<span class="terminal-dot dot-green"></span>
<span class="terminal-title">GaC-hkrpg-go Console Session (Interactive GM Dispatcher)</span>
<span class="terminal-title">GaCy GO Console Session (Interactive GM Dispatcher)</span>
</div>
<div class="console-terminal-log" id="console-terminal-log">
<!-- Logs rendered here -->
@@ -264,15 +271,21 @@
Run
</button>
</form>
<div class="console-command-preview-box" aria-live="polite" aria-atomic="true">
<div class="console-preview-label">COMMAND PREVIEW</div>
<code id="console-command-preview">พิมพ์ / เพื่อเลือกคำสั่ง</code>
<div id="console-command-description"></div>
<div id="console-command-argument"></div>
</div>
<div id="console-command-suggestions" class="console-suggestions" hidden>
<div class="console-suggestions-header">
<span>Command suggestions</span>
<span id="console-suggestion-count" class="console-suggestion-count">‹ 0/0 ›</span>
<span id="console-suggestion-counter"></span>
</div>
<div id="console-suggestion-options" role="listbox" aria-label="Command suggestions"></div>
</div>
<div style="font-size: 0.725rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center;">
<span>Use ↑ / ↓ to browse suggestions or command history. Press Tab to complete.</span>
<span>↑ ↓ เลื่อนรายการ · Tab เติมค่า · Shift+Tab ย้อนรายการ · Esc ปิด · Enter ส่งคำสั่ง</span>
<span id="lbl-console-conn-status" style="color: var(--accent-green);">● Server Online</span>
</div>
</div>
@@ -392,6 +405,43 @@
<!-- Material inventory editor: edits only Client-catalog item quantities. -->
<section id="tab-inventory" class="tab-content">
<div class="inventory-mode-switch" role="tablist" aria-label="Inventory views">
<button type="button" id="btn-inventory-catalog" class="inventory-mode-btn active" role="tab" aria-selected="true" aria-controls="item-catalog-panel" data-i18n="itemCatalogTitle">📚 สมุดรวมไอเทม</button>
<button type="button" id="btn-inventory-manage" class="inventory-mode-btn" role="tab" aria-selected="false" aria-controls="inventory-manage-panel" data-i18n="inventoryTitle">🎒 จัดการจำนวนไอเทม</button>
</div>
<div id="item-catalog-panel" class="inventory-mode-panel active" role="tabpanel">
<div class="card" style="margin-bottom:1rem;">
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap;">
<div>
<div class="card-title" data-i18n="itemCatalogTitle">📚 สมุดรวมไอเทม</div>
<p class="card-subtitle" data-i18n="itemCatalogDescription">ค้นชื่อหรือ ID เพื่อดูรูปและรหัสจากตารางเกม</p>
</div>
<span id="item-catalog-count" class="badge-super-tag">—</span>
</div>
<div class="item-catalog-toolbar">
<input type="search" id="item-catalog-search" class="form-input" data-i18n-placeholder="itemCatalogSearchPlaceholder" placeholder="ค้นหาชื่อหรือ Item ID...">
<select id="item-catalog-filter" class="form-select" aria-label="Filter item catalog">
<option value="all" data-i18n="itemCatalogFilterAll">ทั้งหมด</option>
<option value="supported" data-i18n="itemCatalogFilterSupported">GaC รองรับ</option>
<option value="item" data-i18n="itemCatalogFilterItems">ไอเทม</option>
<option value="lightcone" data-i18n="itemCatalogFilterLightCones">กรวยแสง</option>
<option value="relic" data-i18n="itemCatalogFilterRelics">รีลิกส์</option>
</select>
</div>
<div id="item-catalog-status" role="status" aria-live="polite" style="font-size:.8rem;color:var(--text-muted);margin-top:.7rem;" data-i18n="itemCatalogLoading">กำลังโหลดสมุดไอเทม...</div>
</div>
<div class="card" style="padding:1rem 1rem 0;overflow:hidden;">
<div id="item-catalog-grid" class="item-catalog-grid">
<div class="item-catalog-empty" data-i18n="itemCatalogLoading">กำลังโหลดสมุดไอเทม...</div>
</div>
<div class="item-catalog-pagination">
<button type="button" class="btn btn-sm btn-secondary" id="item-catalog-prev" disabled data-i18n="inventoryPrevious">ก่อนหน้า</button>
<span id="item-catalog-page-label" style="font-size:.8rem;color:var(--text-muted);"></span>
<button type="button" class="btn btn-sm btn-secondary" id="item-catalog-next" disabled data-i18n="inventoryNext">ถัดไป</button>
</div>
</div>
</div>
<div id="inventory-manage-panel" class="inventory-mode-panel" role="tabpanel" hidden>
<div class="card" style="margin-bottom: 1rem;">
<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap;">
<div>
@@ -430,6 +480,57 @@
<button type="button" class="btn btn-sm btn-secondary" id="btn-inventory-next" disabled data-i18n="inventoryNext">ถัดไป</button>
</div>
</div>
</div>
</section>
<!-- Monster settings: resource-backed stage inspection plus Calyx-only custom waves. -->
<section id="tab-monster-settings" class="tab-content">
<div class="card monster-settings-intro">
<div class="card-title"><span data-i18n="monsterSettingsTitle">👾 Monster Setting</span></div>
<p class="card-subtitle" data-i18n="monsterSettingsDescription">ตรวจสอบข้อมูลด่านและคลื่นมอนจาก resource ของ Client ตามเวอร์ชัน ปรับ custom monster ได้เฉพาะ Golden / Crimson Calyx เท่านั้น</p>
<div class="monster-settings-rule" role="note">
<span aria-hidden="true">🔒</span>
<span data-i18n="monsterSettingsRule">Weekly Boss, Stagnant Shadow, Cavern of Corrosion และ Endgame ใช้ข้อมูลด่านจาก Client และแก้คลื่นมอนผ่าน Srtool ไม่ได้</span>
</div>
</div>
<div class="monster-settings-tabs" role="tablist" aria-label="Monster settings modes">
<button type="button" class="monster-settings-tab active" role="tab" aria-selected="true" data-monster-mode="moc" data-i18n="monsterModeMoc">Memory of Chaos</button>
<button type="button" class="monster-settings-tab" role="tab" aria-selected="false" data-monster-mode="pf" data-i18n="monsterModePf">Pure Fiction</button>
<button type="button" class="monster-settings-tab" role="tab" aria-selected="false" data-monster-mode="as" data-i18n="monsterModeAs">Apocalyptic Shadow</button>
<button type="button" class="monster-settings-tab" role="tab" aria-selected="false" data-monster-mode="aa" data-i18n="monsterModeAa">Anomaly Arbitration</button>
<button type="button" class="monster-settings-tab monster-settings-tab-aha" id="monster-mode-aha" role="tab" aria-selected="false" aria-controls="monster-settings-aha-help" data-monster-mode="aha" data-i18n="ahaHelpTitle">Aha's Help</button>
<button type="button" class="monster-settings-tab" role="tab" aria-selected="false" data-monster-mode="custom" data-i18n="monsterModeCustom">Custom Enemy</button>
<button type="button" class="monster-settings-tab" role="tab" aria-selected="false" data-monster-mode="su" data-i18n="monsterModeSu">Simulated Universe</button>
</div>
<div id="monster-settings-status" class="monster-settings-status" role="status" aria-live="polite" data-i18n="monsterSettingsLoading">กำลังอ่าน stage จาก resource ของ Client...</div>
<div id="monster-settings-view" class="monster-settings-view" role="tabpanel" aria-live="polite"></div>
<div id="monster-settings-aha-help" class="monster-settings-aha-help" role="tabpanel" aria-labelledby="monster-mode-aha" hidden>
<div class="aha-help-card" id="aha-help-card">
<div class="aha-help-heading">
<div class="aha-help-emblem" aria-hidden="true">✦</div>
<div class="aha-help-heading-copy">
<h3 data-i18n="ahaHelpTitle">Aha's Help</h3>
<p data-i18n="ahaHelpDescription">Choose the support level for the next battle that includes Voracity Corruption. This setting is separate from Aha Global.</p>
</div>
</div>
<div class="aha-help-options" id="aha-help-options" role="group" aria-label="Aha's Help level" aria-describedby="aha-help-status"></div>
<select id="aha-help-level" class="aha-help-native-select" aria-hidden="true" tabindex="-1" disabled>
<option value="" data-i18n="ahaHelpLoading">Loading levels…</option>
</select>
<div class="aha-help-actions">
<div class="aha-help-save-state" id="aha-help-status" role="status" aria-live="polite" data-state="loading">
<span class="aha-help-state-dot" aria-hidden="true"></span>
<span id="aha-help-status-text" data-i18n="ahaHelpLoading">Loading levels…</span>
</div>
<button type="button" class="btn btn-success aha-help-save-button" id="btn-save-aha-help" disabled>
<span aria-hidden="true">💾</span>
<span data-i18n="ahaHelpSave">Save Aha's Help</span>
</button>
</div>
</div>
</div>
</section>
<!-- 3.5. Damage Analyst (In-Game Battle Telemetry & Damage Analysis) -->
@@ -574,8 +675,19 @@
<!-- Global Features & Toggles -->
<div class="card" id="card-persistent-global">
<div class="card-title" data-i18n="persistentGlobalTitle">⚙️ สวิตช์ระบบพิเศษของ GaC</div>
<div class="card-title" data-i18n="persistentGlobalTitle">⚙️ สวิตช์ระบบพิเศษของ GaCy</div>
<div style="display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem;">
<div class="ex-switch-card">
<div>
<div style="font-weight: 700;">Freecam / FaceCam</div>
<div style="font-size: 0.8rem; color: var(--text-muted);">เลือกโหมด แล้วกด Tab ในเกมเพื่อเปิดหรือปิดกล้อง</div>
<label for="camera-mode">โหมดกล้อง</label>
<select id="camera-mode"><option value="freecam">Freecam</option><option value="facecam">FaceCam (ทดลอง)</option></select>
<label for="camera-distance">ระยะ FaceCam</label>
<input id="camera-distance" type="number" min="0.5" max="5" step="0.1" value="2">
<button type="button" class="btn btn-success" id="btn-save-camera">บันทึกกล้อง</button>
</div>
</div>
<div class="ex-switch-card">
<div>
<div style="font-weight: 700;" data-i18n="globalFeatureSilverWolf">Silver Wolf Global Feature</div>
@@ -615,6 +727,7 @@
</div>
</div>
</div>
</section>
<!-- 5. Ex-Rank Tab -->
@@ -680,9 +793,9 @@
<div class="form-group">
<label class="form-label" data-i18n="lblServerMode">โหมดเซิร์ฟเวอร์</label>
<select id="setting-server-mode" class="form-select">
<option value="gac">GaC-hkrpg-go</option>
<option value="firefly">FireflyGo</option>
<option value="robin">RobinSR</option>
<option value="gac">GaCy GO</option>
<option value="firefly" disabled data-i18n="serverModeFireflyPaused">FireflyGo (กำลังพัฒนา)</option>
<option value="robin" disabled data-i18n="serverModeRobinPaused">RobinSR (กำลังพัฒนา)</option>
</select>
</div>
@@ -1668,10 +1781,48 @@
</div>
</div>
<dialog id="item-catalog-detail" class="item-catalog-dialog" aria-labelledby="item-catalog-detail-name">
<div class="item-catalog-detail-shell">
<header class="item-catalog-detail-header">
<span data-i18n="itemCatalogDetailTitle">Item Details</span>
<button type="button" class="item-catalog-dialog-close" id="item-catalog-detail-close" data-i18n-aria-label="itemCatalogClose" aria-label="Close">×</button>
</header>
<div class="item-catalog-detail-body">
<div class="item-catalog-detail-art" id="item-catalog-detail-art"></div>
<div class="item-catalog-detail-copy">
<h2 id="item-catalog-detail-name"></h2>
<div class="item-catalog-detail-id" id="item-catalog-detail-id"></div>
<div class="item-catalog-detail-source"><span data-i18n="itemCatalogSourceTable">Source tables</span>: <span id="item-catalog-detail-source"></span></div>
<div class="item-catalog-detail-meta" id="item-catalog-detail-meta"></div>
<section class="item-catalog-detail-section">
<h3 data-i18n="itemCatalogItemDescription">Description</h3>
<div class="item-catalog-detail-description" id="item-catalog-detail-description"></div>
</section>
<section class="item-catalog-detail-section item-catalog-detail-lore" id="item-catalog-detail-lore-section" hidden>
<h3 data-i18n="itemCatalogLore">Background</h3>
<div id="item-catalog-detail-lore"></div>
</section>
</div>
</div>
<div class="item-catalog-detail-quantity">
<label for="item-catalog-detail-amount" data-i18n="itemCatalogQuantity">Quantity</label>
<div class="item-catalog-amount-stepper">
<button type="button" id="item-catalog-amount-minus" data-i18n-aria-label="itemCatalogDecrease" aria-label="Decrease quantity">−</button>
<input type="number" id="item-catalog-detail-amount" inputmode="numeric" min="1" max="1" value="1">
<button type="button" id="item-catalog-amount-plus" data-i18n-aria-label="itemCatalogIncrease" aria-label="Increase quantity">+</button>
</div>
<span id="item-catalog-amount-limit" class="item-catalog-amount-limit"></span>
</div>
<footer class="item-catalog-detail-footer">
<button type="button" class="btn btn-secondary" id="item-catalog-detail-done" data-i18n="itemCatalogClose">Close</button>
</footer>
</div>
</dialog>
<!-- Toast Notification Container -->
<div class="toast-container" id="toast-container"></div>
<!-- Script Modules -->
<script type="module" src="js/app.js?v=2.9"></script>
<script type="module" src="js/app.js?v=3.3"></script>
</body>
</html>
+998 -98
View File
File diff suppressed because it is too large. Load diff
+14
View File
@@ -2079,6 +2079,20 @@ export const AVATAR_METADATA = {
"element": "Lightning",
"rarity": 5,
"hasExRank": false
},
"6042": {
"names": {
"th": "King Pom-Pom",
"en": "King Pom-Pom",
"zh-CN": "帕姆大王",
"zh-TW": "帕姆大王",
"ja": "パム大王",
"ko": "폼폼 대왕"
},
"path": "Elation",
"element": "Physical",
"rarity": 5,
"hasExRank": false
}
};
+69
View File
@@ -0,0 +1,69 @@
// Command syntax mirrors the SDK dispatcher. Runtime IDs come from its read-only
// completion catalog; sample quantities are examples, not game resource IDs.
const arg = (name, help, source, optional = false) => ({ name, help, source, optional });
const quantity = (name = 'count') => arg(name, 'จำนวนเต็มบวก เช่น 1, 10 หรือ 100', ['1', '10', '100'], true);
const spec = (path, description, args = []) => ({ path: path.split(' '), description, args });
export const COMMANDS = [
spec('/help', 'แสดงรายการคำสั่งและวิธีใช้'),
spec('/heal', 'ส่งคำสั่งฟื้นฟู HP, พลังงาน และแต้มสกิล'),
spec('/max', 'ปรับตัวละครทั้งหมดเป็นเลเวล 80 และ E6'),
spec('/unstuck', 'กู้หน้าจอที่หมุนค้าง โดยเก็บความคืบหน้า CW'),
spec('/clear lineup', 'ล้างสมาชิกทีมปัจจุบัน'),
spec('/avatar', 'ปรับเลเวลและ Eidolon ของตัวละคร', [arg('id', 'เลือก ID ตัวละครจากรายชื่อ', 'avatars'), arg('level', 'เลเวล 1–80 (ไม่ใส่เพื่อคงค่าเดิม)', ['1','20','40','60','70','80'], true), arg('rank', 'Eidolon 0–6', ['0','1','2','3','4','5','6'], true)]),
...['/give','/item'].map(p => spec(p, 'ส่งคำสั่งเพิ่มไอเท็ม', [arg('item_id', 'ID ไอเท็มจาก catalog เซิร์ฟเวอร์', 'items'), quantity()])),
...['/teleport','/scene'].map(p => spec(p, 'เปลี่ยนฉากปลายทาง', [arg('plane_id', 'เลือก Plane ID', 'planes'), arg('floor_id', 'เลือกชั้นที่อยู่ใน Plane นี้', 'floors', true)])),
spec('/faketime', 'ดู/ตั้งเวลาเกม โดยไม่เปลี่ยนเวลา Windows', [arg('time', 'status = ดูเวลา · off = เวลาจริง · หรือ Unix seconds / RFC3339 พร้อม timezone', 'time', true)]),
spec('/cw help', 'แสดงวิธีใช้คำสั่ง CW'), spec('/cw status', 'ดูเงิน HP เลเวล และสถานะรอบ CW'),
spec('/cw list', 'แสดงรายการ ID ของ CW', [arg('category', 'เลือกชนิดข้อมูล', ['role','equip','orb','consumable','forge'])]),
...['gold','hp','exp'].map(p => spec('/cw '+p, p === 'exp' ? 'เพิ่ม EXP ในรอบ CW' : 'ตั้งค่า '+p+' ในรอบ CW', [arg(p === 'exp' ? 'gain' : 'total', p === 'hp' ? 'HP 1 ถึงเพดานของรอบปัจจุบัน' : 'จำนวนเต็มไม่ติดลบ (เป็นยอดรวม ยกเว้น exp ที่เป็นจำนวนเพิ่ม)', ['1','10','100','1000'])])),
...['tbpower','tb','trailblaze'].map(p => spec('/cw '+p, 'ตั้งค่าพลังบุกเบิก (Trailblaze Power / เหรียญร้านรถไฟ) ในรอบ CW', [arg('total', 'จำนวนพลังบุกเบิก เช่น 10, 50, 100', ['10','50','100','500'])])),
spec('/cw role', 'เพิ่มตัวละคร CW (ใช้ได้ใน Preparation)', [arg('roleID', 'เลือก Role ID ของ CW', 'cw_roles'), arg('star', 'ดาวที่มีข้อมูลรองรับสำหรับ Role นี้', 'cw_stars'), quantity()]),
...['equip','orb','consumable','forge'].map(p => spec('/cw '+p, 'เพิ่ม '+p+' ในรอบ CW (Preparation)', [arg('itemID', 'เลือก ID จากข้อมูล CW ของ Client', 'cw_'+p), quantity()])),
];
export function usage(command) {
return [...command.path, ...command.args.map(a => a.optional ? '['+a.name+']' : '<'+a.name+'>')].join(' ');
}
export function inspectCommand(value = '', caret = value.length, catalogs = {}) {
caret = Math.max(0, Math.min(caret, value.length));
const tokens = Array.from(value.matchAll(/\S+/g), m => ({ value:m[0], start:m.index, end:m.index+m[0].length }));
let index = tokens.findIndex(t => caret >= t.start && caret <= t.end);
if (index < 0) index = tokens.filter(t => t.end < caret).length;
const token = tokens[index];
const start = token?.start ?? caret, end = token?.end ?? caret;
const query = value.slice(start, caret).toLowerCase();
const words = tokens.map(t => t.value);
const matching = COMMANDS.filter(c => c.path.slice(0, Math.min(index, c.path.length)).every((p,i) => p.toLowerCase() === words[i]?.toLowerCase()));
const exact = COMMANDS.find(c => c.path.every((p,i) => p.toLowerCase() === words[i]?.toLowerCase()));
const command = value.trim() ? exact || matching.find(c => (c.path[index] || '').toLowerCase().startsWith(query)) || null : null;
const suggestions = [];
for (const c of matching) if (index < c.path.length && c.path[index].toLowerCase().startsWith(query)) {
suggestions.push({ value:c.path[index], label:c.path[index], description:c.description });
}
const argIndex = exact ? index-exact.path.length : -1;
const active = exact?.args[argIndex];
if (active) {
let choices = Array.isArray(active.source) ? active.source : catalogs[active.source] || [];
if (active.source === 'time') choices = ['status','off','reset','real',new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')];
if (active.source === 'floors') choices = (catalogs.floors || []).filter(c => String(c.plane) === words[exact.path.length]);
if (active.source === 'cw_stars') choices = (catalogs.cw_roles || []).filter(c => String(c.value) === words[exact.path.length]).map(c => String(c.star));
for (const entry of choices) {
const choice = typeof entry === 'object' ? entry : {value:String(entry),label:String(entry)};
if ((choice.value+' '+(choice.label || '')).toLowerCase().includes(query)) suggestions.push({...choice, description:active.help});
}
}
const seen = new Set();
const unique = suggestions.filter(s => { if(seen.has(s.value))return false;seen.add(s.value);return true; });
const missing = exact ? exact.args.filter((a,i) => !a.optional && !words[exact.path.length+i]).map(a => a.name) : [];
return { command, active, argIndex, index, start, end, suggestions:unique, missing,
preview:command ? [...command.path, ...command.args.map((a,i) => words[command.path.length+i] || (a.optional ? '['+a.name+']' : '<'+a.name+'>'))].join(' ') : value.trim() ? 'ไม่พบคำสั่งนี้ในรายการ — ตรวจชื่อคำสั่งก่อนส่ง' : 'พิมพ์ / เพื่อเลือกคำสั่ง',
hint:active ? `${active.optional ? 'ช่องเสริม' : 'ช่องที่ต้องใส่'}: ${active.name} — ${active.help}` : exact ? (missing.length ? 'ยังขาด: '+missing.join(', ') : 'ใส่ครบแล้ว · Enter หรือ Run เพื่อส่งคำสั่ง') : command && index > 0 ? 'ช่องถัดไป: เลือกคำสั่งย่อยจากรายการด้านล่าง' : '↑ ↓ เลื่อน · Tab เติมค่าที่เลือก · Esc ปิดรายการ',
};
}
export function completeCommand(value, model, choice) {
const suffix = value.slice(model.end);
const separator = /^\s/.test(suffix) ? '' : ' ';
return { value:value.slice(0,model.start)+choice.value+separator+suffix, caret:model.start+choice.value.length+1 };
}
+500 -91
View File
File diff suppressed because it is too large. Load diff
+285
View File
@@ -0,0 +1,285 @@
import { getCurrentLanguage, t, translatePath } from './i18n.js?v=2.8';
const CATALOG_URL = new URL('../assets/item-catalog.json?v=2', import.meta.url);
const PAGE_SIZE = 48;
let catalog = null;
let catalogLoading = null;
let page = 0;
let activeDetailId = null;
const elements = () => ({
tab: document.querySelector('.tab-btn[data-tab="tab-inventory"]'),
browseButton: document.getElementById('btn-inventory-catalog'),
manageButton: document.getElementById('btn-inventory-manage'),
catalogPanel: document.getElementById('item-catalog-panel'),
managePanel: document.getElementById('inventory-manage-panel'),
search: document.getElementById('item-catalog-search'),
filter: document.getElementById('item-catalog-filter'),
grid: document.getElementById('item-catalog-grid'),
status: document.getElementById('item-catalog-status'),
count: document.getElementById('item-catalog-count'),
pageLabel: document.getElementById('item-catalog-page-label'),
previous: document.getElementById('item-catalog-prev'),
next: document.getElementById('item-catalog-next'),
detail: document.getElementById('item-catalog-detail'),
detailArt: document.getElementById('item-catalog-detail-art'),
detailName: document.getElementById('item-catalog-detail-name'),
detailId: document.getElementById('item-catalog-detail-id'),
detailSource: document.getElementById('item-catalog-detail-source'),
detailMeta: document.getElementById('item-catalog-detail-meta'),
detailDescription: document.getElementById('item-catalog-detail-description'),
detailLore: document.getElementById('item-catalog-detail-lore'),
detailLoreSection: document.getElementById('item-catalog-detail-lore-section'),
amount: document.getElementById('item-catalog-detail-amount'),
amountLimit: document.getElementById('item-catalog-amount-limit')
});
function escapeHtml(value) {
return String(value ?? '').replace(/[&<>"']/g, char => ({
'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;'
})[char]);
}
function plainGameText(value) {
return String(value ?? '').replace(/<[^>]*>/g, '').replace(/\\r\\n/g, '\n').replace(/\\n/g, '\n').replace(/\\t/g, ' ').trim();
}
function displayName(item) {
const names = item.names || {};
return plainGameText(names[getCurrentLanguage()] || names.en || t('itemCatalogUnknownName', { id: item.id }));
}
function assetUrl(path, base) {
if (typeof path !== 'string' || !/^(icon|image)\/[A-Za-z0-9_./-]+\.png$/.test(path) || path.includes('..')) return '';
try { return new URL(path, base).href; } catch { return ''; }
}
function itemCategoryLabel(category) {
const key = {
item: 'itemCatalogFilterItems',
lightcone: 'itemCatalogFilterLightCones',
relic: 'itemCatalogFilterRelics'
}[category];
return key ? t(key) : t('itemCatalogFilterItems');
}
function visibleItems() {
if (!catalog) return [];
const query = String(elements().search?.value || '').trim().toLocaleLowerCase();
const category = elements().filter?.value || 'all';
return catalog.items.filter(item => {
if (category === 'supported' && !item.supported) return false;
if (category !== 'all' && category !== 'supported' && item.category !== category) return false;
if (!query) return true;
if (String(item.id).includes(query)) return true;
return Object.values(item.names || {}).some(name => plainGameText(name).toLocaleLowerCase().includes(query));
});
}
function imageMarkup(item, source) {
const src = assetUrl(item.icon, source.assetBaseUrl);
if (!src) {
return '<button type="button" class="item-catalog-art-button" data-item-catalog-id="' + item.id + '" aria-label="' + escapeHtml(t('itemCatalogOpenDetails', { name: displayName(item) })) + '"><span class="item-catalog-art item-catalog-art-missing" title="' + escapeHtml(t('itemCatalogNoImage')) + '"><span aria-hidden="true">✦</span><small>' + escapeHtml(t('itemCatalogNoImage')) + '</small></span></button>';
}
const fallback = assetUrl(item.icon, source.assetFallbackBaseUrl);
return '<button type="button" class="item-catalog-art-button" data-item-catalog-id="' + item.id + '" aria-label="' + escapeHtml(t('itemCatalogOpenDetails', { name: displayName(item) })) + '"><span class="item-catalog-art"><img class="item-catalog-image" src="' + escapeHtml(src) + '" data-fallback="' + escapeHtml(fallback) + '" alt="" loading="lazy" decoding="async"></span></button>';
}
function localizedItemText(item, field) {
const values = item[field] || {};
return values[getCurrentLanguage()] || values.en || '';
}
function openItemDetails(itemId) {
const el = elements();
const item = catalog?.items.find(row => row.id === Number(itemId));
if (!item || !el.detail) return;
activeDetailId = item.id;
const name = displayName(item);
const src = assetUrl(item.icon, catalog.source.assetBaseUrl);
const fallback = assetUrl(item.icon, catalog.source.assetFallbackBaseUrl);
const description = localizedItemText(item, 'descriptions');
const lore = localizedItemText(item, 'backgroundDescriptions');
const rarity = Number(item.rarity);
const rarityText = Number.isInteger(rarity) && rarity > 0 && rarity <= 5 ? '★'.repeat(rarity) : '';
const category = itemCategoryLabel(item.category);
const type = [item.type, item.subType].filter((value, index, values) => value && values.indexOf(value) === index).join(' · ');
const path = item.path ? translatePath(item.path) : '';
const slot = item.slot ? translatePath(item.slot) : '';
const meta = [category, type, slot, path, rarityText].filter(Boolean).join(' · ');
el.detailName.textContent = name;
el.detailId.textContent = t('itemCatalogItemId', { id: item.id });
el.detailSource.textContent = (item.sourceTables || []).map(path => path.split('/').pop()).join(', ') || t('itemCatalogNoDetails');
el.detailMeta.textContent = meta || t('itemCatalogNoDetails');
el.detailMeta.dataset.rarity = rarityText ? String(rarity) : '';
el.detailDescription.textContent = plainGameText(description || lore || t('itemCatalogNoDescription'));
el.detailLoreSection.hidden = !description || !lore || description === lore;
el.detailLore.textContent = el.detailLoreSection.hidden ? '' : plainGameText(lore);
if (src) {
el.detailArt.innerHTML = '<img src="' + escapeHtml(src) + '" data-fallback="' + escapeHtml(fallback) + '" alt="' + escapeHtml(name) + '">';
const image = el.detailArt.querySelector('img');
image.addEventListener('error', () => {
if (image.dataset.fallback && !image.dataset.fallbackTried) {
image.dataset.fallbackTried = 'true';
image.src = image.dataset.fallback;
} else {
el.detailArt.textContent = t('itemCatalogNoImage');
}
});
} else {
el.detailArt.textContent = t('itemCatalogNoImage');
}
const limit = Number(item.pileLimit);
const hasLimit = Number.isSafeInteger(limit) && limit > 0;
el.amount.min = '1';
if (hasLimit) {
el.amount.max = String(limit);
el.amountLimit.textContent = t('itemCatalogMaxQuantity', { count: limit.toLocaleString() });
} else {
el.amount.removeAttribute('max');
el.amountLimit.textContent = '';
}
el.amount.value = '1';
if (!el.detail.open) el.detail.showModal();
}
function updateSelectedAmount(delta = 0) {
const input = elements().amount;
if (!input) return;
const max = Number(input.max);
const hasMax = Number.isSafeInteger(max) && max > 0;
const current = Number.parseInt(input.value, 10);
const next = Math.max(1, (Number.isFinite(current) ? current : 1) + delta);
input.value = String(hasMax ? Math.min(max, next) : next);
}
function renderCatalog() {
const el = elements();
if (!el.grid || !catalog) return;
el.filter.setAttribute('aria-label', t('itemCatalogFilterLabel'));
const filtered = visibleItems();
const pages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
page = Math.min(page, pages - 1);
const start = page * PAGE_SIZE;
const rows = filtered.slice(start, start + PAGE_SIZE);
el.count.textContent = t('inventoryItemTotal', { count: filtered.length });
el.pageLabel.textContent = t('inventoryPage', { page: page + 1, pages, count: filtered.length });
el.previous.disabled = page === 0;
el.next.disabled = page >= pages - 1;
if (!rows.length) {
el.grid.innerHTML = '<div class="item-catalog-empty">' + escapeHtml(t('inventoryNoMatch')) + '</div>';
return;
}
el.grid.innerHTML = rows.map(item => {
const name = displayName(item);
const category = itemCategoryLabel(item.category);
const subtype = item.slot || item.subType || item.type || '';
const path = item.path ? translatePath(item.path) : '';
const rarity = Number(item.rarity);
const rarityText = Number.isInteger(rarity) && rarity > 0 && rarity <= 5 ? '★'.repeat(rarity) : '';
const details = [category, subtype, path, rarityText].filter(Boolean).join(' · ');
const supportText = item.supported ? t('itemCatalogSupportedTag') : t('itemCatalogBrowseOnlyTag');
return '<article class="item-catalog-card">' +
imageMarkup(item, catalog.source) +
'<div class="item-catalog-info">' +
'<div class="item-catalog-name" title="' + escapeHtml(name) + '">' + escapeHtml(name) + '</div>' +
'<div class="item-catalog-id">ID ' + item.id + '</div>' +
'<div class="item-catalog-details" title="' + escapeHtml(details) + '">' + escapeHtml(details) + '</div>' +
'<span class="item-catalog-support ' + (item.supported ? 'is-supported' : 'is-browse-only') + '">' + escapeHtml(supportText) + '</span>' +
'</div>' +
'</article>';
}).join('');
el.grid.querySelectorAll('.item-catalog-image').forEach(image => {
image.addEventListener('error', () => {
if (image.dataset.fallback && !image.dataset.fallbackTried) {
image.dataset.fallbackTried = 'true';
image.src = image.dataset.fallback;
return;
}
const placeholder = document.createElement('div');
placeholder.className = 'item-catalog-art item-catalog-art-missing';
placeholder.title = t('itemCatalogNoImage');
const mark = document.createElement('span');
mark.setAttribute('aria-hidden', 'true');
mark.textContent = '✦';
const label = document.createElement('small');
label.textContent = t('itemCatalogNoImage');
placeholder.append(mark, label);
image.parentElement.replaceWith(placeholder);
});
});
el.grid.querySelectorAll('[data-item-catalog-id]').forEach(button => {
button.addEventListener('click', () => openItemDetails(button.dataset.itemCatalogId));
});
}
async function loadCatalog() {
const el = elements();
if (catalog) return catalog;
if (catalogLoading) return catalogLoading;
el.status.textContent = t('itemCatalogLoading');
catalogLoading = fetch(CATALOG_URL).then(response => {
if (!response.ok) throw new Error('HTTP ' + response.status);
return response.json();
}).then(data => {
if (!Array.isArray(data.items) || !data.source?.assetBaseUrl) throw new Error('Invalid catalog data');
catalog = data;
el.status.textContent = t('inventoryItemTotal', { count: data.counts.total });
renderCatalog();
return catalog;
}).catch(error => {
el.status.textContent = t('itemCatalogLoadFailed') + ': ' + error.message;
el.grid.innerHTML = '<div class="item-catalog-empty">' + escapeHtml(t('itemCatalogLoadFailed')) + '</div>';
catalogLoading = null;
throw error;
});
return catalogLoading;
}
function setInventoryView(view) {
const el = elements();
const showCatalog = view === 'catalog';
el.catalogPanel.hidden = !showCatalog;
el.managePanel.hidden = showCatalog;
el.browseButton.classList.toggle('active', showCatalog);
el.manageButton.classList.toggle('active', !showCatalog);
el.browseButton.setAttribute('aria-selected', String(showCatalog));
el.manageButton.setAttribute('aria-selected', String(!showCatalog));
if (showCatalog) loadCatalog().catch(() => {});
}
export function initializeItemCatalog() {
const el = elements();
el.search?.addEventListener('input', () => { page = 0; renderCatalog(); });
el.filter?.addEventListener('change', () => { page = 0; renderCatalog(); });
el.previous?.addEventListener('click', () => { page = Math.max(0, page - 1); renderCatalog(); });
el.next?.addEventListener('click', () => { page += 1; renderCatalog(); });
document.getElementById('item-catalog-detail-close')?.addEventListener('click', () => el.detail?.close());
document.getElementById('item-catalog-detail-done')?.addEventListener('click', () => el.detail?.close());
el.detail?.addEventListener('close', () => { activeDetailId = null; });
document.getElementById('item-catalog-amount-minus')?.addEventListener('click', () => updateSelectedAmount(-1));
document.getElementById('item-catalog-amount-plus')?.addEventListener('click', () => updateSelectedAmount(1));
el.amount?.addEventListener('change', () => {
const value = Number.parseInt(el.amount.value, 10);
const max = Number(el.amount.max);
el.amount.value = String(Math.max(1, Number.isFinite(value) ? (Number.isSafeInteger(max) && max > 0 ? Math.min(max, value) : value) : 1));
});
el.detail?.addEventListener('click', event => {
if (event.target === el.detail) el.detail.close();
});
el.tab?.addEventListener('click', () => { if (!el.catalogPanel.hidden) loadCatalog().catch(() => {}); });
el.browseButton?.addEventListener('click', () => setInventoryView('catalog'));
el.manageButton?.addEventListener('click', () => setInventoryView('manage'));
document.getElementById('lang-select')?.addEventListener('change', () => {
if (catalog) renderCatalog();
else if (el.status) el.status.textContent = t('itemCatalogLoading');
if (catalog && el.detail?.open && activeDetailId !== null) openItemDetails(activeDetailId);
});
}
+66
View File
@@ -0,0 +1,66 @@
import { getCurrentLanguage } from './i18n.js?v=2.8';
const strings = {
en: {
button: 'Unstuck',
description: 'Clear a stuck loading spinner without restarting the game. Keeps saved CW progress.',
offline: 'Connect to the GaCy GO server first.',
queued: 'Recovery queued. Waiting for the game…',
completed: 'The game cleared its network wait. Try closing or retrying the page.',
delayed: 'No acknowledgement from the game yet. Recovery is still queued; the game must be connected.',
failed: 'The game could not clear the wait.',
unsupported: 'This server does not support Unstuck yet.'
},
th: {
button: 'Unstuck / แก้ค้าง',
description: 'ปลดตัวหมุนค้างโดยไม่ต้องออกเกม และเก็บเซฟรอบ CW ไว้',
offline: 'เชื่อมต่อเซิร์ฟเวอร์ GaCy GO ก่อน',
queued: 'ส่งคำสั่งแล้ว กำลังรอเกมตอบกลับ…',
completed: 'เกมปลดการรอแพ็กเก็ตแล้ว ลองปิดหน้าต่างหรือกดใหม่ได้',
delayed: 'เกมยังไม่ตอบรับ คำสั่งยังอยู่ในคิวและต้องเชื่อมต่อเกมไว้',
failed: 'เกมปลดการรอไม่สำเร็จ',
unsupported: 'เซิร์ฟเวอร์นี้ยังไม่รองรับ Unstuck'
}
};
export function initializeUnstuck({ apiCall, isConnected, showToast }) {
const button = document.getElementById('btn-client-unstuck');
const description = document.getElementById('client-unstuck-description');
const status = document.getElementById('client-unstuck-status');
if (!button) return;
const text = () => strings[getCurrentLanguage()] || strings.en;
const translate = () => {
button.textContent = text().button;
if (description) description.textContent = text().description;
};
translate();
document.getElementById('lang-select')?.addEventListener('change', translate);
button.addEventListener('click', async () => {
if (!isConnected()) { showToast(text().offline, 'error'); return; }
button.disabled = true;
try {
const result = await apiCall('/api/client/unstuck', 'POST', {});
if (!result?.request_id || result.state !== 'queued') throw new Error(text().unsupported);
if (status) status.textContent = text().queued;
for (let attempt = 0; attempt < 16; attempt++) {
await new Promise(resolve => setTimeout(resolve, 750));
const acknowledgement = await apiCall('/api/client/unstuck');
if (acknowledgement?.request_id !== result.request_id) continue;
if (acknowledgement.state === 'completed') {
if (status) status.textContent = text().completed;
showToast(text().completed, 'success');
return;
}
if (acknowledgement.state === 'failed') {
throw new Error(acknowledgement.error || text().failed);
}
}
if (status) status.textContent = text().delayed;
} catch (error) {
if (status) status.textContent = error.message;
showToast(error.message, 'error');
} finally {
button.disabled = false;
}
});
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "gac-srtool",
"version": "1.0.0",
"description": "Companion Web Management Dashboard & FreeSR Tool for GaC-hkrpg-go",
"description": "Companion Web Management Dashboard & FreeSR Tool for GaCy GO",
"main": "index.html",
"scripts": {
"sync-branch": "node scripts/sync-branch.js",
+13
View File
@@ -0,0 +1,13 @@
// Only the static web application is published; repository tools and local
// configuration are not copied to the public deployment.
const fs = require('node:fs');
const path = require('node:path');
const root = path.resolve(__dirname, '..');
const output = path.join(root, 'dist');
fs.mkdirSync(output, { recursive: true });
for (const name of ['index.html', 'version.json', 'assets', 'css', 'js']) {
const source = path.join(root, name);
if (!fs.existsSync(source)) throw new Error(`Missing static application input: ${name}`);
fs.cpSync(source, path.join(output, name), { recursive: true, force: true });
}
console.log('Static application prepared for Vercel.');
+34
View File
@@ -0,0 +1,34 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const vm = require('node:vm');
const path = require('node:path');
const source = fs.readFileSync(path.join(__dirname, '../js/app.js'), 'utf8');
const start = source.indexOf('function orderBattleReportAvatars(');
const end = source.indexOf('\nfunction renderDamageAnalyst(', start);
const context = { state: { statusData: { lineups: { 0: 30, 1: 20, 2: 10 } } } };
vm.createContext(context);
vm.runInContext(source.slice(start, end), context);
test('battle slots override a different overworld lineup without mutating the report', () => {
const avatars = [{ avatar_id: 20, slot: 2 }, { avatar_id: 30, slot: 0 }, { avatar_id: 10, slot: 1 }];
const result = context.orderBattleReportAvatars(avatars);
assert.deepEqual(Array.from(result, a => a.avatar_id), [30, 10, 20]);
assert.deepEqual(avatars.map(a => a.avatar_id), [20, 30, 10]);
});
test('historical reports keep recorded order when battle slots are absent', () => {
const result = context.orderBattleReportAvatars([{ avatar_id: 10 }, { avatar_id: 30 }, { avatar_id: 20 }]);
assert.deepEqual(Array.from(result, a => a.avatar_id), [10, 30, 20]);
});
test('Other includes unclassified and missing category damage exactly once', () => {
const result = context.damageBreakdownForAvatar({ total_damage: 1000, total_break_damage: 100,
attack_type_damage: { Normal: 100, BPSkill: 200, Ultra: 100, Insert: 50, TrueDamage: 150 } });
assert.equal(result.other, 500);
assert.equal(result.normal + result.skill + result.ultimate + result.breakDamage + result.other, 1000);
});
test('Other never becomes negative when the native breakdown overlaps', () => {
assert.equal(context.damageBreakdownForAvatar({total_damage: 10, attack_type_damage: {Normal: 20}}).other, 0);
});
+68
View File
@@ -0,0 +1,68 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const catalogPath = path.join(__dirname, '..', 'assets', 'item-catalog.json');
const catalog = JSON.parse(fs.readFileSync(catalogPath, 'utf8'));
test('item book matches its pinned game and image catalog revisions', () => {
assert.equal(catalog.source.gameRevision, '312b4597691e0a29cf9828a15b592757dba86949');
assert.equal(catalog.source.assetRevision, 'dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487');
assert.equal(catalog.items.length, catalog.counts.total);
assert.equal(new Set(catalog.items.map(item => item.id)).size, catalog.items.length);
assert.equal(catalog.items.filter(item => item.supported).length, catalog.counts.supported);
assert.equal(catalog.items.filter(item => item.icon).length, catalog.counts.withImages);
assert.equal(catalog.items.filter(item => !item.icon).length, catalog.counts.withoutConfiguredImage);
assert.equal(catalog.counts.total, 5414);
assert.equal(catalog.counts.definitionRows, 5472);
assert.equal(catalog.counts.candidateTables, 26);
assert.equal(catalog.counts.definitionTables, 18);
assert.equal(catalog.counts.supported, 3550);
assert.equal(catalog.counts.withImages, 5261);
assert.equal(catalog.source.gameTables.length, catalog.counts.definitionTables);
assert.ok(catalog.items.some(item => item.sourceTables.length > 1), 'overlapping IDs retain every source table');
});
test('catalog image paths are safe and all visible catalog strings are translated', async () => {
for (const item of catalog.items) {
assert.ok(['item', 'lightcone', 'relic'].includes(item.category), `invalid category for ${item.id}`);
assert.ok(item.sourceTables.length > 0, `missing source table for ${item.id}`);
assert.deepEqual(Object.keys(item.names).sort(), [...catalog.source.languages].sort());
assert.ok(item.gameIconPaths.every(path => typeof path === 'string' && path.length > 0));
if (item.icon) {
assert.match(item.icon, /^(icon|image)\/[A-Za-z0-9_./-]+\.png$/);
assert.ok(!item.icon.includes('..'), `unsafe icon path for ${item.id}`);
}
for (const textMapField of ['descriptions', 'backgroundDescriptions']) {
assert.ok(Object.keys(item[textMapField]).every(language => catalog.source.languages.includes(language)));
assert.ok(Object.values(item[textMapField]).every(value => typeof value === 'string'));
}
}
const { TRANSLATIONS } = await import('../js/i18n.js');
const languages = catalog.source.languages;
assert.deepEqual(Object.keys(TRANSLATIONS).sort(), [...languages].sort());
const catalogKeys = Object.keys(TRANSLATIONS.en).filter(key => key.startsWith('itemCatalog'));
assert.ok(catalogKeys.length > 0);
for (const language of languages) {
for (const key of catalogKeys) {
assert.ok(TRANSLATIONS[language][key], `missing ${key} translation for ${language}`);
}
}
});
test('item detail dialog supports inspection and local quantity selection without a spawn action', () => {
const html = fs.readFileSync(path.join(__dirname, '..', 'index.html'), 'utf8');
const dialog = html.match(/<dialog id="item-catalog-detail"[\s\S]*?<\/dialog>/)?.[0];
assert.ok(dialog, 'item detail dialog exists outside the hidden tab content');
assert.match(dialog, /<input[^>]*id="item-catalog-detail-amount"[^>]*type="number"|<input[^>]*type="number"[^>]*id="item-catalog-detail-amount"/);
assert.match(dialog, /id="item-catalog-detail-description"/);
assert.match(dialog, /id="item-catalog-detail-source"/);
assert.doesNotMatch(dialog, /spawn|summon|เสก|เพิ่มเข้ากระเป๋า/i);
const moduleSource = fs.readFileSync(path.join(__dirname, '..', 'js', 'item-catalog.js'), 'utf8');
assert.match(moduleSource, /showModal\(\)/);
assert.match(moduleSource, /item\.pileLimit/);
assert.doesNotMatch(moduleSource, /apiRequest|method\s*:\s*['"]POST/i);
});
+437
View File
@@ -0,0 +1,437 @@
#!/usr/bin/env python3
"""Build the read-only item encyclopedia from pinned game and image data."""
from __future__ import annotations
import argparse
import json
import os
import re
import sys
import tempfile
import time
import urllib.error
import urllib.parse
import urllib.request
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
GAME_PROJECT = "Dimbreath/turnbasedgamedata"
ASSET_PROJECT = "Mar-7th/StarRailRes"
ASSET_LANGUAGES = {
"th": "th", "en": "en", "zh-CN": "cn", "zh-TW": "cht", "ja": "jp",
"ko": "kr", "vi": "vi", "id": "id", "es": "es", "fr": "fr",
"de": "de", "ru": "ru", "pt": "pt",
}
TEXTMAP_TOKENS = {
"th": ("TH",), "en": ("EN",), "zh-CN": ("CHS",), "zh-TW": ("CHT",),
"ja": ("JP",), "ko": ("KR",), "vi": ("VI",), "id": ("ID",),
"es": ("ES",), "fr": ("FR",), "de": ("DE",), "ru": ("RU",), "pt": ("PT",),
}
TEXT_FIELDS = ("ItemName", "ItemDesc", "ItemBGDesc")
ICON_FIELDS = ("ItemIconPath", "ItemCurrencyIconPath", "ItemAvatarIconPath", "ItemFigureIconPath")
def request_bytes(url: str, attempts: int = 4) -> bytes:
request = urllib.request.Request(url, headers={"User-Agent": "GaC-Srtool-item-catalog/1.0"})
last_error = None
for attempt in range(attempts):
try:
with urllib.request.urlopen(request, timeout=90) as response:
return response.read()
except (OSError, urllib.error.URLError) as error:
last_error = error
if attempt + 1 < attempts:
time.sleep(1.5 * (attempt + 1))
raise RuntimeError(f"Could not download {url}: {last_error}")
def request_json(url: str):
return json.loads(request_bytes(url))
def cache_path(cache_dir: Path, key: str) -> Path:
return cache_dir / (re.sub(r"[^A-Za-z0-9_.-]+", "_", key) + ".json")
def cached_json(url: str, cache_dir: Path, key: str):
path = cache_path(cache_dir, key)
if not path.exists():
path.parent.mkdir(parents=True, exist_ok=True)
payload = request_bytes(url)
temporary = path.with_suffix(".tmp")
temporary.write_bytes(payload)
temporary.replace(path)
return json.loads(path.read_bytes())
def gitlab_api(project: str, endpoint: str) -> str:
return f"https://gitlab.com/api/v4/projects/{urllib.parse.quote(project, safe='')}/{endpoint}"
def gitlab_raw(project: str, revision: str, file_path: str) -> str:
encoded = urllib.parse.quote(file_path, safe="")
return gitlab_api(project, f"repository/files/{encoded}/raw?ref={revision}")
def discover_files(project: str, revision: str, directory: str) -> list[str]:
names: list[str] = []
page = 1
while True:
query = urllib.parse.urlencode({
"ref": revision, "path": directory, "recursive": "true", "per_page": 100, "page": page,
})
response = request_json(gitlab_api(project, f"repository/tree?{query}"))
names.extend(entry["path"] for entry in response if entry.get("type") == "blob")
if len(response) < 100:
break
page += 1
if page > 100:
raise RuntimeError(f"Unexpectedly large file listing under {directory}")
return sorted(names)
def fetch_game_json_files(paths: list[str], revision: str, cache_dir: Path) -> dict[str, object]:
result: dict[str, object] = {}
def load_one(path: str):
return path, cached_json(gitlab_raw(GAME_PROJECT, revision, path), cache_dir, f"game_{path}")
with ThreadPoolExecutor(max_workers=8) as pool:
futures = [pool.submit(load_one, path) for path in paths]
for future in as_completed(futures):
path, value = future.result()
result[path] = value
return result
def parse_rarity(value, index_row=None) -> int | None:
if isinstance(value, int):
return value if 1 <= value <= 5 else None
if index_row and isinstance(index_row.get("rarity"), int):
rarity = index_row["rarity"]
return rarity if 1 <= rarity <= 5 else None
rarity = str(value or "").lower()
for label, number in (("superrare", 5), ("veryrare", 5), ("rare", 4), ("notnormal", 3), ("normal", 2), ("low", 1)):
if label in rarity:
return number
return None
def item_hash(row: dict, field: str):
value = row.get(field)
if isinstance(value, dict):
value = value.get("Hash")
if value is None or value == "":
return None
return str(value)
def row_image_paths(row: dict) -> list[str]:
values = []
for field in ICON_FIELDS:
value = row.get(field)
if isinstance(value, str) and value and value not in values:
values.append(value.replace("\\", "/").lstrip("/"))
return values
def rows_preference(path: str) -> tuple[int, str]:
base = Path(path).name
if base == "ItemConfig.json":
return 0, path
if base in ("ItemConfigEquipment.json", "ItemConfigRelic.json"):
return 1, path
return 2, path
def resolve_source_icon(game_paths: list[str], category: str, item_id: int, indexes: dict, asset_files: set[str]) -> str | None:
index_group = {"item": "items", "lightcone": "light_cones", "relic": "relics"}[category]
index_row = indexes.get("en", {}).get(index_group, {}).get(str(item_id))
if isinstance(index_row, dict):
icon = index_row.get("icon")
if isinstance(icon, str) and icon in asset_files:
return icon
for source_path in game_paths:
candidates: list[str] = []
if source_path.startswith("SpriteOutput/ItemIcon/LightConeIcons/"):
candidates.append(f"icon/light_cone/{item_id}.png")
if source_path.startswith("SpriteOutput/ItemIcon/RelicIcons/"):
relic_row = indexes.get("en", {}).get("relics", {}).get(str(item_id))
if isinstance(relic_row, dict):
candidates.append(relic_row.get("icon", ""))
if source_path.startswith("SpriteOutput/ItemIcon/"):
suffix = source_path.removeprefix("SpriteOutput/ItemIcon/")
candidates.extend((f"icon/item/{suffix}", f"icon/{suffix}"))
if source_path.startswith("SpriteOutput/AvatarIcon/Avatar/"):
suffix = source_path.removeprefix("SpriteOutput/AvatarIcon/Avatar/")
candidates.extend((f"image/character_portrait/{suffix}", f"icon/avatar/{suffix}"))
if source_path.startswith("SpriteOutput/AvatarRoundIcon/Avatar/"):
suffix = source_path.removeprefix("SpriteOutput/AvatarRoundIcon/Avatar/")
candidates.append(f"icon/avatar/{suffix}")
if source_path.startswith("SpriteOutput/AvatarShopIcon/Avatar/"):
suffix = source_path.removeprefix("SpriteOutput/AvatarShopIcon/Avatar/")
candidates.extend((f"icon/avatar/{suffix}", f"image/character_portrait/{suffix}"))
if source_path.startswith("SpriteOutput/AvatarShopIcon/AvatarSkin/"):
suffix = source_path.removeprefix("SpriteOutput/AvatarShopIcon/AvatarSkin/")
candidates.extend((f"image/character_portrait/{suffix}", f"icon/item/Skin/{suffix}"))
if source_path.startswith("SpriteOutput/ItemIcon/Skin/"):
suffix = source_path.removeprefix("SpriteOutput/ItemIcon/Skin/")
candidates.extend((f"icon/item/Skin/{suffix}", f"icon/item/{suffix}"))
if source_path.startswith("SpriteOutput/ItemFigures/"):
suffix = source_path.removeprefix("SpriteOutput/ItemFigures/")
candidates.extend((f"image/item/{suffix}", f"image/items/{suffix}"))
for candidate in candidates:
if candidate and candidate in asset_files:
return candidate
return None
def read_asset_indexes(revision: str, cache_dir: Path, asset_files: set[str]) -> dict[str, dict[str, dict]]:
base = f"https://raw.githubusercontent.com/{ASSET_PROJECT}/{revision}/index_new"
kinds = ("items", "light_cones", "relics")
indexes: dict[str, dict[str, dict]] = {}
jobs = {}
with ThreadPoolExecutor(max_workers=12) as pool:
for language, asset_language in ASSET_LANGUAGES.items():
indexes[language] = {}
for kind in kinds:
url = f"{base}/{asset_language}/{kind}.json"
key = f"starrailres_{asset_language}_{kind}"
jobs[pool.submit(cached_json, url, cache_dir, key)] = (language, kind)
for future in as_completed(jobs):
language, kind = jobs[future]
try:
data = future.result()
except RuntimeError:
# Some locales omit a data family; localized text maps fill its names.
data = {}
if not isinstance(data, dict):
data = {}
indexes[language][kind] = data
# The pinned repository tree is the authority for whether an icon URL exists.
for language in indexes:
for kind, table in indexes[language].items():
for row in table.values():
icon = row.get("icon") if isinstance(row, dict) else None
if icon and icon not in asset_files:
row.pop("icon", None)
return indexes
def textmap_files_by_language(paths: list[str]) -> dict[str, list[str]]:
result = {}
for language, tokens in TEXTMAP_TOKENS.items():
matched = []
for path in paths:
name = Path(path).name.upper()
if not name.startswith("TEXTMAP") or not name.endswith(".JSON"):
continue
token = name[len("TEXTMAP"):-len(".JSON")].split("_")[0]
if token in tokens:
matched.append(path)
result[language] = sorted(matched)
return result
def localized_textmaps(paths: list[str], revision: str, cache_dir: Path, wanted_hashes: set[str]) -> dict[str, dict[str, str]]:
maps: dict[str, dict[str, str]] = {language: {} for language in TEXTMAP_TOKENS}
by_language = textmap_files_by_language(paths)
for language, files in by_language.items():
if not files or not wanted_hashes:
continue
print(f"Reading {language} text maps ({len(files)} file(s))", flush=True)
for path in files:
data = cached_json(gitlab_raw(GAME_PROJECT, revision, path), cache_dir, f"game_{path}")
if isinstance(data, dict):
for key in wanted_hashes:
value = data.get(key)
if isinstance(value, str) and value:
maps[language][key] = value
del data
print(f" localized strings: {len(maps[language])}", flush=True)
return maps
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--inventory-config", required=True, type=Path, help="Go resource InventoryItemConfig.json")
parser.add_argument("--output", type=Path, default=Path("assets/item-catalog.json"))
parser.add_argument("--cache-dir", type=Path, default=Path(tempfile.gettempdir()) / "gac-srtool-item-catalog-cache")
args = parser.parse_args()
inventory = json.loads(args.inventory_config.read_text(encoding="utf-8"))
game_revision = inventory["source"]["revision"]
supported_ids = {int(value) for value in inventory["item_ids"]}
supported_lcs = {int(row["id"]) for row in inventory.get("lightcones", [])}
supported_relics = {int(row["relic_id"]) for row in inventory.get("relics", [])}
supported_ids.update(supported_lcs)
supported_ids.update(supported_relics)
asset_revision = "dbe8cdfcfb0bf657b9fe1cf92d5537f118ccb487"
print("Discovering game item tables...", flush=True)
excel_files = discover_files(GAME_PROJECT, game_revision, "ExcelOutput")
candidates = [path for path in excel_files if "ItemConfig" in Path(path).name and path.lower().endswith(".json")]
tables = fetch_game_json_files(candidates, game_revision, args.cache_dir)
item_rows: dict[int, list[tuple[str, dict]]] = {}
table_scan = []
for path in sorted(candidates):
data = tables[path]
valid_rows = [row for row in data if isinstance(row, dict) and isinstance(row.get("ID"), int) and row.get("ID") > 0 and isinstance(row.get("ItemMainType"), str)] if isinstance(data, list) else []
table_scan.append({"table": path, "rows": len(data) if isinstance(data, list) else 0, "itemRows": len(valid_rows)})
for row in valid_rows:
item_rows.setdefault(row["ID"], []).append((path, row))
definition_tables = [row["table"] for row in table_scan if row["itemRows"]]
if not item_rows:
raise RuntimeError("No item definition rows were found in ItemConfig tables")
print(f"Accepted {len(definition_tables)} tables; {sum(row['itemRows'] for row in table_scan)} rows; {len(item_rows)} unique IDs", flush=True)
print("Reading pinned asset index...", flush=True)
tree_url = f"https://api.github.com/repos/{ASSET_PROJECT}/git/trees/{asset_revision}?recursive=1"
tree = request_json(tree_url)
if tree.get("truncated"):
raise RuntimeError("Pinned asset tree was truncated; refusing incomplete image coverage")
asset_files = {entry["path"] for entry in tree.get("tree", []) if entry.get("type") == "blob"}
indexes = read_asset_indexes(asset_revision, args.cache_dir, asset_files)
hashes = set()
for rows in item_rows.values():
for _, row in rows:
for field in TEXT_FIELDS:
value = item_hash(row, field)
if value:
hashes.add(value)
print(f"Resolving {len(hashes)} game text keys across 13 locales...", flush=True)
textmap_paths = discover_files(GAME_PROJECT, game_revision, "TextMap")
textmaps = localized_textmaps(textmap_paths, game_revision, args.cache_dir, hashes)
existing_item_names = indexes.get("en", {}).get("items", {})
existing_lc_names = indexes.get("en", {}).get("light_cones", {})
existing_relic_names = indexes.get("en", {}).get("relics", {})
merged = []
name_coverage = {language: 0 for language in ASSET_LANGUAGES}
description_coverage = {language: 0 for language in ASSET_LANGUAGES}
background_description_coverage = {language: 0 for language in ASSET_LANGUAGES}
for item_id in sorted(item_rows):
source_rows = sorted(item_rows[item_id], key=lambda pair: rows_preference(pair[0]))
all_rows = [row for _, row in source_rows]
all_paths = []
for row in all_rows:
for path in row_image_paths(row):
if path not in all_paths:
all_paths.append(path)
preferred = all_rows[0]
if item_id in supported_lcs:
category, index_kind = "lightcone", "light_cones"
elif item_id in supported_relics:
category, index_kind = "relic", "relics"
else:
category, index_kind = "item", "items"
index_rows = indexes.get("en", {}).get(index_kind, {})
index_row = index_rows.get(str(item_id), {}) if isinstance(index_rows, dict) else {}
name_hash = next((item_hash(row, "ItemName") for _, row in source_rows if item_hash(row, "ItemName")), None)
desc_hash = next((item_hash(row, "ItemDesc") for _, row in source_rows if item_hash(row, "ItemDesc")), None)
bg_desc_hash = next((item_hash(row, "ItemBGDesc") for _, row in source_rows if item_hash(row, "ItemBGDesc")), None)
names = {}
descriptions = {}
background_descriptions = {}
for language in ASSET_LANGUAGES:
locale_index = indexes.get(language, {}).get(index_kind, {})
locale_row = locale_index.get(str(item_id), {}) if isinstance(locale_index, dict) else {}
textmap = textmaps.get(language, {})
name = textmap.get(name_hash) if name_hash else None
if not name and isinstance(locale_row, dict):
name = locale_row.get("name")
if not name and isinstance(index_row, dict):
name = index_row.get("name")
if name:
names[language] = name
name_coverage[language] += 1
desc = textmap.get(desc_hash) if desc_hash else None
if not desc and isinstance(locale_row, dict):
desc = locale_row.get("desc")
if desc and language:
descriptions[language] = desc
description_coverage[language] += 1
bg_desc = textmap.get(bg_desc_hash) if bg_desc_hash else None
if bg_desc:
background_descriptions[language] = bg_desc
background_description_coverage[language] += 1
# Fill sparse locales with the English name only if the source has no localized text.
english_name = names.get("en") or (index_row.get("name") if isinstance(index_row, dict) else None) or f"Item {item_id}"
for language in ASSET_LANGUAGES:
names.setdefault(language, english_name)
icon = resolve_source_icon(all_paths, category, item_id, indexes, asset_files)
rarity = parse_rarity(preferred.get("Rarity"), index_row)
output_row = {
"id": item_id,
"category": category,
"type": preferred.get("ItemMainType", ""),
"subType": preferred.get("ItemSubType", ""),
"rarity": rarity,
"names": names,
"descriptions": descriptions,
"backgroundDescriptions": background_descriptions,
"icon": icon,
"gameIconPaths": all_paths,
"sourceTables": sorted({path for path, _ in source_rows}),
"supported": item_id in supported_ids,
}
pile_limit = next((row.get("PileLimit") for _, row in source_rows if isinstance(row.get("PileLimit"), int)), None)
if pile_limit:
output_row["pileLimit"] = pile_limit
if category == "lightcone":
output_row["path"] = index_row.get("path") if isinstance(index_row, dict) else None
elif category == "relic":
if isinstance(index_row, dict):
output_row["setId"] = int(index_row["set_id"]) if str(index_row.get("set_id", "")).isdigit() else None
output_row["slot"] = index_row.get("type")
merged.append(output_row)
counts = {
"total": len(merged),
"definitionRows": sum(row["itemRows"] for row in table_scan),
"uniqueIds": len(merged),
"supported": sum(row["supported"] for row in merged),
"withImages": sum(bool(row["icon"]) for row in merged),
"withoutConfiguredImage": sum(not row["icon"] for row in merged),
"withDescriptions": sum(bool(row["descriptions"] or row["backgroundDescriptions"]) for row in merged),
"nameCoverageByLanguage": name_coverage,
"descriptionCoverageByLanguage": description_coverage,
"backgroundDescriptionCoverageByLanguage": background_description_coverage,
"candidateTables": len(candidates),
"definitionTables": len(definition_tables),
}
output = {
"source": {
"gameRepository": f"https://gitlab.com/{GAME_PROJECT}",
"gameRevision": game_revision,
"candidateTables": len(candidates),
"gameTables": definition_tables,
"tableScan": table_scan,
"assetRepository": ASSET_PROJECT,
"assetRevision": asset_revision,
"assetBaseUrl": f"https://cdn.jsdelivr.net/gh/{ASSET_PROJECT}@{asset_revision}/",
"assetFallbackBaseUrl": f"https://raw.githubusercontent.com/{ASSET_PROJECT}/{asset_revision}/",
"languages": list(ASSET_LANGUAGES),
"notes": "Includes every ItemConfig table with item-definition rows at the pinned game-data revision. Items absent from InventoryItemConfig are browse-only; the catalog does not add or summon items. Icons use only files present in the pinned public StarRailRes tree. gameIconPaths retain the source paths for items without a mapped public icon.",
},
"counts": counts,
"items": merged,
}
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(output, ensure_ascii=False, separators=(",", ":")) + "\n", encoding="utf-8")
print(json.dumps(counts, ensure_ascii=False, indent=2), flush=True)
print(f"Wrote {len(merged)} item rows to {args.output}", flush=True)
return 0
if __name__ == "__main__":
try:
raise SystemExit(main())
except Exception as error: # give the CLI one actionable line on network/schema failures
print(f"item catalog build failed: {error}", file=sys.stderr)
raise
+59
View File
@@ -0,0 +1,59 @@
// Regression check for the actual server envelopes and the independent selector.
const { readFileSync } = require('node:fs');
const { join } = require('node:path');
const vm = require('node:vm');
const assert = require('node:assert/strict');
const source = readFileSync(join(__dirname, '..', 'js', 'app.js'), 'utf8');
const start = source.indexOf('async function loadAhaHelpSettings()');
const end = source.indexOf('// Render Ex-Rank Cards', start);
assert(start >= 0 && end > start, 'settings function boundaries');
async function run(persistent, helpFails = false) {
const select = { disabled: true, value: '', options: [], replaceChildren(...options) { this.options = options; }, add(option) { this.options.push(option); } };
const save = { disabled: true };
const status = { dataset: {} };
const statusText = { textContent: '' };
const el = { toggleSwGlobal: {}, toggleCastoriceGlobal: {}, toggleAhaGlobal: {}, persistentMcSelect: {}, persistentMarchSelect: {} };
const calls = [];
const context = vm.createContext({
state: { serverMode: 'gac', isConnected: true }, el,
document: { getElementById: id => ({
'aha-help-level': select,
'btn-save-aha-help': save,
'aha-help-status': status,
'aha-help-status-text': statusText
})[id] || null },
Option: function(text, value) { this.text = text; this.value = value; },
t: (key, vars = {}) => ({
ahaHelpLoading: 'Loading levels…', ahaHelpLegacyTitle: 'Use FreeSR setting',
ahaHelpOffTitle: 'Off', ahaHelpNoLevels: 'No levels', ahaHelpConnect: 'Connect to GaC',
ahaHelpStatusSaved: 'Saved', ahaHelpLoadError: 'Could not load levels: {error}',
enabled: 'enabled', disabled: 'disabled'
}[key] || key).replace(/\{(\w+)\}/g, (_, name) => vars[name] ?? `{${name}}`),
console: { warn() {} }, savePersistentCache() {},
apiCall: async endpoint => {
calls.push(endpoint);
if (endpoint === '/api/aha-help') {
if (helpFails) throw Error('HTTP 404');
return { status: 200, level: 0, levels: [{ BuffLevel: 1 }, { BuffLevel: 2 }, { BuffLevel: 3 }] };
}
return persistent;
}
});
vm.runInContext(source.slice(start, end), context);
await vm.runInContext('loadPersistentSettings()', context);
return { select, save, el, calls };
}
(async () => {
const result = await run({ status: 200, persistent: { enable_aha_global: false } });
assert.equal(result.select.disabled, false);
assert.equal(result.save.disabled, false);
assert.equal(result.select.value, '0');
assert.equal(result.select.options.length, 5);
assert.equal(result.el.toggleAhaGlobal.checked, false);
const withoutCharacterData = await run({ status: 200 });
assert.equal(withoutCharacterData.select.disabled, false, 'Aha loader must not depend on character cache');
const failed = await run({ status: 200, persistent: {} }, true);
assert.equal(failed.save.disabled, true);
assert.match(failed.select.options[0].text, /HTTP 404/);
console.log('Aha Help: server envelope, empty character cache, explicit off and API failure checks passed.');
})().catch(error => { console.error(error); process.exitCode = 1; });
+18
View File
@@ -0,0 +1,18 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { COMMANDS, inspectCommand, completeCommand } from '../js/command-assistant.mjs';
const catalogs={avatars:[{value:'1001',label:'March 7th'},{value:'1308',label:'Acheron'}],items:[{value:'101',label:'Item 101'}],planes:[{value:'20',label:'Plane 20'}],floors:[{value:'201',plane:20},{value:'301',plane:30}],cw_roles:[{value:'500',star:1},{value:'500',star:2},{value:'600',star:3}]};
test('every supported command has preview and help',()=>{
for(const cmd of COMMANDS){const value=cmd.path.join(' ')+' ';const m=inspectCommand(value,value.length,catalogs);assert.ok(m.command);assert.equal(m.command,cmd);assert.ok(m.preview.includes(cmd.path[0]));assert.ok(m.hint);}
});
test('all roots are browsable, no six-row truncation',()=>{const m=inspectCommand('/',1);assert.ok(m.suggestions.length>6);assert.ok(m.suggestions.some(s=>s.value==='/faketime'));assert.ok(m.suggestions.some(s=>s.value==='/cw'));});
test('Tab completion advances through command, avatar, level, rank without running',()=>{
let text='/ava';let m=inspectCommand(text,text.length,catalogs);let r=completeCommand(text,m,m.suggestions[0]);assert.equal(r.value,'/avatar ');
m=inspectCommand(r.value,r.caret,catalogs);assert.equal(m.active.name,'id');r=completeCommand(r.value,m,m.suggestions[0]);assert.equal(r.value,'/avatar 1001 ');
m=inspectCommand(r.value,r.caret,catalogs);assert.equal(m.active.name,'level');r=completeCommand(r.value,m,m.suggestions.find(x=>x.value==='80'));
m=inspectCommand(r.value,r.caret,catalogs);assert.equal(m.active.name,'rank');assert.equal(m.suggestions.length,7);
});
test('find by entity name, replace only token at caret, preserve suffix',()=>{const text='/avatar ach 80 6';const m=inspectCommand(text,11,catalogs);assert.equal(m.suggestions[0].value,'1308');const r=completeCommand(text,m,m.suggestions[0]);assert.equal(r.value,'/avatar 1308 80 6');});
test('CW nested options and resource-backed stars',()=>{let m=inspectCommand('/cw ',4,catalogs);assert.ok(m.suggestions.some(s=>s.value==='gold'));m=inspectCommand('/cw role 500 ',13,catalogs);assert.deepEqual(m.suggestions.map(s=>s.value),['1','2']);});
test('floors belong to selected plane and required arguments remain visible',()=>{let m=inspectCommand('/teleport 20 ',13,catalogs);assert.deepEqual(m.suggestions.map(s=>s.value),['201']);m=inspectCommand('/give ',6,catalogs);assert.deepEqual(m.missing,['item_id']);assert.equal(m.active.name,'item_id');});
test('faketime optional modes and unknown commands do not fabricate matches',()=>{let m=inspectCommand('/faketime ',10,catalogs);assert.ok(m.suggestions.some(s=>s.value==='off'));m=inspectCommand('/nope',5,catalogs);assert.equal(m.command,null);assert.equal(m.suggestions.length,0);});
+4
View File
@@ -0,0 +1,4 @@
{
"buildCommand": "node scripts/build-vercel.cjs",
"outputDirectory": "dist"
}
+2 -2
View File
@@ -1,5 +1,5 @@
{
"branch": "main",
"branch": "test-gay",
"version": "1.0.0",
"updatedAt": "2026-10-17T05:11:28.794Z"
"updatedAt": "2026-10-31T17:15:16.482Z"
}