表现1

配置是标准,休闲模式

然后一直重复提示

select desire deck

select causal mode

表现2

配置是狂野,休闲模式

然后一直提示

切换到狂野

切换到标准

把模式切换到auto好像就可以了

[QuestPlus] You don't have the deck name 'sqs' for the class 'PALADIN'. Please correct this DeckName or re-Cache Custom Decks.

在default bot页面勾选,重新cache卡组

后面观察发现,设置Mode为Ranked,设置RuleSet为Standard。也可以正常工作,虽然最后是在狂野,休闲模式下打的。

这样的话,只会在排名模式下运行。

切换到休闲模式的话,在上面的模式运行的过程中,切换模式到休闲。

等游戏结束,或者自己stop,然后手动投降。下一局开始的时候,还是不行。

开始之后,会一直提示,不管,直接再把模式改为ranked,然后就会在休闲模式打了。

查看完整的启动流程

[Start] Now creating the BotThread.
[Stats] Start
Load settings for Control
current alpha is 0.5
set enemy-face-hp to: 15
set weaponOnlyAttackMobsUntilEnfacehp to: 0
set maxwide to: 3000
calculate the second turn of the 0 best boards
playing arround secrets is true
Control settings are loaded.
[Combo] Load combos for Control
read _combo.txt...
[Combo] 0 combos loaded successfully, 0 values loaded successfully
[RulesEngine] _rules.txt - read error. We continue without user-defined rules. Only the default rules.
[CollectionManagerScene]
[CollectionManagerScene_COLLECTION]
[CollectionManagerScene_COLLECTION] Waiting to be in this state longer.
[CollectionManagerScene]
[CollectionManagerScene_COLLECTION]
[CollectionManagerScene_COLLECTION] We have the contents of this deck already.
[DefaultBotSettings] NeedsToCacheCustomDecks = False.
[CollectionManagerScene]
[CollectionManagerScene_COLLECTION]
[CollectionManagerScene_COLLECTION] Waiting to be in this state longer.
[CollectionManagerScene]
[CollectionManagerScene_COLLECTION]
[CollectionManagerScene_COLLECTION] We do not need to cache custom decks. Now leaving the "Collection Manager".
[IsClientInUsableState] SceneMgr.IsTransitioning.
[HubScene]
[HubScene] The bot needs to cache quests. Now clicking on the "Quest Log" button.
[HubScene]
[HandleQuests]
[GameEventManagerOnQuestUpdate]
[GameEventManagerOnQuestUpdate][1176]正义凛然: 使用20张圣骑士职业牌。 (3 / 20) [50x GOLD]
[GameEventManagerOnQuestUpdate][2420]火焰节快乐!: 使用30张卡牌。 (6 / 30) [1x BOOSTER_PACK]
[HubScene] Now clicking to close the "Quest Log" screen.
[DefaultBotSettings] NeedsToCacheQuests = False.
[HubScene]
[HubScene] Now clicking on the "Play" button.
[IsClientInUsableState] SceneMgr.IsTransitioning.
[IsClientInUsableState] !SceneMgr.IsSceneLoaded.
[IsClientInUsableState] !SceneMgr.IsSceneLoaded.
[IsClientInUsableState] Box.IsBusy.
[TournamentScene]

从这里开始,就一直在切换狂野和休闲模式
[TournamentScene_DeckPicker] Now changing the game ruleset to 'Wild'.
[TournamentScene]
[TournamentScene_DeckPicker] Now changing the game ruleset to 'Wild'.
[TournamentScene]
[TournamentScene_DeckPicker] Now changing the game ruleset to 'Wild'.
[Stop] Now requesting the BotThread to stop.
[Stats] Stop
[DefaultBotSettings] ForceConcedeAtMulligan = False.

在源码中搜索Assembly-Csharper中搜索TournamentScene找到一个叫DefaultBot的类,

[TournamentScene_DeckPicker] Now changing the game ruleset

在类里面搜索ruleset

