Skip to content

Commit

Permalink
Log if character creation fails without removing the bot anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpoz committed Aug 10, 2019
1 parent 1471af4 commit 7424e05
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
1 change: 0 additions & 1 deletion BotFarm/BotFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public BotGame CreateBot(bool startBot)
Settings.Default.RealmID,
0,
botBehavior);
game.SettingUp = true;
if (startBot)
game.Start();
botInfos.Add(new BotInfo(username, password, botBehavior.Name));
Expand Down
20 changes: 7 additions & 13 deletions BotFarm/BotGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ namespace BotFarm
{
class BotGame : AutomatedGame
{
public bool SettingUp
{
get;
set;
}

public BotBehaviorSettings Behavior
{
get;
Expand Down Expand Up @@ -202,13 +196,13 @@ public override void Start()

public override void NoCharactersFound()
{
if (!SettingUp)
{
Log("Removing current bot because there are no characters");
BotFactory.Instance.RemoveBot(this);
}
else
CreateCharacter(Race.Human, Class.Priest);
CreateCharacter(Race.Human, Class.Priest);
}

public override void CharacterCreationFailed(CommandDetail result)
{
#warning ToDo: create a character with a different name
Log($"Bot {Username} failed creating a character with error {result.ToString()}", LogLevel.Error);
}

public override void InvalidCredentials()
Expand Down
7 changes: 6 additions & 1 deletion Client/AutomatedGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ public async Task Dispose()
public virtual void NoCharactersFound()
{ }

public virtual void CharacterCreationFailed(CommandDetail result)
{
NoCharactersFound();
}

public virtual void InvalidCredentials()
{ }

Expand Down Expand Up @@ -818,7 +823,7 @@ protected void HandleCharCreate(InPacket packet)
if (response == CommandDetail.CHAR_CREATE_SUCCESS)
SendPacket(new OutPacket(WorldCommand.CMSG_CHAR_ENUM));
else
NoCharactersFound();
CharacterCreationFailed(response);
}

[PacketHandler(WorldCommand.SMSG_LOGOUT_RESPONSE)]
Expand Down
2 changes: 1 addition & 1 deletion Client/World/Network/AuthResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Client.World.Network
{
enum CommandDetail : byte
public enum CommandDetail : byte
{
AUTH_OK = 12,
AUTH_FAILED = 13,
Expand Down

0 comments on commit 7424e05

Please sign in to comment.