using ServerCore; using ServerBase; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ServerCommon { public class EndQuest : EntityBase { private string m_user_guid = string.Empty; private UInt32 m_end_quest_id = 0; private UInt32 m_end_quest_revision = 0; public EndQuest(EntityBase parent, string userGuid, UInt32 endQuestId, UInt32 endQuestRevision) : base(EntityType.EndQuest, parent) { m_user_guid = userGuid; m_end_quest_id = endQuestId; m_end_quest_revision = endQuestRevision; onInit().GetAwaiter().GetResult(); } public override async Task onInit() { addEntityAttributes(); return await base.onInit(); } public override string toBasicString() { return $"{this.getTypeName()} - {getRootParent().toBasicString()}"; } public override string toSummaryString() { return $"{this.getTypeName()} - {getRootParent().toBasicString()}"; } private void addEntityAttributes() { var direct_parent = getDirectParent(); NullReferenceCheckHelper.throwIfNull(direct_parent, () => $"direct_parent is null !!!"); addEntityAttribute(new EndQuestAttribute( this , m_user_guid, m_end_quest_id, m_end_quest_revision , direct_parent )); } public bool isUgq() { var quest_attribute = getEntityAttribute(); if (quest_attribute is null) return false; if (quest_attribute.QuestRevision > 0) { return true; } return false; } } }