Skip to content

Commit

Permalink
First pass re-implementation of skillmaster dialog (initial state)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Apr 20, 2022
1 parent fbcdbc2 commit e29ec80
Show file tree
Hide file tree
Showing 9 changed files with 495 additions and 783 deletions.
4 changes: 4 additions & 0 deletions EndlessClient/Controllers/NPCInteractionController.cs
Expand Up @@ -64,6 +64,10 @@ public void ShowNPCDialog(INPC npc)
_inGameDialogActions.ShowBankAccountDialog();
_userInputRepository.ClickHandled = true;
break;
case EOLib.IO.NPCType.Skills:
_mapNpcActions.RequestSkillmaster(npc);
_userInputRepository.ClickHandled = true;
break;
}
}
}
Expand Down
25 changes: 24 additions & 1 deletion EndlessClient/Dialogs/Actions/InGameDialogActions.cs
Expand Up @@ -4,6 +4,7 @@
using EOLib.Domain.Interact;
using EOLib.Domain.Interact.Quest;
using EOLib.Domain.Interact.Shop;
using EOLib.Domain.Interact.Skill;
using EOLib.IO;
using Optional;

Expand All @@ -19,9 +20,11 @@ public class InGameDialogActions : IInGameDialogActions, INPCInteractionNotifier
private readonly IActiveDialogRepository _activeDialogRepository;
private readonly IShopDataRepository _shopDataRepository;
private readonly IQuestDataRepository _questDataRepository;
private readonly ISkillDataRepository _skillDataRepository;
private readonly IChestDialogFactory _chestDialogFactory;
private readonly ILockerDialogFactory _lockerDialogFactory;
private readonly IBankAccountDialogFactory _bankAccountDialogFactory;
private readonly ISkillmasterDialogFactory _skillmasterDialogFactory;
private readonly IShopDialogFactory _shopDialogFactory;
private readonly IQuestDialogFactory _questDialogFactory;

Expand All @@ -34,9 +37,11 @@ public class InGameDialogActions : IInGameDialogActions, INPCInteractionNotifier
IActiveDialogRepository activeDialogRepository,
IShopDataRepository shopDataRepository,
IQuestDataRepository questDataRepository,
ISkillDataRepository skillDataRepository,
IChestDialogFactory chestDialogFactory,
ILockerDialogFactory lockerDialogFactory,
IBankAccountDialogFactory bankAccountDialogFactory)
IBankAccountDialogFactory bankAccountDialogFactory,
ISkillmasterDialogFactory skillmasterDialogFactory)
{
_friendIgnoreListDialogFactory = friendIgnoreListDialogFactory;
_paperdollDialogFactory = paperdollDialogFactory;
Expand All @@ -45,9 +50,11 @@ public class InGameDialogActions : IInGameDialogActions, INPCInteractionNotifier
_activeDialogRepository = activeDialogRepository;
_shopDataRepository = shopDataRepository;
_questDataRepository = questDataRepository;
_skillDataRepository = skillDataRepository;
_chestDialogFactory = chestDialogFactory;
_lockerDialogFactory = lockerDialogFactory;
_bankAccountDialogFactory = bankAccountDialogFactory;
_skillmasterDialogFactory = skillmasterDialogFactory;
_shopDialogFactory = shopDialogFactory;
_questDialogFactory = questDialogFactory;
}
Expand Down Expand Up @@ -122,6 +129,7 @@ public void NotifyInteractionFromNPC(NPCType npcType)
{
case NPCType.Shop: ShowShopDialog(); break;
case NPCType.Quest: ShowQuestDialog(); break;
case NPCType.Skills: ShowSkillmasterDialog(); break;
}
}

Expand Down Expand Up @@ -192,6 +200,19 @@ public void ShowBankAccountDialog()
dlg.Show();
});
}

public void ShowSkillmasterDialog()
{
var dlg = _skillmasterDialogFactory.Create();
dlg.DialogClosed += (_, _) =>
{
_activeDialogRepository.SkillmasterDialog = Option.None<SkillmasterDialog>();
_skillDataRepository.ResetState();
};
_activeDialogRepository.SkillmasterDialog = Option.Some(dlg);

dlg.Show();
}
}

