HearthstoneBot

https://github.com/ChuckFork/HearthstoneBot

Sigmund

Card game automation framework

Hooks game and loads plugins as they are modified (or explicitly requested to be reloaded). All plugins are run in separate threads (which are killed if the plugin is reloaded). Plugin libraries are rewritten to have different names to allow loading of multiple versions (thus the psuedo reload mechanic).

Developers just need to hit rebuild when working on a plugin to immediately see the effects in game.

 

Setup

  1. If needed, update ext/ with new Assembly-CSharp.dll, Mono.Cecil.dll (match the version Unity uses internally), and UnityEngine.dll
  2. Fix hardcoded paths in Injector.cs and Sigmund.cs (basically, point to location of ext/ and plugins/)
  3. Run injector to create patched Assembly-CSharp.dll which loads Sigmund.dll
  4. Start game launcher. It will revert all game files to the originals
  5. Rebuild the plugin or Sigmund, this will cause the patched Assembly-CSharp.dll to get copied to game directory
  6. Start game and click through until you reach main Hub menu.

You can open the dev console (Ctrl-Enter) and type "echo my message" to display "my message" to the screen.

 

1.首先是替换ext目录下的dll文件

Mono.Cecil的版本可以从nuget拿

<packages>
<package id="Mono.Cecil" version="0.9.6.0" targetFramework="net40" />
</packages

2. 修改2个cs文件中硬编码的路径

3.

在编译Injector项目的时候,发现会顺便编译Sigmund项目

Sigmund会把ext文件夹下的文件,覆盖到炉石的安装包下面

rem copy /Y "$(SolutionDir)\ext\$(TargetFileName)" "C:\Program Files (x86)\Hearthstone\Hearthstone_Data\Managed\$(TargetFileName)"
rem copy /Y "$(SolutionDir)\ext\Assembly-CSharp.dll" "C:\Program Files (x86)\Hearthstone\Hearthstone_Data\Managed\Assembly-CSharp.dll"

copy命令的第一个参数是source,第二个参数是target,/Y是直接覆盖的意思

 

Usage

  1. TestPlugin will load automatically (comment out line in Sigmund.Main.Start to disable)
  2. Modify or create any files in plugins/ directory will cause them to be (re)loaded
  3. Open dev console (Ctrl-Enter) and type "run somePlugin" will (re)load the somePlugin.dll in plugins/

 

Projects

Injector: patches Assembly-CSharp.dll to load Sigmund.dll (our loader)

Sigmund: loader which watches filesystem and the game's dev console to trigger (re)loading plugins (after doing minor rewriting)

TestPlugin: example plugin to automate playing against practice AI

HearthstoneExtract: placeholder (you'll have to find it elsewhere) for disassembled source from an older version of the game. Kept in the solution for easy searching (eg. find all references) but not always 100% correct. Use Reflector on the current Assembly-CSharp to double check.

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(761)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-07-15 Install the IIS 6.0 Management Compatibility Components in Windows 7 or in Windows Vista from Control Panel
2016-07-15 Task
2015-07-15 WCF 托管在IIS中遇到Http的错误
2015-07-15 Default Web Site
2015-07-15 Learning WCF Chapter1 Hosting a Service in IIS
2015-07-15 git subtree 拆分split repository
点击右上角即可分享
微信分享提示