else if (DefaultBotSettings.Instance.ConstructedGameRule == GameRule.Wild)
{
if (!@bool)
{
flag = true;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing the game ruleset to 'Wild'.", Array.Empty<object>());
}
}

方法是method_49

private async Task method_49(TournamentScene tournamentScene_0)
{
if (DefaultBotSettings.Instance.ClientBackAttempts >= )
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] The client has been detected to be in a broken state. Please restart it as soon as possible as it cannot leave the current scene.", Array.Empty<object>());
DefaultBotSettings.Instance.ClientBroken = true;
}
GameEventManager.Instance.method_6();
await Coroutine.Yield();
if (!DefaultBotSettings.Instance.ClientBroken && (DefaultBotSettings.Instance.NeedsToCacheQuests || DefaultBotSettings.Instance.NeedsToCacheCustomDecks))
{
DefaultBotSettings.Instance.ClientBackAttempts++;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now returning to the Hub to cache quests/decks.", Array.Empty<object>());
TaskAwaiter taskAwaiter = this.method_50(tournamentScene_0).GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
TaskAwaiter taskAwaiter2;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
GameEventManager.Instance.method_7();
TaskAwaiter taskAwaiter = Coroutine.Yield().GetAwaiter();
TaskAwaiter taskAwaiter2;
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
if (DefaultBotSettings.Instance.GameMode != GameMode.Constructed)
{
if (DefaultBotSettings.Instance.ClientBroken)
{
BotManager.Stop();
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] Your client needs to be restarted before continuing.", Array.Empty<object>());
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now returning to the Hub to change the game type.", Array.Empty<object>());
taskAwaiter = this.method_50(tournamentScene_0).GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
}
else
{
DeckPickerTrayDisplay deckPickerTrayDisplay = DeckPickerTrayDisplay.Get();
if (deckPickerTrayDisplay == null)
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] DeckPickerTrayDisplay is null", Array.Empty<object>());
}
else if (!deckPickerTrayDisplay.IsLoaded())
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] !DeckPickerTrayDisplay.IsLoaded", Array.Empty<object>());
}
else if (string.IsNullOrEmpty(DefaultBotSettings.Instance.ConstructedCustomDeck))
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] Please type a name for ConstructedCustomDeck!", Array.Empty<object>());
BotManager.Stop();
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
bool @bool = Options.Get().GetBool(Option.IN_WILD_MODE);
bool flag = false;
if (DefaultBotSettings.Instance.ConstructedGameRule == GameRule.Auto)
{
CustomDeckCache customDeckCache = MainSettings.Instance.CustomDecks.FirstOrDefault(new Func<CustomDeckCache, bool>(DefaultBot.Class224.<>.method_2));
if (customDeckCache != null)
{
if (customDeckCache.IsWild)
{
if (!@bool)
{
flag = true;
}
}
else if (@bool)
{
flag = true;
}
}
}
else if (DefaultBotSettings.Instance.ConstructedGameRule == GameRule.Wild)
{
if (!@bool)
{
flag = true;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing the game ruleset to 'Wild'.", Array.Empty<object>());
}
}
else
{
if (DefaultBotSettings.Instance.ConstructedGameRule != GameRule.Standard)
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] Unprocessed ConstructedGameRule: {0}.", DefaultBotSettings.Instance.ConstructedGameRule);
BotManager.Stop();
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
if (@bool)
{
flag = true;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing the game ruleset to 'Standard'.", Array.Empty<object>());
}
}
if (flag)
{
Client.LeftClickAt(deckPickerTrayDisplay.m_switchFormatButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
List<CustomDeckPage> customPages = deckPickerTrayDisplay.m_customPages;
if (customPages != null)
{
using (List<CustomDeckPage>.Enumerator enumerator = customPages.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (!enumerator.Current.AreAllCustomDecksReady())
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] !AreAllCustomDecksReady", Array.Empty<object>());
await Coroutine.Sleep();
return;
}
}
}
List<CustomDeckPage>.Enumerator enumerator = default(List<CustomDeckPage>.Enumerator);
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now attempting to select the desired custom deck.", Array.Empty<object>());
if (!(await DefaultBot.smethod_5("TournamentScene_DeckPicker", deckPickerTrayDisplay.m_selectedCustomDeckBox, customPages, deckPickerTrayDisplay, DefaultBotSettings.Instance.ConstructedCustomDeck)))
{
DefaultBotSettings.Instance.NeedsToCacheQuests = true;
return;
}
}
else
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now attempting to select the desired basic deck.", Array.Empty<object>());
TaskAwaiter<bool> taskAwaiter3 = DefaultBot.smethod_4("TournamentScene_DeckPicker", deckPickerTrayDisplay.m_selectedHeroButton, deckPickerTrayDisplay.m_heroButtons, deckPickerTrayDisplay, DefaultBotSettings.Instance.ConstructedCustomDeck).GetAwaiter();
if (!taskAwaiter3.IsCompleted)
{
await taskAwaiter3;
TaskAwaiter<bool> taskAwaiter4;
taskAwaiter3 = taskAwaiter4;
taskAwaiter4 = default(TaskAwaiter<bool>);
}
bool result = taskAwaiter3.GetResult();
taskAwaiter3 = default(TaskAwaiter<bool>);
if (!result)
{
DefaultBotSettings.Instance.NeedsToCacheQuests = true;
return;
}
}
if (deckPickerTrayDisplay.m_rankedPlayButtons == null)
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] DeckPickerTrayDisplay.m_rankedPlayButtons == null.", Array.Empty<object>());
}
else
{
bool bool2 = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);
if (DefaultBotSettings.Instance.ConstructedMode == ConstructedMode.Casual)
{
if (bool2)
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing to \"Casual\" constructed.", Array.Empty<object>());
Client.LeftClickAt(deckPickerTrayDisplay.m_rankedPlayButtons.m_casualButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
}
else
{
if (DefaultBotSettings.Instance.ConstructedMode != ConstructedMode.Ranked)
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] Unprocessed ConstructedMode: {0}.", DefaultBotSettings.Instance.ConstructedMode);
BotManager.Stop();
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
if (!bool2)
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing to \"Ranked\" constructed.", Array.Empty<object>());
Client.LeftClickAt(deckPickerTrayDisplay.m_rankedPlayButtons.m_rankedButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
}
DefaultBotSettings.Instance.ClientBackAttempts = ;
TransitionPopup transitionPopup = GameMgr.Get().m_transitionPopup;
if (transitionPopup != null && transitionPopup.IsShown())
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] The \"Matching\" popup is showing.", Array.Empty<object>());
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
PlayButton playButton = deckPickerTrayDisplay.m_playButton;
UberText newPlayButtonText = playButton.m_newPlayButtonText;
if (!playButton.IsEnabled())
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] The \"{0}\" is not enabled.", newPlayButtonText.Text);
}
else
{
UberText newPlayButtonText2 = playButton.m_newPlayButtonText;
Vector3 center = newPlayButtonText2.m_TextMeshGameObject.Renderer.Bounds.m_Center;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now clicking the \"{0}\" button.", newPlayButtonText2.Text);
Client.LeftClickAt(center);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
}
}
}
}
}
}
}