public interface IInGameDialogActions
Expand All @@ -215,5 +236,7 @@ public interface IInGameDialogActions
void ShowLockerDialog();

void ShowBankAccountDialog();

void ShowSkillmasterDialog();
}
}
8 changes: 8 additions & 0 deletions EndlessClient/Dialogs/ActiveDialogRepository.cs
Expand Up @@ -27,6 +27,8 @@ public interface IActiveDialogProvider : IDisposable

Option<BankAccountDialog> BankAccountDialog { get; }

Option<SkillmasterDialog> SkillmasterDialog { get; }

IReadOnlyList<Option<IXNADialog>> ActiveDialogs { get; }
}

Expand All @@ -50,6 +52,8 @@ public interface IActiveDialogRepository : IDisposable

Option<BankAccountDialog> BankAccountDialog { get; set; }

Option<SkillmasterDialog> SkillmasterDialog { get; set; }

IReadOnlyList<Option<IXNADialog>> ActiveDialogs { get; }
}

Expand All @@ -74,6 +78,8 @@ public class ActiveDialogRepository : IActiveDialogRepository, IActiveDialogProv

public Option<BankAccountDialog> BankAccountDialog { get; set; }

public Option<SkillmasterDialog> SkillmasterDialog { get; set; }

IReadOnlyList<Option<IXNADialog>> ActiveDialogs
{
get
Expand All @@ -89,6 +95,7 @@ IReadOnlyList<Option<IXNADialog>> ActiveDialogs
ChestDialog.Map(d => (IXNADialog)d),
LockerDialog.Map(d => (IXNADialog)d),
BankAccountDialog.Map(d => (IXNADialog)d),
SkillmasterDialog.Map(d => (IXNADialog)d),
}.ToList();
}
}
Expand All @@ -111,6 +118,7 @@ public void Dispose()
ChestDialog = Option.None<ChestDialog>();
LockerDialog = Option.None<LockerDialog>();
BankAccountDialog = Option.None<BankAccountDialog>();
SkillmasterDialog = Option.None<SkillmasterDialog>();
}
}
}
54 changes: 54 additions & 0 deletions EndlessClient/Dialogs/Factories/SkillmasterDialogFactory.cs
@@ -0,0 +1,54 @@
using AutomaticTypeMapper;
using EndlessClient.Dialogs.Services;
using EOLib.Domain.Character;
using EOLib.Domain.Interact.Skill;
using EOLib.Graphics;
using EOLib.Localization;

namespace EndlessClient.Dialogs.Factories
{
[AutoMappedType]
public class SkillmasterDialogFactory : ISkillmasterDialogFactory
{
private readonly INativeGraphicsManager _nativeGraphicsManager;
private readonly IEODialogButtonService _dialogButtonService;
private readonly IEODialogIconService _dialogIconService;
private readonly ILocalizedStringFinder _localizedStringFinder;
private readonly IEOMessageBoxFactory _messageBoxFactory;
private readonly ISkillDataProvider _skillDataProvider;
private readonly ICharacterInventoryProvider _characterInventoryProvider;

public SkillmasterDialogFactory(INativeGraphicsManager nativeGraphicsManager,
IEODialogButtonService dialogButtonService,
IEODialogIconService dialogIconService,
ILocalizedStringFinder localizedStringFinder,
IEOMessageBoxFactory messageBoxFactory,
ISkillDataProvider skillDataProvider,
ICharacterInventoryProvider characterInventoryProvider)
{
_nativeGraphicsManager = nativeGraphicsManager;
_dialogButtonService = dialogButtonService;
_dialogIconService = dialogIconService;
_localizedStringFinder = localizedStringFinder;
_messageBoxFactory = messageBoxFactory;
_skillDataProvider = skillDataProvider;
_characterInventoryProvider = characterInventoryProvider;
}

public SkillmasterDialog Create()
{
return new SkillmasterDialog(_nativeGraphicsManager,
_dialogButtonService,
_dialogIconService,
_localizedStringFinder,
_messageBoxFactory,
_skillDataProvider,
_characterInventoryProvider);
}
}

public interface ISkillmasterDialogFactory
{
SkillmasterDialog Create();
}
}

0 comments on commit e29ec80

Please sign in to comment.