Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old code #217

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion EOBot/ConsoleHelper.cs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.