using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ServerCore; using ServerBase; using ServerCommon; namespace GameServer { public class UgcNpcItem : Item { public UgcNpcItem(UgcNpc owner) : base(owner) { } public override async Task onInit() { var direct_parent = getDirectParent(); NullReferenceCheckHelper.throwIfNull(direct_parent, () => $"direct_parent is null !!!"); addEntityAttribute(new UgcNpcItemAttribute(this, direct_parent)); addEntityAction(new UgcNpcItemAction(this)); return await base.onInit(); } public override TAction getEntityAction() { var parent = getRootParent(); NullReferenceCheckHelper.throwIfNull(parent, () => $"parent is null !!!"); TAction? to_cast_entity_atcion; if (typeof(TAction) == typeof(ItemAction)) { to_cast_entity_atcion = base.getEntityAction() as TAction; NullReferenceCheckHelper.throwIfNull(to_cast_entity_atcion, () => $"to_cast_entity_atcion is null !!!"); return to_cast_entity_atcion; } to_cast_entity_atcion = base.getEntityAction(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_atcion, () => $"to_cast_entity_atcion is null !!!"); return to_cast_entity_atcion; } public override TAttribute getOriginEntityAttribute() { var parent = getRootParent(); ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!"); TAttribute? to_cast_entity_attribute; if (typeof(TAttribute) == typeof(ItemAttributeBase)) { to_cast_entity_attribute = base.getOriginEntityAttribute() as TAttribute; NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } to_cast_entity_attribute = base.getOriginEntityAttribute(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } public override TAttribute getEntityAttributeWithReadOnly() { var parent = getRootParent(); ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!"); TAttribute? to_cast_entity_attribute; if (typeof(TAttribute) == typeof(ItemAttributeBase)) { to_cast_entity_attribute = base.getEntityAttributeWithReadOnly() as TAttribute; NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } to_cast_entity_attribute = base.getEntityAttributeWithReadOnly(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } public override TAttribute getEntityAttributeWithCloneOnly() { var parent = getRootParent(); ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!"); TAttribute? to_cast_entity_attribute; if (typeof(TAttribute) == typeof(ItemAttributeBase)) { to_cast_entity_attribute = base.getEntityAttributeWithCloneOnly() as TAttribute; NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } to_cast_entity_attribute = base.getEntityAttributeWithCloneOnly(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } public override TAttribute getClonedEntityAttribute() { var parent = getRootParent(); ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!"); TAttribute? to_cast_entity_attribute; if (typeof(TAttribute) == typeof(ItemAttributeBase)) { to_cast_entity_attribute = base.getClonedEntityAttribute() as TAttribute; NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } to_cast_entity_attribute = base.getClonedEntityAttribute(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } public override TAttribute getEntityAttribute() { var parent = getRootParent(); ArgumentNullException.ThrowIfNull(parent, $"parent is null !!!"); TAttribute? to_cast_entity_attribute; if (typeof(TAttribute) == typeof(ItemAttributeBase)) { to_cast_entity_attribute = base.getEntityAttribute() as TAttribute; NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } to_cast_entity_attribute = base.getEntityAttribute(); NullReferenceCheckHelper.throwIfNull(to_cast_entity_attribute, () => $"to_cast_entity_attribute is null !!!"); return to_cast_entity_attribute; } } }