초기커밋
This commit is contained in:
176
GameServer/z.Backup/OwnedBuilding.cs
Normal file
176
GameServer/z.Backup/OwnedBuilding.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Diagnostics.CodeAnalysis;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ServerCommon;
|
||||
//using ServerCore; using ServerBase;
|
||||
//using Nettention.Proud;
|
||||
|
||||
//namespace GameServer
|
||||
//{
|
||||
// public class OwnedBuilding
|
||||
// {
|
||||
// BuildingListEntity BuildingList = new();
|
||||
// ConcurrentDictionary<int, BuildingEntity> Buildings = new();
|
||||
|
||||
// public OwnedBuilding() { }
|
||||
|
||||
// public async Task<bool> LoadDB(string accountGuid)
|
||||
// {
|
||||
//// var buildingListDocument = await GameServerApp.Instance.MainDB.GetBuildingList(accountGuid);
|
||||
//// if (buildingListDocument == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("document is null");
|
||||
//// return false;
|
||||
//// }
|
||||
|
||||
//// if (!BuildingList.ReadFrom(buildingListDocument))
|
||||
//// {
|
||||
//// Log.getLogger().error("RoomList read error");
|
||||
//// return false;
|
||||
//// }
|
||||
////
|
||||
//// var buildingEntityList = await GameServerApp.Instance.MainDB.GetBuildingEntityList(BuildingList.Attr.buildingIds.ToList());
|
||||
//// if (buildingEntityList == null)
|
||||
//// {
|
||||
//// Log.getLogger().error("roomList is null");
|
||||
//// return false;
|
||||
//// }
|
||||
////
|
||||
//// foreach (var buildingEntity in buildingEntityList)
|
||||
//// {
|
||||
//// if (!Buildings.TryAdd(buildingEntity.PK_Id, buildingEntity))
|
||||
//// {
|
||||
//// Log.getLogger().error($"BuildingEntity buildingId : {buildingEntity.PK_Id} - add fail");
|
||||
//// return false;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void SendInfo(HostID hostId)
|
||||
// {
|
||||
// // TODO: 소유빌딩이 없는 경우 패킷 보낼지 말지 결정
|
||||
|
||||
// ClientToGame clientToGame = new ClientToGame();
|
||||
// clientToGame.Message = new ClientToGameMessage();
|
||||
// clientToGame.Message.OwnedBuildingNoti = new ClientToGameMessage.Types.OwnedBuildingNoti();
|
||||
|
||||
// foreach (var building in Buildings.Values)
|
||||
// {
|
||||
// BuildingInfo data = new BuildingInfo();
|
||||
|
||||
// data.Id = building.PK_Id;
|
||||
// data.Owner = building.Attr.Owner;
|
||||
// data.Name = building.Attr.Name;
|
||||
// data.Description = building.Attr.Description;
|
||||
|
||||
// foreach (var prop in building.Attr.PropInfo)
|
||||
// {
|
||||
// PropInfo propInfo = new();
|
||||
|
||||
// propInfo.AnchorGuid = prop.Key;
|
||||
// propInfo.TableId = prop.Value.TableId;
|
||||
|
||||
// data.PropList.Add(propInfo);
|
||||
// }
|
||||
|
||||
// foreach (var instance in building.Attr.FloorInfo)
|
||||
// {
|
||||
// SlotInfo slot = new SlotInfo();
|
||||
|
||||
// slot.Slot = instance.Key;
|
||||
// slot.Id = instance.Value;
|
||||
|
||||
// data.RoomList.Add(slot);
|
||||
// }
|
||||
|
||||
// clientToGame.Message.OwnedBuildingNoti.List.Add(data);
|
||||
// }
|
||||
|
||||
// //GameServer.Instance.Send(hostId, RmiContext.ReliableSend, clientToGame);
|
||||
// }
|
||||
|
||||
// public bool GetBuildingEntity(int buildingId, [MaybeNullWhen(false)] out BuildingEntity outEntity)
|
||||
// {
|
||||
// return Buildings.TryGetValue(buildingId, out outEntity);
|
||||
// }
|
||||
|
||||
// public bool ClearBuildingPropAndInstance(int buildingId, [MaybeNullWhen(false)] out BuildingEntity clearedEntity)
|
||||
// {
|
||||
// clearedEntity = default;
|
||||
|
||||
// if (!GetBuildingEntity(buildingId, out var buildingEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"Not OwnedBuilding BuildingId:{buildingId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// buildingEntity.Attr.PropInfo.Clear();
|
||||
// buildingEntity.Attr.FloorInfo.Clear();
|
||||
|
||||
// clearedEntity = buildingEntity;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public bool IsChangeable(int buildingId, string guid) // TODO: accountId?? accountGuid?? characterGuid??
|
||||
// {
|
||||
// if (!Buildings.TryGetValue(buildingId, out var buildingData))
|
||||
// {
|
||||
// Log.getLogger().error($"Not OwnedBuilding BuildingId:{buildingId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (buildingData.Attr.Owner != guid)
|
||||
// return false;
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public bool ExchangeProp(int buildingId, string anchorGuid, string itemGuid, [MaybeNullWhen(false)] out BuildingEntity changedEntity) // TODO: ID로?? 아이템ID로??
|
||||
// {
|
||||
// changedEntity = default;
|
||||
|
||||
// if (!GetBuildingEntity(buildingId, out var buildingEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"Not OwnedBuilding BuildingId:{buildingId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// changedEntity = buildingEntity;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// //public void RollBackExchangeProp(BuildingEntity changedEntity, string anchorGuid, string oldItemGuid)
|
||||
// //{
|
||||
// // changedEntity.Attr.PropInfo[anchorGuid] = oldItemGuid;
|
||||
// //}
|
||||
|
||||
// public bool ExchangeInstance(int buildingId, int floor, int instanceId, out int oldInstanceId, [MaybeNullWhen(false)] out BuildingEntity changedEntity)
|
||||
// {
|
||||
// oldInstanceId = 0;
|
||||
// changedEntity = default;
|
||||
|
||||
// if (!GetBuildingEntity(buildingId, out var buildingEntity))
|
||||
// {
|
||||
// Log.getLogger().error($"Not OwnedBuilding BuildingId:{buildingId}");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// buildingEntity.Attr.FloorInfo.TryGetValue(floor, out oldInstanceId);
|
||||
// buildingEntity.Attr.FloorInfo[floor] = instanceId;
|
||||
|
||||
// changedEntity = buildingEntity;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// public void RollBackExchangeInstance(BuildingEntity changedEntity, int floor, int oldInstanceId)
|
||||
// {
|
||||
// changedEntity.Attr.FloorInfo[floor] = oldInstanceId;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user