analyze

Triton.Bot.Logic.Bots.DefaultBot.DefaultBot.method_49(TournamentScene) : Task @060013A0
Used By
Triton.Bot.Logic.Bots.DefaultBot.DefaultBot.method_48(TournamentScene) : Task @0600139F
Used By
Triton.Bot.Logic.Bots.DefaultBot.DefaultBot.method_21() : Task @06001384
Used By
Triton.Bot.Logic.Bots.DefaultBot.DefaultBot.method_17() : void @0600137D
Triton.Bot.Logic.Bots.DefaultBot.DefaultBot.Start() : void @0600137A

从DefaultBot.method_17()开始的调用

private void method_17()
{
this.coroutine_0.Dispose();
this.coroutine_0 = new Coroutine(new Func<Task>(this.method_54));
}
    [CompilerGenerated]
private Task method_54()
{
return this.method_21();
}

从DefaultBot.Start()开始的调用

public void Start()
{
this.coroutine_0 = new Coroutine(new Func<Task>(this.method_53));
this.bool_2 = false;
GameEventManager.Instance.Start();
PluginManager.Start();
RoutineManager.Start();
ProcessHookManager.Enable();
GameEventManager.NewGame += this.method_18;
GameEventManager.GameOver += this.method_19;
GameEventManager.MulliganConfirm += this.method_16;
InactivePlayerKicker inactivePlayerKicker = InactivePlayerKicker.Get();
if (inactivePlayerKicker != null)
{
inactivePlayerKicker.SetShouldCheckForInactivity(false);
}
}
[CompilerGenerated]
private Task method_53()
{
return this.method_21();
}

