Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
MacHu-GWU committed Sep 8, 2022
1 parent 4f5aa8a commit 0ae8c71
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ deploy azerothcore (AC) wotlk wow private server to AWS.

- 纯单机玩家: 需要 1G 内存, 用 ``db.t4g.micro``, $0.384 一天, $11.52 一个月, $140 一年
- 200 人以下: 需要 2G 内存, 用 ``db.t4g.small``, $0.768 一天, $23 一个月, $280 一年
- 1000 人以下: 需要 4G 内存, 用 ``db.t4g.medium``, $15.36 一天, $46 一个月, $560 一年
- 1000 人以下: 需要 4G 内存, 用 ``db.t4g.medium``, $1.536 一天, $46 一个月, $560 一年

参考资料:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ Eluna 是一个允许你在服务端添加 Lua 脚本的模块. 本质上跟 WOW
而 ``OnLogin`` 则是一个函数, 用来处理 PlayerEvent 的数据. 这个函数具体有哪些参数同样可以在 https://github.com/ElunaLuaEngine/Eluna/blob/master/Hooks.h 中找到. 根据文档, 它有两个参数.


E
安装 mod_eluna 的坑
------------------------------------------------------------------------------

在 ``mod_LuaEngine.conf`` 配置文件中的 ``Eluna.ScriptPath`` 选项, 里面的路径最好用绝对路径而不要用相对路径.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
AWS RDS MySQL (其他数据库同理) 有两种备份方式. 一种是基于磁盘全盘备份的 Snapshot, 它记录了某个时刻数据库的全部磁盘的状态. 一种是基于 binlog 的全部历史日志, 可以从 0 恢复数据库.

基于 Snapshot 的方法

优势:

1. AWS 负责自动每天备份和管理
2. 一键从 Snapshot 恢复数据
3. 无需登录, 备份过程容易被自动化

缺点:

1. 收费
2. 如果你的 AWS Account 不用了, 导出比较复杂, 需要分享 KMS key

基于 MySQL Dump 的方法

优势:

1. 备份的内容是数据库中的数据文件, 你有更多的控制

缺点:

1. 需要手动执行, 不容易被自动化


基于 Snapshot 的备份和恢复
------------------------------------------------------------------------------
**备份**



基于 MySQL Dump 的备份和恢复
------------------------------------------------------------------------------

参考资料:

- Backup and Recovery Using MySQL Dump: https://dev.mysql.com/doc/mysql-backup-excerpt/5.7/en/using-mysqldump.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DBC File
==============================================================================
- 在线查看 DBC 数据内容的工具: https://wow.tools/dbc/
- WOTLK 版本 DBC 文件的结构: https://wowdev.wiki/Category:DBC_WotLK
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _wow-client-knowledge:

客户端知识 (WoW Client Knowledge)
==============================================================================
这部分介绍了魔兽世界客户端程序是如何工作的.

目录
------------------------------------------------------------------------------
.. autotoctree::
:maxdepth: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
数据库知识 Database Knowledge
==============================================================================


以物易物的商人
------------------------------------------------------------------------------
游戏中很多商人出售物品的时候都不是直接用金币买的, 而是以物易物. 如果作为 GM 能够自定义各种以物易物的规则, 那么完全可以实现一套自定义的经济体系, 用特定的物品作为货币, 而购买特定的商品都需要用这个特定货币来交换. 我们下面来分析一下这种机制是如何实现的.

我们以达拉然的附魔训练师为例. 这个附魔训练师要求你用 梦境碎片 来换取高阶的附魔配方.

首先在 ``creature_template`` 表中搜索 ``entry = 32514`` 就能找到这个 NPC 的 ID. 她的 ``npcflag = 128``, 根据 `数据库文档 <https://www.azerothcore.org/wiki/creature_template#npcflag>`_ 这个 flag 表示的是她是一个 Vendor.

然后在 ``npc_vendor`` 搜索 ``entry == 32514`` 列出这个 NPC 出售的物品清单. 这个表有一列叫做 ``ExtendedCost`` (详细文档请看 https://www.azerothcore.org/wiki/npc_vendor#extendedcost) 如果这个是 0 则表示该物品是一个普通的用金币购买的物品, 反之则是以物换物. 而这个 ``ExtendedCost`` 对应的是一个规则的 ID. 这个规则就定义了你需要什么物品, 可以是普通物品, 竞技场点数, 荣誉点数等. 我们以 ``item = 37339`` 为例, 这是一个 附魔武器 - 巨人杀手 的配方, 需要 10 个梦境碎片, 对应的 ``ExtendedCost = 2554``.

在游戏客户端中的 ``.MPQ`` 数据包中用工具解压后能看到很多 ``.dbc`` 文件. 这些文件是游戏的数据文件, 客户端有一份, 服务端也有一份. 一些计算都发生在客户端, 不过服务端会跟客户端用 MD5 指纹进行验证, 确保这个文件没有被窜改. 而 `ItemExtendedCost.dbc <https://wowdev.wiki/DB/ItemExtendedCost>`_ 文件就储存了这些信息. 你自己解压一下, 找到 ID = 2554 的一栏, 就能看到它需要 10 个 梦境碎片 (ItemId = 34052) 了.

AC 中有一个特殊的表 ``itemextendedcost_dbc`` 官方文档里没有提, 但是存在于数据库中. 目测是用来在不修改游戏 .dbc 文件的情况下定义额外的 ExtendedCost 而设计的. 2022-09-08 的时候我实验了, 自己定义了一条记录, 但是没有效果. **结论就是现在做不到用数据库的方式自定义以物换物, 用 Lua 应该是可以的**

AC 还有一篇文档 https://www.azerothcore.org/wiki/how-to-import-dbc-data-in-db 介绍了如何修改 DBC 文件并将数据导入到数据库, 但我还没有尝试.

0 comments on commit 0ae8c71

Please sign in to comment.