using Nettention.Proud; using ServerCore; using ServerBase; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Dynamic; using System.Linq; using System.Text; using System.Threading.Tasks; using Amazon.DynamoDBv2.DocumentModel; using static ClientToGameMessage.Types; using System.Data; using ServerCommon; namespace GameServer { public class OwnedQuestMail { string accountGuid = string.Empty; //ConcurrentDictionary questMails = new(); //bool m_is_questmail_loaded = false; public OwnedQuestMail() { } // public async Task LoadDB(string accountGuid) // { // this.accountGuid = accountGuid; // var questMailList = await GameServerApp.Instance.MainDB.GetQuestMailList(accountGuid); // if (questMailList is null) // { // Log.getLogger().error("OwnedQuestMail questMailList is null"); // return false; // } // questMails = questMailList; // m_is_questmail_loaded = true; // return true; // } // public List GetQuestMailList() // { // //일단 새로 리프레시 하지 말고 기존에 저장하고 있는 값을 전달 해준다. // //var questMailList = await GameServerApp.Instance.MainDB.GetQuestMailList(accountGuid); // //if (questMailList is null) // //{ // // Log.getLogger().error("OwnedQuestMail questMailList is null"); // // return new(); // //} // // List questmailInfos = new(); // // foreach (var mail in questMails) // { // QuestMailInfo info = new(); // // info.IsRead = mail.Value.Attr.isRead == true ? 1 : 0; // info.QuestId = mail.Value.Attr.questId; // info.CreateTime = mail.Value.Attr.createTime; // questmailInfos.Add(info); // } // // return questmailInfos; // } // // public bool isMailLoad() // { // return m_is_questmail_loaded; // } // // public bool CheckQuestMailExist(int questId) // { // bool ret = questMails.ContainsKey(questId); // return ret; // } // // public ServerErrorCode ReadQuestMail(int questId, out QuestMailEntity? newQuestMailEntity) // { // newQuestMailEntity = default; // // if(!questMails.TryGetValue(questId, out var questMailEntity)) // { // Log.getLogger().error($"Not Found Mail. questId : {questId}"); // return ServerErrorCode.QuestMailNotExist; // } // // questMailEntity.Attr.isRead = true; // newQuestMailEntity = new(questMailEntity.DocumentForUpdate()); // // return ServerErrorCode.Success; // } // // public ServerErrorCode DelReceivedQuestMail(int questId, out QuestMailEntity? newQuestMailEntity) // { // newQuestMailEntity = new(); // if (!questMails.TryGetValue(questId, out var questMailEntity)) // { // Log.getLogger().error($"Not Found Mail. questId : {questId}"); // return ServerErrorCode.QuestMailNotExist; // } // // newQuestMailEntity = new(questMailEntity.DocumentForUpdate()); // // return ServerErrorCode.Success; // } // // public ServerErrorCode DelReceivedQuestMailAll(out List mailDocuments) // { // mailDocuments = new(); // // foreach (QuestMailEntity entity in questMails.Values) // { // // mailDocuments.Add(entity.DocumentForUpdate()); // } // // return ServerErrorCode.Success; // } // // // public void UpdateQuestMailToMemory(int questId, QuestMailEntity entity) // { // questMails.AddOrUpdate(questId, entity, (key, oldValue) => entity); // } // // public void DeleteQuestMailToMemory(int questId) // { // if (!questMails.TryRemove(questId, out _)) // { // Log.getLogger().error("DeleteQuestMailToMemory failed"); // } // } // // // // public HashSet getNormalMailSet() // { // HashSet normalMailSet = new(); // // return normalMailSet; // } } }