从DefaultBot.method_21()开始的调用

private Task method_21()
{
DefaultBot.Struct60 @struct;
@struct.defaultBot_0 = this;
@struct.asyncTaskMethodBuilder_0 = AsyncTaskMethodBuilder.Create();
@struct.int_0 = -;
AsyncTaskMethodBuilder asyncTaskMethodBuilder_ = @struct.asyncTaskMethodBuilder_0;
asyncTaskMethodBuilder_.Start<DefaultBot.Struct60>(ref @struct);
return @struct.asyncTaskMethodBuilder_0.Task;
}

不太明白method_21是怎么调用method_48的,查看代码的话,只是使用了this。

查看DefaultBot的类,发现有继承关系

public class DefaultBot : IRunnable, IAuthored, IBase, IBot, IConfigurable

猜测是因为继承了IRunnable,所以还有其他逻辑在进行启动

public interface IRunnable
{
// Token: 0x06001162 RID: 4450
void Start(); // Token: 0x06001163 RID: 4451
void Tick(); // Token: 0x06001164 RID: 4452
void Stop();
}

可以考虑查看start方法,usedby哪些类

AsyncTaskMethodBuilder在这里的使用,说明源码里面使用了async关键字进行异步编程,

可以看下面这篇文章里面的分析

C# Under the Hood: async/await

ILSpy好像可以正常反编译async

https://github.com/0xd4d/dnSpy/issues/687#issuecomment-354990427

await is just synthetic sugar for what you see in the decompiled code. Usually ILSpy converts this back to what a programmer would normally write, but the version that dnSpy uses didn't have that implemented yet. You can find all implemented language features for the latest version of ILSpy here, but keep in mind that dnSpy still uses ILSpy 2.x, not 3.x.

奇怪的是,上面的method_49是正常识别了async的语法的,不知道为什么method_21无法识别

private async Task method_48(TournamentScene tournamentScene_0)
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene]", Array.Empty<object>());
if (!tournamentScene_0.IsLoaded())
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene] !TournamentScene.IsLoaded.", Array.Empty<object>());
}
else if (!tournamentScene_0.m_deckPickerIsLoaded)
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene] !m_deckPickerIsLoaded.", Array.Empty<object>());
}
else
{
PresenceMgr presenceMgr = PresenceMgr.Get();
if (presenceMgr == null)
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene] PresenceMgr is null.", Array.Empty<object>());
}
else
{
List<MonoEnum> statusEnums = presenceMgr.GetStatusEnums(BnetPresenceMgr.Get().GetMyPlayer());
if (statusEnums != null && statusEnums.Count != )
{
foreach (MonoEnum monoEnum in statusEnums)
{
PresenceStatus presenceStatus = monoEnum.AsEnum<PresenceStatus>();
TritonHs.smethod_4(presenceMgr, ref presenceStatus);
if (presenceStatus == PresenceStatus.PLAY_DECKPICKER)
{
TaskAwaiter taskAwaiter = this.method_49(tournamentScene_0).GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
TaskAwaiter taskAwaiter2;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else if (presenceStatus == PresenceStatus.PLAY_QUEUE)
{
TaskAwaiter taskAwaiter = this.method_51(tournamentScene_0).GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
TaskAwaiter taskAwaiter2;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
TaskAwaiter taskAwaiter;
TaskAwaiter taskAwaiter2;
if (presenceStatus != PresenceStatus.HUB)
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene] Unhandled presence status detected: {0}. Please restart your client and try again. If the error is still not fixed, please report this message.", monoEnum);
BotManager.Stop();
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
DefaultBot.ilog_0.DebugFormat("[TournamentScene] Presence status [{0}] detected. Now waiting for it to update.", monoEnum);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
monoEnum = null;
}
List<MonoEnum>.Enumerator enumerator = default(List<MonoEnum>.Enumerator);
}
else
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene] PresenceMgr.GetStatus is null or empty.", Array.Empty<object>());
}
}
}
}
TaskAwaiter taskAwaiter = this.method_49(tournamentScene_0).GetAwaiter();

