diff --git a/L2BotDll/Versions/Interlude/Repositories/ItemRepository.h b/L2BotDll/Versions/Interlude/Repositories/ItemRepository.h index 8dbe328..a8b861d 100644 --- a/L2BotDll/Versions/Interlude/Repositories/ItemRepository.h +++ b/L2BotDll/Versions/Interlude/Repositories/ItemRepository.h @@ -10,6 +10,7 @@ #include "Domain/Events/ItemUpdatedEvent.h" #include "Domain/Events/ItemDeletedEvent.h" #include "Domain/Events/HeroDeletedEvent.h" +#include "Domain/Events/HeroCreatedEvent.h" #include "Domain/Events/ItemAutousedEvent.h" #include "Domain/Events/OnEndItemListEvent.h" #include "Domain/Services/ServiceLocator.h" @@ -66,6 +67,15 @@ namespace Interlude m_IsNewCycle = true; } } + + void OnHeroCreated(const Events::Event& evt) + { + std::shared_lock(m_Mutex); + if (evt.GetName() == Events::HeroCreatedEvent::name) + { + m_NetworkHandler.RequestItemList(); + } + } void OnHeroDeleted(const Events::Event& evt) { @@ -191,6 +201,9 @@ namespace Interlude Services::ServiceLocator::GetInstance().GetEventDispatcher()->Subscribe(Events::HeroDeletedEvent::name, [this](const Events::Event& evt) { OnHeroDeleted(evt); }); + Services::ServiceLocator::GetInstance().GetEventDispatcher()->Subscribe(Events::HeroCreatedEvent::name, [this](const Events::Event& evt) { + OnHeroCreated(evt); + }); Services::ServiceLocator::GetInstance().GetEventDispatcher()->Subscribe(Events::ItemAutousedEvent::name, [this](const Events::Event& evt) { OnItemAutoused(evt); });