macro#

Macro management.

class wow_wtf_manager.exp.e03_wotlk_backup.macro.Macro(id: int, name: str, icon: str = 'INV_Misc_QuestionMark', content: str = '')[source]#

Represent a WoW Macro, example:

MACRO 3 "InviteTeam" INV_Misc_QuestionMark
/inv char2
/inv char3
/inv char4
/inv char5
END
class wow_wtf_manager.exp.e03_wotlk_backup.macro.MacroTxt(path: str, macros: List[Macro], macros_id_mapper: Dict[int, Macro] = _Nothing.NOTHING, macros_name_mapper: Dict[str, Macro] = _Nothing.NOTHING)[source]#

Represent a macro-cache.txt file.

classmethod parse(path: str) MacroTxt[source]#
Parameters:

path – a macros-cache.txt file

to_file(path: Optional[str] = None)[source]#

Dump to macro.txt file

Parameters:

path – optional file path.

wow_wtf_manager.exp.e03_wotlk_backup.macro.apply_macros_cache_txt(macros_data_file: str, game_client_file: str, plan: bool = False)[source]#

把一个自定义的 macros-cache.txt 中的宏定义合并到游戏客户端中的 macros-cache.txt 中去. 该函数是底层实现, 会被其他函数所调用.

这里要非常注意. 游戏客户端中的宏都是有 ID 的, 这些 ID 是服务器端给自动指定的. 动作条 上的按钮需要靠这些 ID 来找到到底使用哪个宏命令. 如果你有一个宏的内容改了, 名字不变, 但是 你在本地编辑的时候的 ID 和客户端中的 ID 不一致, 那么会出现宏的内容确实更新了, 但是 ID 也变了, 导致动作条上已经放好的按钮消失了. 我们希望避免这一情况.

所以我们在合并的时候, 要根据宏的名字来定位, 如果对已经存在的宏进行修改, 我们不能修改 ID.

Parameters:
  • macros_data_file – 新增和修改的数据

  • game_client_file – 被修改的源文件

  • plan – 是否是 dry_run? (True = dry_run)