上面这段代码,应该是调用method_49的

解决方案,在以下这段代码中

bool @bool = Options.Get().GetBool(Option.IN_WILD_MODE);

if (flag)
{
Client.LeftClickAt(deckPickerTrayDisplay.m_switchFormatButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
List<CustomDeckPage> customPages = deckPickerTrayDisplay.m_customPages;
if (customPages != null)
{
using (List<CustomDeckPage>.Enumerator enumerator = customPages.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (!enumerator.Current.AreAllCustomDecksReady())
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] !AreAllCustomDecksReady", Array.Empty<object>());
await Coroutine.Sleep();
return;
}
}
}
List<CustomDeckPage>.Enumerator enumerator = default(List<CustomDeckPage>.Enumerator);
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now attempting to select the desired custom deck.", Array.Empty<object>());
if (!(await DefaultBot.smethod_5("TournamentScene_DeckPicker", deckPickerTrayDisplay.m_selectedCustomDeckBox, customPages, deckPickerTrayDisplay, DefaultBotSettings.Instance.ConstructedCustomDeck)))
{
DefaultBotSettings.Instance.NeedsToCacheQuests = true;
return;
}
}
else
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now attempting to select the desired basic deck.", Array.Empty<object>());
TaskAwaiter<bool> taskAwaiter3 = DefaultBot.smethod_4("TournamentScene_DeckPicker", deckPickerTrayDisplay.m_selectedHeroButton, deckPickerTrayDisplay.m_heroButtons, deckPickerTrayDisplay, DefaultBotSettings.Instance.ConstructedCustomDeck).GetAwaiter();
if (!taskAwaiter3.IsCompleted)
{
await taskAwaiter3;
TaskAwaiter<bool> taskAwaiter4;
taskAwaiter3 = taskAwaiter4;
taskAwaiter4 = default(TaskAwaiter<bool>);
}
bool result = taskAwaiter3.GetResult();
taskAwaiter3 = default(TaskAwaiter<bool>);
if (!result)
{
DefaultBotSettings.Instance.NeedsToCacheQuests = true;
return;
}
}
if (deckPickerTrayDisplay.m_rankedPlayButtons == null)
{
DefaultBot.ilog_0.DebugFormat("[TournamentScene_DeckPicker] DeckPickerTrayDisplay.m_rankedPlayButtons == null.", Array.Empty<object>());
}
else
{
bool bool2 = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);
if (DefaultBotSettings.Instance.ConstructedMode == ConstructedMode.Casual)
{
if (bool2)
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing to \"Casual\" constructed.", Array.Empty<object>());
Client.LeftClickAt(deckPickerTrayDisplay.m_rankedPlayButtons.m_casualButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
}
else
{
if (DefaultBotSettings.Instance.ConstructedMode != ConstructedMode.Ranked)
{
DefaultBot.ilog_0.ErrorFormat("[TournamentScene_DeckPicker] Unprocessed ConstructedMode: {0}.", DefaultBotSettings.Instance.ConstructedMode);
BotManager.Stop();
taskAwaiter = Coroutine.Yield().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
if (!bool2)
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now changing to \"Ranked\" constructed.", Array.Empty<object>());
Client.LeftClickAt(deckPickerTrayDisplay.m_rankedPlayButtons.m_rankedButton.Transform.Position);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
return;
}
}
DefaultBotSettings.Instance.ClientBackAttempts = ;
TransitionPopup transitionPopup = GameMgr.Get().m_transitionPopup;
if (transitionPopup != null && transitionPopup.IsShown())
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] The \"Matching\" popup is showing.", Array.Empty<object>());
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
else
{
PlayButton playButton = deckPickerTrayDisplay.m_playButton;
UberText newPlayButtonText = playButton.m_newPlayButtonText;
if (!playButton.IsEnabled())
{
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] The \"{0}\" is not enabled.", newPlayButtonText.Text);
}
else
{
UberText newPlayButtonText2 = playButton.m_newPlayButtonText;
Vector3 center = newPlayButtonText2.m_TextMeshGameObject.Renderer.Bounds.m_Center;
DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now clicking the \"{0}\" button.", newPlayButtonText2.Text);
Client.LeftClickAt(center);
taskAwaiter = Coroutine.Sleep().GetAwaiter();
if (!taskAwaiter.IsCompleted)
{
await taskAwaiter;
taskAwaiter = taskAwaiter2;
taskAwaiter2 = default(TaskAwaiter);
}
taskAwaiter.GetResult();
taskAwaiter = default(TaskAwaiter);
}
}
}
}

