Files
Snap.Hutao.Docs/docs/zh/advanced/Gacha-system-and-export-principal.md
Mikachu2333 b8ceb907c7 QA Update (#133)
* update

* win10 uninstall

* add notes about root

* format

* modify

* update

* Update FAQ.md

* Update navbar

* Update docs

* Update Gacha-system-and-export-principal.md

* correct

* update

* disambig

* update

* add warning for auto-start (need re-update)

* update

* add a tabular for showing differences in each way for sync

* center tabular

* switch to md format

* update vs

* add some

* RE-update tabualr

* update

* correct

* update

* move web login to the end

* Update game-launcher.md

* Update docs

* Update character-data.md

---------

Co-authored-by: LinkChou <linkchou@yandex.com>
Co-authored-by: Masterain <i@irain.in>
2024-06-29 00:18:14 -07:00

69 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
headerDepth: 2
category: [FAQ]
icon: iconfont icon-read
order: 8
comment: false
description: Snap Hutao 使用多种方式获取用户的登录信息并配合原神 API 获取祈愿记录。
banner: https://opengraph.snapgenshin.cn/generate?url=https://hut.ao/zh/advanced/Gacha-system-and-export-principal.html&has_description=False
---
# 祈愿系统与导出原理
> Gacha System and Principal
胡桃的祈愿系统相较 Snap Genshin 进行了整体架构上的重新设计。
本文将解释原神的祈愿记录机制和胡桃工具箱祈愿导出功能的技术原理。
## 祈愿的获取
获取祈愿记录需要请求米哈游的 API
关于此 API, 有下列几个注意点
- 通过米哈游服务器的 API只能查询到过去 6 个月内的祈愿记录
- 这也是原神客户端中祈愿记录的来源
- API 存在请求速率限制,过快的请求会导致后续的请求失败,无法正常获取数据
为了请求此 API我们需要四个关键参数
- 目前有下列几种方法可以获取这些参数
- 遍历 Unity 的日志文件,查找用户打开的祈愿记录 URL
- 代理本机流量,筛选祈愿记录 URL
- 查找 CefBrowser 的浏览器缓存,找到祈愿记录 URL
- 对于包含了 Stoken 的 Cookie调用 genAuthKey API,获取参数
- 高级用户手动输入相关 URL
在请求 API 后可以获取到零散的祈愿记录,在对其进行拼接后即可获得一份完整的祈愿记录列表
## 祈愿的存储
获得完整的祈愿记录列表后即可将其简单的序列化入本地数据库内,在需要时可从数据库中反序列化出来呈现给用户。
后续的对服务器的请求只需要对比数据库中的数据请求新增的部分即可。
这样,用户即可长期地保存帐号的完整祈愿记录
## UIGF 格式
> 统一可交换祈愿记录标准
>
> Uniformed Interchangeable GachaLog Format standard
UIGF 是由我们联合其他祈愿记录应用倡导、推出并**持久维护**的一个统一的祈愿记录数据交换标准
标准化的数据格式将允许用户将祈愿记录在不同的转移数据,以使用到不同原神工具中各自的特色功能
### 祈愿的导入
在使用 UIGF 数据格式的前提下,可以导入曾在其他应用中储存的数据
胡桃在处理导入时会对比本地储存中存在的最早的索引ID并仅导入较老的数据
(因为始终可以从米哈游的服务器获取较新的数据,这种原始数据有更高的精确度)
### 祈愿的导出
胡桃可以将祈愿记录以 UIGF 数据格式保存为文件并输出到用户指定的文件夹中