fix: fix toggle soulshot method

This commit is contained in:
k0t9i
2023-02-10 19:00:56 +04:00
parent 81e26a7e52
commit 7276b24249
22 changed files with 261 additions and 70 deletions

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Client.Domain.Entities
{
public abstract class BaseItem : EntityInterface
public abstract class BaseItem
{
public uint Id { get; set; }
public uint ItemId { get; set; }

View File

@@ -7,11 +7,13 @@ using System.Threading.Tasks;
namespace Client.Domain.Entities
{
public class EtcItem : BaseItem
public class EtcItem : BaseItem, ItemInterface
{
public uint Amount { get => amount; set => amount = value; }
public bool IsQuest { get; set; }
public bool IsAutoused { get => isAutoused; set => isAutoused = value; }
public string FullDescription { get => Description; }
public EtcItem(uint id, uint itemId, ItemTypeEnum type, string name, string iconName, string description, int mana, uint weight, uint amount, bool isQuest, bool isAutoused) :
base(id, itemId, type, name, iconName, description, mana, weight)
{

View File

@@ -0,0 +1,24 @@
using Client.Domain.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.Domain.Entities
{
public interface ItemInterface : EntityInterface
{
uint ItemId { get; set; }
ItemTypeEnum Type { get; set; }
string Name { get; set; }
string IconName { get; set; }
string Description { get; set; }
int Mana { get; set; }
uint Weight { get; set; }
uint Amount { get; set; }
bool IsQuest { get; set; }
bool IsAutoused { get; set; }
string FullDescription { get; }
}
}

View File

@@ -9,9 +9,9 @@ namespace Client.Domain.Events
{
public class ItemCreatedEvent : EventInterface
{
public readonly BaseItem Item;
public readonly ItemInterface Item;
public ItemCreatedEvent(BaseItem item)
public ItemCreatedEvent(ItemInterface item)
{
Item = item;
}

View File

@@ -9,18 +9,18 @@ using System.Threading.Tasks;
namespace Client.Domain.Service
{
public class ItemHander : EntityHandler<BaseItem>
public class ItemHander : EntityHandler<ItemInterface>
{
public override void OnCreate(BaseItem entity)
public override void OnCreate(ItemInterface entity)
{
eventBus.Publish(new ItemCreatedEvent(entity));
}
public override void OnDelete(BaseItem entity)
public override void OnDelete(ItemInterface entity)
{
eventBus.Publish(new ItemDeletedEvent(entity.Id));
}
public ItemHander(EntityFactoryInterface<BaseItem> factory, EventBusInterface eventBus) : base(factory)
public ItemHander(EntityFactoryInterface<ItemInterface> factory, EventBusInterface eventBus) : base(factory)
{
this.eventBus = eventBus;
}

View File

@@ -268,7 +268,7 @@ namespace Client.Domain.Service
public void Handle(ItemDeletedEvent @event)
{
items.Remove(@event.Id, out BaseItem? value);
items.Remove(@event.Id, out ItemInterface? value);
}
#endregion
@@ -282,7 +282,7 @@ namespace Client.Domain.Service
private ConcurrentDictionary<uint, CreatureInterface> creatures = new ConcurrentDictionary<uint, CreatureInterface>();
private ConcurrentDictionary<uint, Drop> drops = new ConcurrentDictionary<uint, Drop>();
private ConcurrentDictionary<uint, Skill> skills = new ConcurrentDictionary<uint, Skill>();
private ConcurrentDictionary<uint, BaseItem> items = new ConcurrentDictionary<uint, BaseItem>();
private ConcurrentDictionary<uint, ItemInterface> items = new ConcurrentDictionary<uint, ItemInterface>();
private readonly OutgoingMessageBuilderInterface outgoingMessageBuilder;
private readonly TransportInterface transport;
}