首页 技术 正文
技术 2022年11月10日
0 收藏 587 点赞 2,222 浏览 4063 个字

错误1 赋值问题

貌似编译器版本有点低,无法识别C#的高级语法糖

属性的初始值,必须是public bool IsEnabled { get{return true;} }

不能写成public bool IsEnabled { get; }=true;

Control

Compiler Error: \Plugins\AutoConcede\AutoConcede.cs(75,38) :

error CS0840: ‘AutoConcede.AutoConcede.Control.get’ must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.
Compiler Error: c:\Users\clu\Desktop\Hearthbuddy 0.3.1446.417\Plugins\AutoConcede\AutoConcede.cs(76,40) : error CS0840: ‘AutoConcede.AutoConcede.Settings.get’ must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.

2019-07-16 14:22:58,834 [14] DEBUG Logger (null) – [AutoConcede] Initialize

自动投降不工作,提示是

2019-07-16 15:10:03,568 [5] INFO Logger (null) – [Concede] GameState == null.
2019

public static bool Concede(bool logReason)
{
bool result;
try
{
if (GameState.Get() == null)
{
if (logReason)
{
TritonHs.ilog_0.InfoFormat("[Concede] GameState == null.", Array.Empty<object>());
}
result = false;
}
else if (!GameUtils.CanConcedeCurrentMission())
{
TritonHs.ilog_0.InfoFormat("[Concede] !GameUtils.CanConcedeCurrentMission().", Array.Empty<object>());
result = false;
}
else
{
GameState.Get().Concede();
using (TritonHs.Memory.ReleaseFrame(true))
{
Thread.Sleep();
}
result = true;
}
}
catch (Exception ex)
{
if (logReason)
{
TritonHs.ilog_0.InfoFormat("[Concede] An exception occurred. {0}", ex.ToString());
}
result = false;
}
return result;
}

关于在选牌阶段,以及回合开始投降

https://tieba.baidu.com/p/5929349383?red_tag=2707770290

Hearthbuddy\Routines\DefaultRoutine\DefaultRoutine.cs

public async Task MulliganLogic(MulliganData mulliganData)

public async Task OurTurnLogic()

DefaultRoutine继承了Triton.Bot.IRoutine接口

public interface IRoutine : IRunnable, IAuthored, IBase, IConfigurable
{
// Token: 0x06001185 RID: 4485
void SetConfiguration(string name, params object[] param); // Token: 0x06001186 RID: 4486
object GetConfiguration(string name); // Token: 0x06001187 RID: 4487
Task<bool> Logic(string type, object context);
}

主要逻辑的入口,都是在Logic函数里面

/// <summary>
/// The routine's coroutine logic to execute.
/// </summary>
/// <param name="type">The requested type of logic to execute.</param>
/// <param name="context">Data sent to the routine from the bot for the current logic.</param>
/// <returns>true if logic was executed to handle this type and false otherwise.</returns>
public async Task<bool> Logic(string type, object context)
{ // The bot is requesting mulligan logic.
if (type == "mulligan")
{
await MulliganLogic(context as MulliganData);
return true;
} // The bot is requesting emote logic.
if (type == "emote")
{
await EmoteLogic(context as EmoteData);
return true;
} // The bot is requesting our turn logic.
if (type == "our_turn")
{
await OurTurnLogic();
return true;
} // The bot is requesting opponent turn logic.
if (type == "opponent_turn")
{
await OpponentTurnLogic();
return true;
} // The bot is requesting our turn logic.
if (type == "our_turn_combat")
{
await OurTurnCombatLogic();
return true;
} // The bot is requesting opponent turn logic.
if (type == "opponent_turn_combat")
{
await OpponentTurnCombatLogic();
return true;
} // The bot is requesting arena draft logic.
if (type == "arena_draft")
{
await ArenaDraftLogic(context as ArenaDraftData);
return true;
} // The bot is requesting quest handling logic.
if (type == "handle_quests")
{
await HandleQuestsLogic(context as QuestData);
return true;
} // Whatever the current logic type is, this routine doesn't implement it.
return false;
}

无法识别Object,必须改成小写的object

如何确定插件是否加载成功

查看plugins的tab那边是否显示了相应的插件,如果没有显示,就说明插件编译失败。可以去日志文件看细节

需要依据GameEventManager 中的事件,来决定如何写代码

public class GameEventManager : IRunnable, IResetable

2019-07-17 11:51:33,227 [19] DEBUG Logger (null) – [AutoConcede] ConcedeThread for loop, index = 1
2019-07-17 11:51:33,228 [14] INFO Logger (null) – [GameEventManagerOnMulliganConfirm]
2019-07-17 11:51:49,782 [14] ERROR Logger (null) – [Tick] Exception during execution:
GreyMagic.InjectionDesyncException: Process must have frozen or gotten out of sync: Injection Finished Event was never fired
at GreyMagic.Executor.WaitForInjection(Int32 timeout)
at GreyMagic.Executor.SharedExecuteLogicEnd(Int32 timeout)
at GreyMagic.Executor.Execute(Int32 timeout)
at GreyMagic.Executor.GrabFrame()
at GreyMagic.ExternalProcessMemory.AcquireFrame(Boolean isHardLock)
at Triton.Bot.BotManager.smethod_1(IBot ibot_1)
2019-07-17 11:51:49,785 [14] DEBUG Logger (null) – [BotThreadFunction] An InjectionDesyncException was detected.

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,487
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,736
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,487
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,127
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,289