초기커밋
This commit is contained in:
264
GameServer/z.Backup/OwnedSocialAction.cs
Normal file
264
GameServer/z.Backup/OwnedSocialAction.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
//using System.Diagnostics.CodeAnalysis;
|
||||
//using ServerCommon;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using Nettention.Proud;
|
||||
//using Amazon.DynamoDBv2.DocumentModel;
|
||||
//using ServerCommon.BusinessLogDomain;
|
||||
|
||||
//namespace GameServer
|
||||
//{
|
||||
// public class OwnedSocialAction
|
||||
// {
|
||||
// SocialActionCollectionEntity socialActionCollection = new();
|
||||
// SocialActionSlotEntity socialActionSlot = new();
|
||||
|
||||
// /// <summary>
|
||||
// /// 재생 중인 소셜액션 아이디
|
||||
// /// </summary>
|
||||
// public int PlayingSocialActionId { get; private set; } = 0;
|
||||
// /// <summary>
|
||||
// /// 소셜액션 재생 시작시간(UTC)
|
||||
// /// </summary>
|
||||
// public DateTime SocialActionStartTime { get; private set; }
|
||||
|
||||
// public OwnedSocialAction() { }
|
||||
|
||||
// public async Task<bool> LoadDB(string accountGuid)
|
||||
// {
|
||||
// var collectDocument = await GameServerApp.Instance.MainDB.GetSocialActionCollection(accountGuid);
|
||||
// if (collectDocument == null)
|
||||
// {
|
||||
// Log.getLogger().error("collectDocument is null");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (!socialActionCollection.ReadFrom(collectDocument))
|
||||
// {
|
||||
// Log.getLogger().error("socialActionCollection read error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (socialActionCollection.Attr.collectionInfos.Count == 0)
|
||||
// {
|
||||
// await BasicSocialActionCollectionsSetting(accountGuid);
|
||||
// }
|
||||
|
||||
// var slotDocument = await GameServerApp.Instance.MainDB.GetSocialActionSlot(accountGuid);
|
||||
// if(slotDocument == null)
|
||||
// {
|
||||
// Log.getLogger().error("slotDocument is null");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (!socialActionSlot.ReadFrom(slotDocument))
|
||||
// {
|
||||
// Log.getLogger().error("socialActionSlot read error");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (socialActionSlot.Attr.slotInfos.Count == 0)
|
||||
// {
|
||||
// await BasicSocialActionSlotSetting(accountGuid);
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 기본 소셜액션 컬렉션 세팅
|
||||
// /// </summary>
|
||||
// /// <param name="accountGuid"></param>
|
||||
// /// <returns></returns>
|
||||
// async Task BasicSocialActionCollectionsSetting(string accountGuid)
|
||||
// {
|
||||
// foreach (var data in TableData.Instance._SocialActionTable.Values)
|
||||
// {
|
||||
// if (!data.IsDefault)
|
||||
// continue;
|
||||
|
||||
// AddSocialAction(data.SocialActionId);
|
||||
// }
|
||||
|
||||
// await GameServerApp.Instance.MainDB.UpdateDocument(socialActionCollection.DocumentForUpdate());
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 치트용 모든 SocialAction 추가
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// public async Task AllSocialActionCollectionsSetting()
|
||||
// {
|
||||
// foreach (var data in TableData.Instance._SocialActionTable.Values)
|
||||
// {
|
||||
// if (socialActionCollection.Attr.collectionInfos.Contains(data.SocialActionId))
|
||||
// continue;
|
||||
|
||||
// AddSocialAction(data.SocialActionId);
|
||||
// }
|
||||
|
||||
// await GameServerApp.Instance.MainDB.UpdateDocument(socialActionCollection.DocumentForUpdate());
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 기본 소셜액션 슬롯 세팅
|
||||
// /// </summary>
|
||||
// /// <param name="accountGuid"></param>
|
||||
// /// <returns></returns>
|
||||
// async Task BasicSocialActionSlotSetting(string accountGuid)
|
||||
// {
|
||||
// foreach (var data in TableData.Instance._SocialActionTable.Values)
|
||||
// {
|
||||
// if(!data.IsDefault)
|
||||
// continue;
|
||||
|
||||
// if (data.SlotNum < 1 || data.SlotNum > Constant.MAX_EMOTION_SLOT)
|
||||
// continue;
|
||||
|
||||
// int slot = data.SlotNum - 1;
|
||||
|
||||
// socialActionSlot.Attr.slotInfos[slot] = data.SocialActionId;
|
||||
// }
|
||||
|
||||
// await GameServerApp.Instance.MainDB.UpdateDocument(socialActionSlot.DocumentForUpdate());
|
||||
// }
|
||||
|
||||
// public void SendInfo(HostID hostId)
|
||||
// {
|
||||
// ClientToGame clientToGame = new ClientToGame();
|
||||
// clientToGame.Message = new ClientToGameMessage();
|
||||
// clientToGame.Message.OwnedSocialActionNoti = new ClientToGameMessage.Types.OwnedSocialActionNoti();
|
||||
|
||||
// foreach (var id in socialActionCollection.Attr.collectionInfos)
|
||||
// {
|
||||
// clientToGame.Message.OwnedSocialActionNoti.OwnedList.Add(id);
|
||||
// }
|
||||
|
||||
// foreach (var slotInfo in socialActionSlot.Attr.slotInfos)
|
||||
// {
|
||||
// SlotInfo slot = new SlotInfo();
|
||||
|
||||
// slot.Slot = slotInfo.Key;
|
||||
// slot.Id = slotInfo.Value;
|
||||
|
||||
// clientToGame.Message.OwnedSocialActionNoti.EquipList.Add(slot);
|
||||
// }
|
||||
|
||||
// GameServer.Instance.Send(hostId, RmiContext.ReliableSend, clientToGame);
|
||||
// }
|
||||
|
||||
// public bool ExchangeSocialActionSlot(int slot, int id, [MaybeNullWhen(false)] out Document changedDocument)
|
||||
// {
|
||||
// changedDocument = default;
|
||||
|
||||
// if (slot < 0 || slot >= ServerCommon.Constant.MAX_SOCIAL_ACTION_SLOT)
|
||||
// {
|
||||
// Log.getLogger().error($"Slot : {slot} is out range");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (id != 0)
|
||||
// {
|
||||
// if (!socialActionCollection.Attr.collectionInfos.TryGetValue(id, out _))
|
||||
// {
|
||||
// Log.getLogger().error($"SocialActionId : {id} - Not owned");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// foreach (var slotInfo in socialActionSlot.Attr.slotInfos)
|
||||
// {
|
||||
// if (slotInfo.Value == id)
|
||||
// {
|
||||
// Log.getLogger().error($"SocialActionId : {id} is duplicated");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// socialActionSlot.Attr.slotInfos[slot] = id;
|
||||
|
||||
// changedDocument = socialActionSlot.DocumentForUpdate();
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 소셜액션이 슬롯에 존재하는지 확인
|
||||
// /// </summary>
|
||||
// /// <param name="socialActionId">사용할 소셜액션 아이디</param>
|
||||
// /// <returns><see langword="true"/> 슬롯에 존재, <see langword="false"/> 슬롯에 없음</returns>
|
||||
// public bool IsSocialActionOnSlot(int socialActionId)
|
||||
// {
|
||||
// foreach (var slotInfo in socialActionSlot.Attr.slotInfos)
|
||||
// {
|
||||
// if (slotInfo.Value == socialActionId)
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public void SetPlaySocialAction(int socialActionId, DateTime startTime = default)
|
||||
// {
|
||||
// PlayingSocialActionId = socialActionId;
|
||||
// SocialActionStartTime = DateTime.UtcNow;
|
||||
|
||||
// if (startTime != default)
|
||||
// SocialActionStartTime = startTime;
|
||||
// }
|
||||
|
||||
// public void RemovePlaySocialAction()
|
||||
// {
|
||||
// PlayingSocialActionId = 0;
|
||||
// SocialActionStartTime = default;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 새로운 소셜액션 컬렉션에 추가
|
||||
// /// </summary>
|
||||
// /// <param name="socialActionId">소셜액션 컬렉션에 추가할 소셜액션 아이디</param>
|
||||
// /// <returns><see langword="true"/> 추가 성공, <see langword="false"/> 추가 실패</returns>
|
||||
// public bool AddSocialAction(int socialActionId)
|
||||
// {
|
||||
// if (!TableData.Instance._SocialActionTable.TryGetValue(socialActionId, out _))
|
||||
// {
|
||||
// Log.getLogger().error($"socialActionId : {socialActionId} is not tabledata");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// socialActionCollection.Attr.collectionInfos.Add(socialActionId);
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public ServerErrorCode AddSocialAction(int socialActionId, out Document? changeDocument, out SocialActionLogInfo? socialActionLogInfo)
|
||||
// {
|
||||
// changeDocument = default;
|
||||
// socialActionLogInfo = default;
|
||||
|
||||
// if (!TableData.Instance._SocialActionTable.TryGetValue(socialActionId, out _))
|
||||
// {
|
||||
// Log.getLogger().error($"socialActionId : {socialActionId} is not tabledata");
|
||||
// return ServerErrorCode.NotFoundTable;
|
||||
// }
|
||||
|
||||
// if (socialActionCollection.Attr.collectionInfos.Contains(socialActionId) == true)
|
||||
// {
|
||||
// Log.getLogger().info($"Already Register SocialAction. socialActionId : {socialActionId}");
|
||||
// return ServerErrorCode.AlreadyRegistered;
|
||||
// }
|
||||
|
||||
// SocialActionCollectionEntity changeEntity = new SocialActionCollectionEntity(socialActionCollection.DocumentForUpdate());
|
||||
// changeEntity.Attr.collectionInfos.Add(socialActionId);
|
||||
// changeDocument = changeEntity.DocumentForUpdate();
|
||||
|
||||
// socialActionLogInfo = SocialActionBusinessLogHelper.toSocialActionLogInfo(socialActionId, changeDocument);
|
||||
|
||||
// return ServerErrorCode.Success;
|
||||
// }
|
||||
|
||||
// public void UpdateSocialActionToMemory(Document changeDocument)
|
||||
// {
|
||||
// socialActionCollection.ReadFrom(changeDocument);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user