最终定位,发现问题出在bool @bool = Options.Get().GetBool(Option.IN_WILD_MODE);上

Assembly-CSharp中的Option枚举,已经扩展了。原来的顺序被打乱了。

enum在c#中,默认从0开始。

将Assembly-CSharp中的Option和兄弟里的Option复制出来,然后打印in_wild_mode的值。

新版本是0xC0,也就是192
旧版本是0xAE,也就是174

尝试直接替换兄弟里面的Option,然后发现保存的代码上面的代码变成了很奇怪的模式。

bool @bool = Options.Get().GetBool(Option.HAS_STARTED_A_DECK);

尝试打印之前代码中的in_wild_mode的数值,映射到新版本的枚举,很尴尬,发现映射出来的是HAS_STARTED_A_DECK。

     Option option = (Option)Enum.ToObject(typeof(Option), 0xAE);
Console.WriteLine(option);

最好的解决方案,应该是通过字符串去解析一个枚举出来。

            Option option2 = (Option) Enum.Parse(typeof(Option), "IN_WILD_MODE");
Console.WriteLine(option2);

另外一个映射也出问题了,

bool bool2 = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

修改为

bool bool2 = Options.Get().GetBool(Option.HAS_SEEN_FORGE_2LOSS);

新版0x99对应153
旧版0x87对应135

使用ILSpy配合 reflexil

https://www.cnblogs.com/chucklu/p/11334424.html

ILSpy取消反编译async methods,然后找到method_49,转到struct88的定义。

找到struct88的move next方法,然后按照如下方式修改

找到Options.Get和GetBool,然后把中间的174换成新的192

135换成153

2020年03月18日更新

Option option2 = (Option)Enum.Parse(typeof(Option), "IN_WILD_MODE");
Console.WriteLine((int)option2);//199

Option option2 = (Option)Enum.Parse(typeof(Option), "IN_RANKED_PLAY_MODE");
Console.WriteLine((int)option2);//160

