Skip to content

Commit

Permalink
Merge pull request #217 from ethanmoffat/delete_old_code
Browse files Browse the repository at this point in the history
Remove old code
  • Loading branch information
ethanmoffat committed Sep 16, 2022
2 parents d5edeb6 + 75268bf commit 78f3046
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 4,658 deletions.
4 changes: 3 additions & 1 deletion EOBot/ConsoleHelper.cs
Expand Up @@ -62,7 +62,9 @@ public enum Type
[StringValue("DEAD")]
Dead,
[StringValue("ITEM")]
Item
Item,
[StringValue("CHAT")]
Chat
}

public static void WriteMessage(Type messageType, string message, ConsoleColor color = ConsoleColor.Gray)
Expand Down
19 changes: 17 additions & 2 deletions EOBot/TrainerBot.cs
@@ -1,6 +1,7 @@
using EOLib;
using EOLib.Domain.Account;
using EOLib.Domain.Character;
using EOLib.Domain.Chat;
using EOLib.Domain.Extensions;
using EOLib.Domain.Item;
using EOLib.Domain.Login;
Expand Down Expand Up @@ -29,9 +30,9 @@ internal class TrainerBot : BotBase
private static readonly int[] JunkItemIds = new[]
{
// Dragon Blade, enchanted boots (red/green/blue)
//37, 124, 125, 126
37, 124, 125, 126
// cava staff
329
//329
};

private readonly string _account;
Expand All @@ -48,6 +49,9 @@ internal class TrainerBot : BotBase
private IPubFile<ENFRecord> _npcData;
private IPubFile<ESFRecord> _spellData;

private IChatProvider _chatProvider;
private HashSet<ChatData> _cachedChat;

public TrainerBot(int botIndex, string account, string password, string character)
: base(botIndex)
{
Expand Down Expand Up @@ -90,6 +94,9 @@ protected override async Task DoWorkAsync(CancellationToken ct)
var charInventoryRepo = c.Resolve<ICharacterInventoryRepository>();
var walkValidator = c.Resolve<IWalkValidationActions>();

_chatProvider = c.Resolve<IChatProvider>();
_cachedChat = new HashSet<ChatData>();

var healItems = new List<InventoryItem>();
var healSpells = new List<InventorySpell>();

Expand All @@ -101,6 +108,14 @@ protected override async Task DoWorkAsync(CancellationToken ct)
{
handler.PollForPacketsAndHandle();

if (!_cachedChat.SetEquals(_chatProvider.AllChat[ChatTab.Local]))
{
foreach (var message in _chatProvider.AllChat[ChatTab.Local].Except(_cachedChat))
ConsoleHelper.WriteMessage(ConsoleHelper.Type.Chat, $"{message.Who}: {message.Message}", ConsoleColor.Cyan);

_cachedChat = _chatProvider.AllChat[ChatTab.Local].ToHashSet();
}

var character = _characterRepository.MainCharacter;
var charRenderProps = character.RenderProperties;

Expand Down
17 changes: 0 additions & 17 deletions EOLib/Domain/Map/OldMapItem.cs

This file was deleted.

84 changes: 0 additions & 84 deletions EOLib/Domain/NPC/OldNPC.cs

This file was deleted.

131 changes: 0 additions & 131 deletions EOLib/Net/API/Character.cs

This file was deleted.

0 comments on commit 78f3046

Please sign in to comment.