using Google.Protobuf.WellKnownTypes; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using ServerCore; using ServerBase; using MetaAssets; namespace ServerCommon; public class QuestAttrib : AttribBase { [JsonProperty("quest_id")] public UInt32 m_quest_id { get; set; } = 0; [JsonProperty("quest_type")] public EQuestType m_quest_type { get; set; } = EQuestType.NONE; [JsonProperty("ugq_quest_info")] public UgqQuestInfo m_ugq_quest_info { get; set; } = new(); [JsonProperty("quest_assign_time")] public DateTime m_quest_assign_time { get; set; } = DateTimeHelper.Current; [JsonProperty("current_task_num")] public Int32 m_current_task_num { get; set; } = 0; [JsonProperty("task_start_time")] public DateTime m_task_start_time { get; set; } = DateTimeHelper.Current; [JsonProperty("quest_complete_time")] public DateTime m_quest_complete_time { get; set; } = DateTimeHelper.MinTime; [JsonProperty("active_events")] public List m_active_events { get; set; } = new(); [JsonProperty("has_counter")] public Int32 m_has_counter { get; set; } = 0; [JsonProperty("min_counter")] public Int32 m_min_counter { get; set; } = 0; [JsonProperty("max_counter")] public Int32 m_max_counter { get; set; } = 0; [JsonProperty("current_counter")] public Int32 m_current_counter { get; set; } = 0; [JsonProperty("is_complete")] public Int32 m_is_complete { get; set; } = 0; [JsonProperty("replaced_reward_groupId")] public Int32 m_replaced_reward_group_id { get; set; } = 0; [JsonProperty("has_timer")] public Int32 m_has_timer { get; set; } = 0; [JsonProperty("timer_complete_time")] public DateTime m_timer_complete_time { get; set; } = DateTimeHelper.MinTime; [JsonProperty("is_current_task_complete")] public Int32 m_is_current_task_complete { get; set; } = 0; [JsonProperty("completed_idx_strings")] public List m_completed_idx_strings { get; set; } = new(); public QuestAttrib() : base(typeof(QuestAttrib).Name) { } } //============================================================================================= // PK(Partition Key) : "quest#owner_guid" // SK(Sort Key) : "quest_id" // DocType : QuestDoc // QuestAttrib : {} // ... //============================================================================================= public class QuestDoc : DynamoDbDocBase { public QuestDoc() : base(typeof(QuestDoc).Name) { appendAttribWrapperAll(); } public QuestDoc(string ownerGuid, UInt32 questId, UInt32 questRevision) : base(typeof(QuestDoc).Name) { setCombinationKeyForPK(ownerGuid); setCombinationKeyForSK(makeQuestSKString(questId, questRevision)); fillUpPrimaryKey(onMakePK(), onMakeSK()); appendAttribWrapperAll(); } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return "quest#"; } protected override string onMakePK() { return $"{onGetPrefixOfPK()}{getCombinationKeyForPK()}"; } protected override string onMakeSK() { return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}"; } protected override ServerErrorCode onCheckAndSetPK(string pk) { getPrimaryKey().fillUpPK(pk); return ServerErrorCode.Success; } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); return ServerErrorCode.Success; } public static string makeQuestSKString(UInt32 questId, UInt32 questRevision) { return $"{questId}#{questRevision}"; } }