초기커밋
This commit is contained in:
347
GameServer/z.Backup/OwnedQuestList.cs
Normal file
347
GameServer/z.Backup/OwnedQuestList.cs
Normal file
@@ -0,0 +1,347 @@
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Nettention.Proud;
|
||||
using ServerCommon;
|
||||
using ServerCore; using ServerBase;
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Amazon.CloudWatchLogs.Model;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
using static ClientToGameMessage.Types;
|
||||
using Timestamp = global::Google.Protobuf.WellKnownTypes.Timestamp;
|
||||
public class OwnedQuestList
|
||||
{
|
||||
//public QuestListEntity questListEntity { get; set; } = new();
|
||||
public OwnedQuestList() { }
|
||||
|
||||
// internal async Task<bool> LoadDB(object player, string accountGuid)
|
||||
// {
|
||||
// var questList = await GameServerApp.Instance.MainDB.GetQuestList(accountGuid);
|
||||
// if (questList is null)
|
||||
// {
|
||||
// Log.getLogger().error("OwnedQuestList questList is null");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// foreach (var quest in questList.Quests.Values)
|
||||
// {
|
||||
|
||||
//
|
||||
// if (!questBaseInfo.QuestTaskGroupList.TryGetValue(quest.m_current_task_num, out var questTaskInfo))
|
||||
// {
|
||||
// Log.getLogger().error($"questEventInfo InvalidData questId = {quest.m_quest_id}, info.CurrentTaskNum : {quest.m_current_task_num}, id : {player.accountId}");
|
||||
// continue;
|
||||
// }
|
||||
// Log.getLogger().debug($"LoadDB call Player = {player.accountId}, questInfo = {JsonConvert.SerializeObject(quest)} , activeListIdx before clear = {JsonConvert.SerializeObject(quest.m_active_idx_list)}");
|
||||
// quest.m_active_idx_list.Clear();
|
||||
// quest.m_active_idx_list.AddRange(QuestManager.Instance.getActiveIdx(player.accountId, quest, questTaskInfo));
|
||||
//
|
||||
// quest.m_active_events.Clear();
|
||||
// quest.m_active_events.AddRange(QuestManager.Instance.getActiveEventStrings(quest, questTaskInfo));
|
||||
//
|
||||
// setQuestEventTimer(player, quest.m_active_idx_list, questTaskInfo);
|
||||
// }
|
||||
//
|
||||
// questListEntity = questList;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// internal void checkQuestTimer(object player)
|
||||
// {
|
||||
// foreach (var quest in questListEntity.Quests.Values)
|
||||
// {
|
||||
|
||||
//
|
||||
// if (!questBaseInfo.QuestTaskGroupList.TryGetValue(quest.m_current_task_num, out var questTaskInfo))
|
||||
// {
|
||||
// Log.getLogger().error($"questEventInfo InvalidData questId = {quest.m_quest_id}, info.CurrentTaskNum : {quest.m_current_task_num}, id : {player.accountId}");
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// setQuestEventTimer(player, quest.m_active_idx_list, questTaskInfo);
|
||||
// }
|
||||
// setNormalMailTimer(player, questListEntity);
|
||||
// }
|
||||
// private void setQuestEventTimer(object player, List<int> activeIdxs, QuestTaskGroup questTaskInfo)
|
||||
// {
|
||||
// foreach (int idx in activeIdxs)
|
||||
// {
|
||||
// if (!questTaskInfo.QuestEventGroup.TryGetValue(idx, out var eventInfo))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (eventInfo.EventTarget.Equals(EQuestEventTargetType.TIMER.ToString()))
|
||||
// {
|
||||
// //QuestManager.Instance.m_timer_check_users.TryAdd(player.accountId, idx);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void setNormalMailTimer(object player, QuestListEntity questList)
|
||||
// {
|
||||
// if (questList.RepeatInfo.m_is_checking == 1)
|
||||
// {
|
||||
// // QuestManager.Instance.m_normal_quest_check_users.TryAdd(player.accountId, 1);
|
||||
// // Log.getLogger().info($"setNormalMailTimer m_normal_quest_check_users Add accountId : {player.accountId}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// public bool CheckEndQuest(int questId, QuestBaseInfo questInfo)
|
||||
// {
|
||||
// bool isEnd = questListEntity.EndQuests.Any(v => v.Value.QuestId == questId);
|
||||
//
|
||||
// if (isEnd && !questInfo.QuestType.Equals(EQuestType.NORMAL.ToString()))
|
||||
// {
|
||||
// Log.getLogger().error($"Quest Alredy End questId = {questId}");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public bool hasQuest(int questId)
|
||||
// {
|
||||
// bool hasValue = questListEntity.Quests.Any(v => v.Value.m_quest_id == questId);
|
||||
//
|
||||
// return hasValue;
|
||||
// }
|
||||
|
||||
// public ServerErrorCode CheckAssignableQuest(QuestBaseInfo assignableQuestInfo)
|
||||
// {
|
||||
// if (!System.Enum.TryParse<EQuestType>(assignableQuestInfo.QuestType, out var questType))
|
||||
// {
|
||||
// Log.getLogger().error($"QuesType InvalidData QuesType = {assignableQuestInfo.QuestType}");
|
||||
// return ServerErrorCode.QuestInvalidType;
|
||||
// }
|
||||
//
|
||||
// var it = questListEntity.Quests.GetEnumerator();
|
||||
//
|
||||
// bool isMax = false;
|
||||
//
|
||||
// int epic_quest_count = 0;
|
||||
// int tutorial_quest_count = 0;
|
||||
// int normal_quest_count = 0;
|
||||
//
|
||||
//
|
||||
//
|
||||
// while (it.MoveNext())
|
||||
// {
|
||||
// var active_quest = it.Current;
|
||||
//
|
||||
// if (processingQuestInfo.QuestType.Equals(EQuestType.EPIC.ToString())) epic_quest_count++;
|
||||
// else if (processingQuestInfo.QuestType.Equals(EQuestType.TUTORIAL.ToString())) tutorial_quest_count++;
|
||||
// else if (processingQuestInfo.QuestType.Equals(EQuestType.NORMAL.ToString())) normal_quest_count++;
|
||||
// }
|
||||
//
|
||||
// switch (questType)
|
||||
// {
|
||||
// case EQuestType.NORMAL:
|
||||
// if (normal_quest_count >= MetaHelper.GameConfigMeta.MaxNormalQuest) isMax = true;
|
||||
// break;
|
||||
// case EQuestType.EPIC:
|
||||
// if (epic_quest_count >= MetaHelper.GameConfigMeta.MaxEpicQuest) isMax = true;
|
||||
// break;
|
||||
// case EQuestType.TUTORIAL:
|
||||
// if (tutorial_quest_count >= MetaHelper.GameConfigMeta.MaxTutorialQuest) isMax = true;
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (isMax) return ServerErrorCode.QuestTypeAssignCountMax;
|
||||
//
|
||||
// return ServerErrorCode.Success;
|
||||
// }
|
||||
|
||||
// public bool DeleteQuestInMemory(int questId)
|
||||
// {
|
||||
// if (questListEntity.Quests.ContainsKey(questId))
|
||||
// {
|
||||
// if (!questListEntity.Quests.TryRemove(questId, out var quest))
|
||||
// {
|
||||
// Log.getLogger().error($"DeleteQuestInMemory Error questId : {questId}");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public bool DeleteQuestInMemory(out QuestListEntity newQuestListEntity)
|
||||
// {
|
||||
//
|
||||
// questListEntity.Quests.Clear();
|
||||
// questListEntity.EndQuests.Clear();
|
||||
// questListEntity.RepeatInfo.m_is_checking = 0;
|
||||
// newQuestListEntity = new QuestListEntity(questListEntity.DocumentForUpdate());
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public ServerErrorCode QuestEnd(int questId, QuestListEntity newQuestListEntity, string player)
|
||||
// {
|
||||
// if (!newQuestListEntity.Quests.TryRemove(questId, out var deletedQuestInfo))
|
||||
// {
|
||||
// Log.getLogger().error($"Quests.TryRemove Error questId = {questId}", player);
|
||||
// return ServerErrorCode.QuestInvalidValue;
|
||||
// }
|
||||
//
|
||||
// DateTime now = DateTime.UtcNow;
|
||||
// TimeStamp ts = TimeStamp.FromDateTime(now);
|
||||
// if (!newQuestListEntity.EndQuests.TryGetValue(questId, out var endQuest))
|
||||
// {
|
||||
// endQuest = new();
|
||||
// endQuest.EndCount = 1;
|
||||
// endQuest.LastEndTime = ts;
|
||||
// endQuest.QuestId = questId;
|
||||
//
|
||||
// }
|
||||
// endQuest.EndCount++;
|
||||
// endQuest.LastEndTime = ts;
|
||||
// endQuest.QuestId = questId;
|
||||
// newQuestListEntity.EndQuests.AddOrUpdate(questId, endQuest, (key, oldValue) => endQuest);
|
||||
|
||||
// return ServerErrorCode.Success;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// public ServerErrorCode cheatQuestComplete(int questId, out QuestListEntity newQuestListEntity)
|
||||
// {
|
||||
// newQuestListEntity = new QuestListEntity(questListEntity.DocumentForUpdate());
|
||||
//
|
||||
//
|
||||
// if (!newQuestListEntity.Quests.TryGetValue(questId, out var questInfo))
|
||||
// {
|
||||
// return ServerErrorCode.QuestIdNotFound;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// questInfo.m_active_idx_list.Clear();
|
||||
// questInfo.m_active_events.Clear();
|
||||
// questInfo.m_is_complete = true ? 1 : 0;
|
||||
//
|
||||
// return ServerErrorCode.Success;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public bool checkProcessingQuest(int questId, out QuestListEntity newQuestListEntity)
|
||||
// {
|
||||
// newQuestListEntity = new QuestListEntity(questListEntity.DocumentForUpdate());
|
||||
// return newQuestListEntity.Quests.ContainsKey(questId);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public void SendInfoFromLogin(HostID hostId)
|
||||
// {
|
||||
// // SendQuestAssignMetaInfoNoti(hostId);
|
||||
// // SendQuestListNoti(hostId);
|
||||
// SendQuestEndListNoti(hostId);
|
||||
// }
|
||||
//
|
||||
// public bool GetQuestInfo(out QuestListEntity newQuestListEntity)
|
||||
// {
|
||||
// newQuestListEntity = questListEntity.Clone();
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void UpdateQuestReapeatInfo(Timestamp nextTS, out QuestListEntity newQuestListEntity)
|
||||
// {
|
||||
// newQuestListEntity = new(questListEntity.DocumentForUpdate());
|
||||
//
|
||||
// newQuestListEntity.RepeatInfo.m_next_allocate_time = nextTS;
|
||||
// }
|
||||
|
||||
|
||||
// void SendQuestListNoti(HostID hostId)
|
||||
// {
|
||||
// ClientToGame clientToGame = new ClientToGame();
|
||||
// clientToGame.Message = new ClientToGameMessage();
|
||||
// clientToGame.Message.QuestInfoNoti = new ClientToGameMessage.Types.QuestList();
|
||||
// clientToGame.Message.QuestInfoNoti.Quests.AddRange(makeQeustInfoData(questListEntity.Quests.Values.ToList()));
|
||||
// clientToGame.Message.QuestInfoNoti.QuestMetaInfos.AddRange(makeQuestMetaInfoData(questListEntity.Quests.Values.ToList()));
|
||||
// //GameServer.Instance.Send(hostId, RmiContext.ReliableSend, clientToGame);
|
||||
// }
|
||||
//
|
||||
// void SendQuestAssignMetaInfoNoti(HostID hostId)
|
||||
// {
|
||||
// ClientToGame clientToGame = new ClientToGame();
|
||||
// clientToGame.Message = new ClientToGameMessage();
|
||||
// clientToGame.Message.NtfQuestAssignMetaInfo = new ClientToGameMessage.Types.GS2C_NTF_QUEST_ASSIGN_META_INFO();
|
||||
// clientToGame.Message.NtfQuestAssignMetaInfo.QuestAssignMeteInfos.AddRange(TableData.Instance.m_quest_assign_meta_infos);
|
||||
// clientToGame.Message.NtfQuestAssignMetaInfo.QuestTaskMetaInfos.AddRange(TableData.Instance.m_quest_task_meta_infos);
|
||||
// // GameServer.Instance.Send(hostId, RmiContext.ReliableSend, clientToGame);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// private List<QuestInfo> makeQeustInfoData(List<UserQuestInfo> infos)
|
||||
// {
|
||||
// List<QuestInfo> questInfos = new List<QuestInfo>();
|
||||
//
|
||||
// foreach (UserQuestInfo info in infos)
|
||||
// {
|
||||
// QuestInfo questInfo = new QuestInfo();
|
||||
// questInfo.QuestId = info.m_quest_id;
|
||||
// questInfo.QuestAssignTime = info.m_quest_assign_time;
|
||||
// questInfo.CurrentTaskNum = info.m_current_task_num;
|
||||
// questInfo.TaskStartTime = info.m_task_start_time;
|
||||
// questInfo.QuestCompleteTime = info.m_quest_complete_time;
|
||||
// questInfo.ActiveIdxList.AddRange(info.m_active_idx_list);
|
||||
// questInfo.HasCounter = info.m_has_counter;
|
||||
// questInfo.MinCounter = info.m_min_counter;
|
||||
// questInfo.MaxCounter = info.m_max_counter;
|
||||
// questInfo.CurrentCounter = info.m_current_counter;
|
||||
// questInfo.IsComplete = info.m_is_complete;
|
||||
// questInfo.ReplacedRewardGroupId = info.m_replaced_reward_group_id;
|
||||
// questInfo.HasTimer = info.m_has_timer;
|
||||
// questInfo.TimerCompleteTime = info.m_timer_complete_time;
|
||||
// questInfos.Add(questInfo);
|
||||
// }
|
||||
//
|
||||
// return questInfos;
|
||||
// }
|
||||
//
|
||||
// private List<QuestMetaInfo> makeQuestMetaInfoData(List<UserQuestInfo> infos)
|
||||
// {
|
||||
// List<QuestMetaInfo> metaInfos = new List<QuestMetaInfo>();
|
||||
// foreach (UserQuestInfo info in infos)
|
||||
// {
|
||||
// if (!TableData.Instance._QuestScriptDataTable.TryGetValue(info.m_quest_id, out var questScripts))
|
||||
// {
|
||||
// Log.getLogger().error($"QuestMetaInfoData Not Exist questId : {info.m_quest_id}");
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// foreach (var script in questScripts.Values)
|
||||
// {
|
||||
//
|
||||
// //var meta = fillQuestMetaInfo(script);
|
||||
// //metaInfos.Add(meta);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return metaInfos;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// public void UpdateDBToMemory(Document document)
|
||||
// {
|
||||
// questListEntity = new QuestListEntity(document);
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user