HearthBuddy的狂野和休闲模式来回切换的更多相关文章

  1. Fragment碎片频繁来回切换的时候报java.lang.IllegalStateException: No activity

    出现这个问题的原因是因为使用的transcation.replace(fragmentTwo);的方式进行碎片切换的. 解决方案是使用add和show.hide方法组合实现碎片的切换(应该是显示.隐藏 ...

  2. CentOS下命令行和桌面模式的切换方法(转载)

    桌面模式和命令行模式的切换方法 用编辑器打开 /etc/inittab 文件(这里用的是vi,你可以选择你喜欢的): #vi /etc/inittab 打开效果图如下: 桌面模式    : 把光标所在 ...

  3. 如何进行fragment中的来回切换?

    本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术,本文为大家讲解如何进行fragment中的来回切 ...

  4. 关于含RecyclerView的fragment来回切换时页面自动滑动到底部的解决方法

    原因: 在fragment中来回切换时RecyclerView获得了焦点,而RecyclerView的 focusableOnTouchMode属性默认是true,所以在切换时RecyclerView ...

  5. (17/24) webpack实战技巧:生产环境和开发环境并行设置,实现来回切换

    1. 概述 生产环境和开发环境所需依赖是不同: --开发依赖:就是开发中用到而发布时用不到的.在package.json里面对应的就是devDependencies下面相关配置. --生产依赖: 就是 ...

  6. CoreAudio实现录音播音和扬声器听筒模式的切换

    本例子使用Core Audio实现类似于微信的音频对讲功能,可以录音和播放并且实现了听筒模式和扬声器模式的切换.录音主要使用AVAudioRecorder类来实现录音功能,播放则使用AVAudioPl ...

  7. WPF两个按钮来回切换样式

    <!-- 两个按钮来回切换样式 --> <Style x:Key="SwicthFunctionMetroToggleButton" TargetType=&qu ...

  8. jquery点击来回切换

    做个笔记偶尔用有时记不住 方法一: <div id="test"> test </div> $('#test').mouseover(function () ...

  9. RENIX板卡V2-100G系列工作模式速率切换——网络测试仪实操

    本文主要介绍了RENIX板卡V2-100G系列工作模式速率切换相关操作.全文分为五部分内容.文章开头对V2-100G系列板卡进行了概述,之后分别详细介绍了100G工作模式.40G工作模式.25G工作模 ...

随机推荐

  1. 构建虚拟工控环境系列 - 罗克韦尔虚拟PLC

    一. 概述 本篇主要介绍罗克韦尔虚拟PLC的搭建,使用的操作系统为Windows7 x86 Ultimate(DEEP_GHOST_WIN7_SP1_X86_V2015_06.iso),虚拟化软件为 ...

  2. vim 绑定到 source insight 快捷键

    1. optioons -> custom commands 2. 选择然后写入run命令: "D:\Program Files (x86)\Vim\vim74\gvim.exe&qu ...

  3. 1-win10配置 Vagrant 环境

    1-win10配置 Vagrant 环境 2019.9.13 Vagrant 概述 vagrant是一个操作虚拟机的工具.是一个基于Ruby的工具,用于创建和部署虚拟化开发环境. 通过命令和配置文件来 ...

  4. EEPROM原理详解

    EEPROM(Electrically Erasable Programmable read only memory)即电可擦可编程只读存储器,是一种掉电后数据不丢失(不挥发)存储芯片. EERPOM ...

  5. BaseAdapter的使用与优化

    1.逗比式 //逗比式............................................ //加载布局文件 //将xml文件转化为view,获取到view//由于我们只需要将XM ...

  6. python操作mysql代码讲解(及其实用,未来测试工作主要操作数据库的方法)

    pymsql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同. 下载安装 1 pip3 install pymysql 使用操作 1.执行SQL 1 2 3 4 ...

  7. 【踩坑记录】 使用form标签的 reset() 方法报错原因及处理方法

    如果form标签内包含了 id 为 reset 的元素,在调用form的 reset() 方法时,会报xxx.reset is not a function,原因是在调用form的 reset() 方 ...

  8. Kafka、RabbitMQ、RocketMQ等 消息中间件 介绍和对比

    文章目录 1.前言 2.概念 2.1.MQ简介 2.2.MQ特点 2.2.1.先进先出 2.2.2.发布订阅 2.2.3.持久化 2.2.4.分布式 3.消息中间件性能究竟哪家强? 3.1.Kafka ...

  9. Qt实现多国语言(即界面翻译)可实时进行切换

    .在工程文件添加 TRANSLATIONS = debug/lang_English.ts \ debug/lang_Chinese.ts .在需要翻译的地方用上tr 例如:setText(tr(&q ...

  10. PyHook3----键盘鼠标操作

    需要安装 pywin32 安装pyHook 下载网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml 注意选择的pyHook版本一定要和python对 ...