[译]网页游戏Travian的自动任务工具
By robot-v1.0
本文链接 https://www.kyfws.com/applications/auto-task-tool-for-web-game-travian-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 8 分钟阅读 - 3609 个词 阅读量 0[译]网页游戏Travian的自动任务工具
原文地址:https://www.codeproject.com/Articles/19701/Auto-Task-Tool-for-Web-Game-Travian
原文作者:HasAName
译文由本站 robot-v1.0 翻译
前言
Developing Auto-Task Tool for Web Game Travian
为网页游戏Travian开发自动任务工具
- 下载可执行文件(mila的1.0.0.8)-731.2 KB(Download executable (1.0.0.8 by mila) - 731.2 KB)
- 下载可执行文件(1.0.0.1)-1,170.6 KB(Download executable (1.0.0.1) - 1,170.6 KB)
- 下载源文件(1.0.0.1)-1,085.6 KB(Download source files (1.0.0.1) - 1,085.6 KB)
- 下载TravianAutoTaskHelp_EN.zip(1.0.0.1)-377.5 KB(Download TravianAutoTaskHelp_EN.zip (1.0.0.1) - 377.5 KB)
- 下载TravianAutoTaskHelp_CN.zip(1.0.0.1)-451.4 KB(Download TravianAutoTaskHelp_CN.zip (1.0.0.1) - 451.4 KB)
介绍(Introduction)
特拉维安(Travian) 是古代欧洲部落战争的网页游戏.我开发了此工具来自动完成任务.(is a web game of an ancient European tribal war. I developed this tool to automatically accomplish tasks.)
任务类别(Tasks Category)
当前,支持六种Travian任务:(Currently, there are six kinds of Travian tasks supported:)
- 升级任务(升级资源或建筑物)(Upgrade task (upgrading resources or buildings))
- 构建任务(构建任务)(Build task (the build task))
- 开发任务(用于学院,军械库和铁匠铺)(Develop task (used for Academy, Armoury and Blacksmith))
- 训练部队任务(用于营房,马able,车间,宫殿和住所)(Training troop task (used for Barracks, Stable, Workshop, Palace and Residence))
- 传输资源任务(用于市场)(Transporting resource task (used for Marketplace))
- 部队派遣任务(用于集结点)(Troop dispatch task (used for rally point))
特征(Features)
- 支持多线程.任务队列可以在单独的线程中执行.(Supports multiple threads. Tasks queue can be executed in a separated thread.)
- 支持事件日志.事件可以记录到文件和UI窗口.事件日志支持多个线程.(Supports event log. Event can log to file and UI window. Event log supports multiple threads.)
- 支持HTTP Get/Post方法,原始cookie,UTF-8编码/解码,gzip解压缩和URL编码/解码.基于MFC类的HTTP函数(Supports HTTP Get/Post method, raw cookie, UTF-8 encode/decode, gzip decompression, and URL encode/decode. HTTP functions based on the MFC class)
CInternetSession
,因此依赖性较低.(, so it’s less dependent.) - HTTP响应解压缩使用类(HTTP Response decompression uses class)
Gunzip
在Crypto ++中,这是C ++加密方案的类库.参考(in Crypto++, which is a C++ Class Library of Cryptographic Schemes. Refer to) 加密++(Crypto++) .(.) - 使用正则表达式解析HTML,因此结构紧凑.(Uses Regular expressions to parse HTML, so it’s compact.)
- 一旦分配了任务文件,Travian服务器和用户名/密码,所有任务将在无人值守的情况下完成.(Once assigned tasks file, Travian server and user name/password, all tasks are accomplished unattended.)
编译源代码(Compile Source Code)
该项目由VC8.0.50727(VC2005 SP1)构建.在编译源项目之前,您需要编译(This project is built by VC8.0.50727 (VC2005 SP1). Before compiling the source project, you need to compile the) cryptopp54
首先进行项目.的(project first. The) cryptopp54
该项目位于Travian的源代码目录的" cryptopp54"子文件夹中.然后放置(project is located in the “cryptopp54” sub-folder of Travian’s source code directory. Then place)cryptlibD.lib(cryptlibD.lib)(调试版本)或((Debug build) or)cryptlib.lib(cryptlib.lib)(发布版本)在Travian源代码文件夹中.((Release build) in the Travian source code folder.)
主要课程说明(Description of Main Classes)
|类名(Class Name)
|描述(Description)
|类依赖(Class Dependencies) (除了MFC/STL)((Apart from MFC/STL))
CAboutDlg |
|关于对话框(About dialog)
| CHyperLink
|
| CEventLog
|事件缓冲区管理,将事件记录到文件并通知注册的窗口以获取新事件.(Event buffer management, log event to file and notify registered windows to fetch new events.)
| ``
|
| CHttpClient
|发送HTTP请求并获取HTTP响应.支持Get/Post方法,gzip解压缩,URL编码/解码,UTF-8编码/解码,原始cookie.(Send HTTP Request and get HTTP response. Support Get/Post method, gzip decompression, URL encode/decode, UTF-8 encode/decode, raw cookie.)
| ``
|
| CURLEncDec
|URL编码/解码.(URL encode/decode.)
| ``
|
| CRegex
|ATL正则表达式类的封装(Encapsulation for ATL regular expression class) CAtlRegExp<>
,由Paul DiLascia撰写.(, written by Paul DiLascia.)
| ``
|
| CTravianTask
|Travian任务基类,显示升级任务.给定任务的URL和特殊标记,它解析HTML表单字段.如果玩家有多个村庄,则为(Travian tasks base class, which presents the upgrade tasks. It parses HTML form fields given tasks' URL and special tag mark. If player has more than one village, then is) CTravianTask
负责更换当前的村庄.(responsible for switching current villages.) CTravianTask
还提供了(also provides a) static
函数从任务文件中解析任务.(function to parse tasks from the tasks file.)
| CHttpClient
, CEventLog
|
| CTravianTaskBuild
| CTravianTaskBuild
is CTravianTask
儿童班.它介绍了构建任务.(child class. It presents the build task.)
| CTravianTask
, CEventLog
|
| CTravianTaskDevelop
| CTravianTaskDevelop
是一个(is a) CTravianTask
儿童班.它提出了开发任务.(child class. It presents the develop task.)
| CTravianTask
, CEventLog
|
| CTravianTaskTrain
| CTravianTaskTrain
is CTravianTask
儿童班.它提出了部队训练任务.(child class. It presents the troop training task.)
| CTravianTask
, CEventLog
|
| CTravianTaskResourceTransport
| CTravianTaskResourceTransport
是一个(is a) CTravianTask
儿童班.它提出了资源运输任务.(child class. It presents the resource transporting task.)
| CTravianTask
, CEventLog
|
| CTravianTaskDispatchTroop
| CTravianTaskDispatchTroop
是一个(is a) CTravianTask
儿童班.它提出了部队派遣任务.(child class. It presents the troop dispatch task.)
| CTravianTask
, CEventLog
|
| CTravianTaskDispatchTroop
| CTravianTaskDispatchTroop
是一个(is a) CTravianTask
儿童班.它提出了部队派遣任务.(child class. It presents the troop dispatch task.)
| CTravianTask
, CEventLog
|
| Tasks
|的typedef(typedef of the) CTravianTask
向量.它用作任务队列.(* vector. It’s used as tasks queue.*)
| CTravianTask
|
| CTravianTaskSchedule
|计划任务队列的线程.(Schedule thread for the tasks queue.)
| CTravianTask
, Tasks
, CEventLog
|
| CThreadSchedule
|计划任务队列的线程.(Schedule thread for the tasks queue.)
| CTravianTaskSchedule
, CEventLog
|
| CFormTask
|任务参数的表单视图.(Form view for tasks parameter.)
| CThreadSchedule
, CEventLog
|
| CViewOutput
|事件输出视图.(Event output view.)
| CEventLog
|
| CViewTaskList
|查看任务列表.(View for tasks list.)
| Tasks
|
历史(History)
- 初始发行版:1.0.0.0(2007年7月23日)(Initial Release: 1.0.0.0 (23 July 2007))
- 发行:1.0.0.1(2007年8月18日)(Release: 1.0.0.1 (18 August 2007)) 修复了解析负村庄坐标数的问题.(Fixed parsing negative village coordinate number problem.)
- Mila发布的1.0.0.8(1.0.0.8 released by mila)
此版本中有什么新内容?(What’s New in This Release?)
-
修正部队派遣错误(Troop dispatch bug fixed)
-
**user.ini(user.ini)**文件.如果该文件存在,程序将逐行读取它.在各行中,您可以指定:(file. If this file exists, the program read it line by line. In the lines you can specify:)
-
line:服务器的URL. (例如.(line: URL of the server. (e.g.)s2.travian.hu(s2.travian.hu))())
-
行:用户名(例如habakuk)(line: name of the user (e.g. habakuk))
-
行:密码(例如babzsak)(line: password (e.g. babzsak))
-
行:文件名(例如(line: name of the file (e.g.)task_en.txt(tasks_en.txt))())
-
行:部落类型(例如3)(line: tribe type (e.g. 3)) 部落类型可以是:(The tribe type can be:)
-
罗曼(Roman)
-
特顿(Teuton)
-
瘿(Gall)
-
-
计算足够的资源来完成任务.(Calculation for enough resources to complete the task.) 如果任务运行时资源不足,则程序将计算您有足够的资源来完成任务的时间.这个新日期将被设置为任务的执行日期. (任务列表中的图标将改变以显示这种情况.)(If there is not enough resources in the moment when the task runs, the program calculates the time when you will have enough resources to complete the task. This new date will set as the execution date of the task. (The icon, in the task list, will change for a clock to show this situation.))
-
<DTime>
规格代替(specification instead of)>Time<
表示到上一个任务的日期的偏移量.(means an offset to the date of the previous task.) 这也可以确保任务应按哪个顺序运行.因为(This also ensures in which order the tasks should run. Because the)DTime
任务将始终晚于上一个任务.(task will be always later than the previous task.)Dtime := delata
时间.(time.) -
空时间规范:> Time <>/Time <表示实际日期.(An empty time specification: >Time<>/Time< means the actual date.) 因此,该任务将尽快执行(在2分钟内)(So the task will execute as soon as possible (within 2 min.))
-
新(New)
<Spy>
标签.如果仅将间谍发送到侦察(仅在已派遣的军队中侦察部队类型),则可以在此处指定您感兴趣的内容.间谍的类型可以是1或2.(tag. If you send your spys to scouting only (Scouting troop types only in the dispatched army) you can specify here what you are interested in. The type of spy can be 1 or 2.)- 搜寻资源和单位(scouting resources and units)
- 侦察防御者设备和其他单位(scouting defender devices and other units) 注意!您有责任仅在>部队<…>/部队<部分中发送侦察兵.(NOTE! You are responsible to send only scouters in the >Troop<…>/Troop< section.)
-
在标题上显示用户名和服务器.(Display user name and server on the title.)
-
仅在调试模式下记录HTML.在最终版本中,未记录整个HTML页面.因此,日志文件的大小大大减少了.(Logging HTML only in debug mode. In the final release the whole HTML page was not logged. Therefore the size of the log file decreased dramatically.)
-
日志文件中行首的" ——“显示错误("——” in the beginning of the line in the log file shows an ERROR)
-
列表视图中的任务描述起于较短.列表视图更具可读性.(Task description in the list view has a shorter form. The list view is much more readable.)
-
显示部队名称而不是数字. (需要在(Display the name of the troops instead of the numbers. (Need to define the tribe type in the)**user.ini(user.ini)**文件)(file))
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC8.0 Windows Visual-Studio MFC VS2005 Dev 新闻 翻译