초기커밋
This commit is contained in:
57
GameServer/Contents/MyHome/Helper/MyHomeBusinessLogHelper.cs
Normal file
57
GameServer/Contents/MyHome/Helper/MyHomeBusinessLogHelper.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public static class MyHomeBusinessLogHelper
|
||||
{
|
||||
public static MyHomeLogInfo toMyHomeLogInfo(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
var myhome_log_info = new MyHomeLogInfo();
|
||||
myhome_log_info.setMyHomeInfo(myhomeAttribute);
|
||||
return myhome_log_info;
|
||||
}
|
||||
|
||||
public static void setMyHomeInfo(this MyHomeLogInfo logData, MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
logData.MyhomeGuid = myhomeAttribute.MyhomeGuid;
|
||||
logData.MyhomeMetaId = (int)myhomeAttribute.MyhomeMetaId;
|
||||
logData.MyhomeName = myhomeAttribute.MyhomeName;
|
||||
}
|
||||
|
||||
public static MyhomeRenameLogInfo toMyhomeRenameLogInfo(string myhomeGuid, string oldMyhomeName, string newMyhomeName)
|
||||
{
|
||||
var myhome_rename_log_info = new MyhomeRenameLogInfo();
|
||||
myhome_rename_log_info.setMyhomeRenameInfo(myhomeGuid, oldMyhomeName, newMyhomeName);
|
||||
return myhome_rename_log_info;
|
||||
}
|
||||
|
||||
public static void setMyhomeRenameInfo(this MyhomeRenameLogInfo logData, string myhomeGuid, string oldMyhomeName, string newMyhomeName)
|
||||
{
|
||||
logData.MyhomeGuid = myhomeGuid;
|
||||
logData.OldMyhomeName = oldMyhomeName;
|
||||
logData.NewMyhomeName = newMyhomeName;
|
||||
}
|
||||
|
||||
public static MyhomeExchangeLogInfo toMyhomeExchangeLogInfo(string userGuid, string oldMyhomeGuid, string newMyhomeGuid)
|
||||
{
|
||||
var myhome_exchange_log_info = new MyhomeExchangeLogInfo();
|
||||
myhome_exchange_log_info.setMyhomeExchangeInfo(userGuid, oldMyhomeGuid, newMyhomeGuid);
|
||||
return myhome_exchange_log_info;
|
||||
}
|
||||
|
||||
public static void setMyhomeExchangeInfo(this MyhomeExchangeLogInfo logData, string userGuid, string oldMyhomeGuid, string newMyhomeGuid)
|
||||
{
|
||||
logData.UserGuid = userGuid;
|
||||
logData.OldMyhomeGuid = oldMyhomeGuid;
|
||||
logData.NewMyhomeGuid = newMyhomeGuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
868
GameServer/Contents/MyHome/Helper/MyhomeHelper.cs
Normal file
868
GameServer/Contents/MyHome/Helper/MyhomeHelper.cs
Normal file
@@ -0,0 +1,868 @@
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Newtonsoft.Json;
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
internal static class MyhomeHelper
|
||||
{
|
||||
public static Result getMyhomeOwnerUserGuidAndMyhomeGuidFromRoomId(string roomId, out string myhomeOwnerUserGuid, out string myhomeGuid)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
myhomeOwnerUserGuid = string.Empty;
|
||||
myhomeGuid = string.Empty;
|
||||
|
||||
var roomIdElement = roomId.Split(":");
|
||||
if (roomIdElement.Length != ServerCommon.Constant.MYHOME_INSTANCE_ROOM_ID_ELEMENT_COUNT)
|
||||
{
|
||||
err_msg = $"MyHome RoomId Element Count Wrong !!! : instanceRoomId:{roomId}";
|
||||
result.setFail(ServerErrorCode.RoomIsNotMyHome, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (roomIdElement[0] != ServerCommon.Constant.PREFIX_MYHOME_INSTANCE_ROOM_ID)
|
||||
{
|
||||
err_msg = $"MyHome RoomId Prefix Is Not {ServerCommon.Constant.PREFIX_MYHOME_INSTANCE_ROOM_ID} !!! : instanceRoomId:{roomId}";
|
||||
result.setFail(ServerErrorCode.RoomIsNotMyHome, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
myhomeOwnerUserGuid = roomIdElement[1];
|
||||
myhomeGuid = roomIdElement[2];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<(Result, MyHomeAttrib?)> getEnterMyhomeAttribFromDynamoDb(string userGuid, string enterMyhomeGuid = "")
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var myhome_doc = new MyhomeDoc();
|
||||
myhome_doc.setCombinationKeyForPK(userGuid);
|
||||
myhome_doc.onApplyPKSK();
|
||||
|
||||
QueryOperationConfig query_config = db_client.makeQueryConfigForReadByPKOnly(myhome_doc.getPK());
|
||||
(result, var read_docs) = await db_client.simpleQueryDocTypesWithQueryOperationConfig<MyhomeDoc>(query_config);
|
||||
|
||||
MyHomeAttrib? myhome_attrib = default;
|
||||
|
||||
foreach (var doc in read_docs)
|
||||
{
|
||||
myhome_attrib = doc.getAttrib<MyHomeAttrib>();
|
||||
if (myhome_attrib == null)
|
||||
continue;
|
||||
|
||||
if (enterMyhomeGuid == "" && myhome_attrib.SelectedFlag == 1)
|
||||
return (result, myhome_attrib);
|
||||
|
||||
if (enterMyhomeGuid == myhome_attrib.MyhomeGuid)
|
||||
return (result, myhome_attrib);
|
||||
}
|
||||
|
||||
err_msg = $"Myhome Not Found !!! : userGuid:{userGuid}, myhomeGuid:{enterMyhomeGuid}";
|
||||
result.setFail(ServerErrorCode.MyHomeNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, myhome_attrib);
|
||||
}
|
||||
|
||||
public static Result checkMyhomeName(string myhomeName)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var myhome_name_min_length = MetaHelper.GameConfigMeta.MyhomenameMinLength;
|
||||
var myhome_name_max_length = MetaHelper.GameConfigMeta.MyhomenameMaxLength;
|
||||
|
||||
if (myhomeName.Length < myhome_name_min_length)
|
||||
{
|
||||
err_msg = $"Myhome Name Length Long !!! : myhomeName:{myhomeName}";
|
||||
result.setFail(ServerErrorCode.MyhomeNameLengthShort, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (myhomeName.Length > myhome_name_max_length)
|
||||
{
|
||||
err_msg = $"Myhome Name Length Long !!! : myhomeName:{myhomeName}";
|
||||
result.setFail(ServerErrorCode.MyhomeNameLengthLong, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkMyhomeUgcInfo(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
result = checkDuplicateAnchorGuid(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkDuplicateAnchorGuid() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result = checkMyhomeInteriorPoint(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkMyhomeInteriorPoint() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result = checkMyhomeInterphone(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkMyhomeInterphone() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result = checkMyhomeStartPoint(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkMyhomeStartPoint() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result = checkCrafterCount(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkCrafterCount() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result = checkMyhomeUgcNpc(myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to checkMyhomeUgcNpc() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkDuplicateAnchorGuid(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var anchor_guids = new HashSet<String>();
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
var anchor_guid = anchorInfo.AnchorGuid;
|
||||
|
||||
if (!anchor_guids.Add(anchor_guid))
|
||||
{
|
||||
err_msg = $"AnchorGuid Duplicate In Myhome Ugc !!! : anchorGuid:{anchor_guid}";
|
||||
result.setFail(ServerErrorCode.AnchorGuidDuplicate, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkMyhomeInteriorPoint(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
if (!MetaData.Instance._EditableRoomMetaTable.TryGetValue(myhomeUgcInfo.RoomType, out var editableRoomMetaData))
|
||||
{
|
||||
err_msg = $"Failed to MetaData.TryGetValue() !!! : editableRoomMetaId:{myhomeUgcInfo.RoomType}";
|
||||
result.setFail(ServerErrorCode.EditableRoomMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var total_interior_point = 0;
|
||||
|
||||
foreach (var frameworkInfo in myhomeUgcInfo.FrameworkInfos)
|
||||
{
|
||||
if (!MetaData.Instance._EditableFrameworkMetaTable.TryGetValue(frameworkInfo.InteriorItemId, out var editableFrameworkMetaData))
|
||||
{
|
||||
err_msg = $"Failed to MetaData.TryGetValue() !!! : editableFrameworkMetaId:{frameworkInfo.InteriorItemId}";
|
||||
result.setFail(ServerErrorCode.EditableFrameworkMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
total_interior_point += editableFrameworkMetaData.InteriorPoint;
|
||||
}
|
||||
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isProp())
|
||||
continue;
|
||||
|
||||
if (!MetaData.Instance._InteriorMetaTable.TryGetValue(anchorInfo.TableId, out var interiorMetaData))
|
||||
{
|
||||
err_msg = $"Failed to MetaData.TryGetValue() !!! : interiorMetaId:{anchorInfo.TableId}";
|
||||
result.setFail(ServerErrorCode.InteriorMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
total_interior_point += interiorMetaData.InteriorPoint;
|
||||
}
|
||||
|
||||
if (total_interior_point > editableRoomMetaData.LimitInteriorPoint)
|
||||
{
|
||||
err_msg = $"Myhome Ugc Total InteriorPoint:{total_interior_point} > LimitInteriorPoint:{editableRoomMetaData.LimitInteriorPoint}";
|
||||
result.setFail(ServerErrorCode.InteriorPointExceed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkMyhomeInterphone(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var myhome_interphone_framework_meta_id = MetaHelper.GameConfigMeta.MyhomeInterphone;
|
||||
var is_exist_interphone = false;
|
||||
|
||||
foreach (var frameworkInfo in myhomeUgcInfo.FrameworkInfos)
|
||||
{
|
||||
if (!MetaData.Instance._EditableFrameworkMetaTable.TryGetValue(frameworkInfo.InteriorItemId, out var editableFrameworkMetaData))
|
||||
{
|
||||
err_msg = $"Failed to TryGetValue() !!! : editableFrameworkMetaId:{frameworkInfo.InteriorItemId}";
|
||||
result.setFail(ServerErrorCode.EditableFrameworkMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (editableFrameworkMetaData.id == myhome_interphone_framework_meta_id)
|
||||
{
|
||||
if (is_exist_interphone)
|
||||
{
|
||||
err_msg = $"Myhome Interphone Exceed !!!";
|
||||
result.setFail(ServerErrorCode.MyhomeInterphoneExceed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
is_exist_interphone = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_exist_interphone)
|
||||
{
|
||||
err_msg = $"Myhome Interphone Not Exist !!!";
|
||||
result.setFail(ServerErrorCode.MyhomeInterphoneNotExist, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkMyhomeStartPoint(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var myhome_start_point_framework_meta_id = MetaHelper.GameConfigMeta.MyhomeStartPoint;
|
||||
var is_exist_start_pos = false;
|
||||
|
||||
foreach (var frameworkInfo in myhomeUgcInfo.FrameworkInfos)
|
||||
{
|
||||
if (!MetaData.Instance._EditableFrameworkMetaTable.TryGetValue(frameworkInfo.InteriorItemId, out var editableFrameworkMetaData))
|
||||
{
|
||||
err_msg = $"Failed to TryGetValue() !!! : editableFrameworkMetaId:{frameworkInfo.InteriorItemId}";
|
||||
result.setFail(ServerErrorCode.EditableFrameworkMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (editableFrameworkMetaData.id == myhome_start_point_framework_meta_id)
|
||||
{
|
||||
if (is_exist_start_pos)
|
||||
{
|
||||
err_msg = $"Myhome StartPos Exceed !!!";
|
||||
result.setFail(ServerErrorCode.MyhomeStartPointExceed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
is_exist_start_pos = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_exist_start_pos)
|
||||
{
|
||||
err_msg = $"Myhome StartPos Not Exist !!!";
|
||||
result.setFail(ServerErrorCode.MyhomeStartPointNotExist, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkCrafterCount(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
if (!MetaData.Instance._EditableRoomMetaTable.TryGetValue(myhomeUgcInfo.RoomType, out var editable_room_meta_data))
|
||||
{
|
||||
err_msg = $"Failed to TryGetValue() !!! : editableRoomMetaId:{myhomeUgcInfo.RoomType}";
|
||||
result.setFail(ServerErrorCode.EditableRoomMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var crafter_count = 0;
|
||||
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isCrafterProp())
|
||||
continue;
|
||||
|
||||
++crafter_count;
|
||||
}
|
||||
|
||||
if (crafter_count > editable_room_meta_data.MaxCrafterCount)
|
||||
{
|
||||
err_msg = $"Myhome Crafter Count Exceed !!! Count:{crafter_count} > Allow:{editable_room_meta_data.MaxCrafterCount}";
|
||||
result.setFail(ServerErrorCode.CrafterCountExceed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result checkMyhomeUgcNpc(MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var ugc_npc_guids = new HashSet<String>();
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isNpcProp())
|
||||
continue;
|
||||
|
||||
var ugc_npc_guid = anchorInfo.EntityGuid;
|
||||
|
||||
if (!ugc_npc_guids.Add(ugc_npc_guid))
|
||||
{
|
||||
err_msg = $"Ugc Npc Duplicate In Myhome Ugc !!! : ugcNpcGuid:{ugc_npc_guid}";
|
||||
result.setFail(ServerErrorCode.UgcNpcDuplicateInMyhomeUgc, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static (Dictionary<string, int>? userToMyhome, Dictionary<string, int>? myhomeToUser) getModifyInteriorItems(MyhomeUgcInfo oldMyhomeUgcInfo, MyhomeUgcInfo newMyhomeUgcInfo)
|
||||
{
|
||||
var old_interior_items = oldMyhomeUgcInfo.getMyhomeInteriorItems();
|
||||
var new_interior_items = newMyhomeUgcInfo.getMyhomeInteriorItems();
|
||||
|
||||
var user_to_myhome_items = new Dictionary<string, int>();
|
||||
foreach (var (item_guid, new_count) in new_interior_items)
|
||||
{
|
||||
old_interior_items.TryGetValue(item_guid, out var old_count);
|
||||
|
||||
var diff_count = new_count - old_count;
|
||||
if (diff_count > 0)
|
||||
{
|
||||
user_to_myhome_items[item_guid] = diff_count;
|
||||
}
|
||||
}
|
||||
|
||||
var myhome_to_user_items = new Dictionary<string, int>();
|
||||
foreach (var (item_guid, old_count) in old_interior_items)
|
||||
{
|
||||
new_interior_items.TryGetValue(item_guid, out var new_count);
|
||||
|
||||
var diff_count = old_count - new_count;
|
||||
if (diff_count > 0)
|
||||
{
|
||||
myhome_to_user_items[item_guid] = diff_count;
|
||||
}
|
||||
}
|
||||
|
||||
return (user_to_myhome_items, myhome_to_user_items);
|
||||
}
|
||||
|
||||
public static Dictionary<string, int> getMyhomeInteriorItems(this MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var items = new Dictionary<string, int>();
|
||||
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isProp())
|
||||
continue;
|
||||
|
||||
items.TryGetValue(anchorInfo.EntityGuid, out var count);
|
||||
items[anchorInfo.EntityGuid] = count + 1;
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public static (List<UgcAnchorInfo> addInfos, List<UgcAnchorInfo> removeInfos, List<UgcAnchorInfo> modifyInfos) getModifyUgcNpcAnchorInfos(MyhomeUgcInfo oldMyhomeUgcInfo, MyhomeUgcInfo newMyhomeUgcInfo)
|
||||
{
|
||||
var old_ugc_npc_anchor_infos = oldMyhomeUgcInfo.getUgcNpcAnchorInfos();
|
||||
var new_ugc_npc_anchor_infos = newMyhomeUgcInfo.getUgcNpcAnchorInfos();
|
||||
|
||||
var modify_ugc_npc_anchor_infos = new List<UgcAnchorInfo>();
|
||||
var add_ugc_npc_anchor_infos = new List<UgcAnchorInfo>();
|
||||
foreach (var (new_anchor_guid, new_ugc_npc_anchor_info) in new_ugc_npc_anchor_infos)
|
||||
{
|
||||
// 엥커 비교 (존재 하지 않으면 추가됨)
|
||||
if (old_ugc_npc_anchor_infos.TryGetValue(new_anchor_guid, out var old_ugc_npc_anchor_info))
|
||||
{
|
||||
// 엥커 존재
|
||||
// NpcGuid 비교 (같지 않으면 추가됨)
|
||||
if (new_ugc_npc_anchor_info.EntityGuid == old_ugc_npc_anchor_info.EntityGuid)
|
||||
{
|
||||
// NpcGuid 동일
|
||||
// 정보 비교 (같지 않으면 변경됨)
|
||||
if (!new_ugc_npc_anchor_info.Equals(old_ugc_npc_anchor_info))
|
||||
{
|
||||
modify_ugc_npc_anchor_infos.Add(new_ugc_npc_anchor_info);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
add_ugc_npc_anchor_infos.Add(new_ugc_npc_anchor_info);
|
||||
}
|
||||
|
||||
var remove_ugc_npc_anchor_infos = new List<UgcAnchorInfo>();
|
||||
foreach (var (old_anchor_guid, old_ugc_npc_anchor_info) in old_ugc_npc_anchor_infos)
|
||||
{
|
||||
// 엥커 비교 (존재 하지 않으면 제거됨)
|
||||
if (new_ugc_npc_anchor_infos.TryGetValue(old_anchor_guid, out var new_ugc_npc_anchor_info))
|
||||
{
|
||||
// 엥커 존재
|
||||
// NpcGuid 비교 (같지 않으면 제거됨)
|
||||
if (old_ugc_npc_anchor_info.EntityGuid == new_ugc_npc_anchor_info.EntityGuid)
|
||||
continue;
|
||||
}
|
||||
|
||||
remove_ugc_npc_anchor_infos.Add(old_ugc_npc_anchor_info);
|
||||
}
|
||||
|
||||
return (add_ugc_npc_anchor_infos, remove_ugc_npc_anchor_infos, modify_ugc_npc_anchor_infos);
|
||||
}
|
||||
|
||||
public static Dictionary<string, UgcAnchorInfo> getUgcNpcAnchorInfos(this MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var ugc_npc_anchor_infos = new Dictionary<string, UgcAnchorInfo>();
|
||||
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isNpcProp())
|
||||
continue;
|
||||
|
||||
ugc_npc_anchor_infos.TryAdd(anchorInfo.AnchorGuid, anchorInfo);
|
||||
}
|
||||
|
||||
return ugc_npc_anchor_infos;
|
||||
}
|
||||
|
||||
public static (List<string> addGuids, List<string> removeGuids) getModifyCrafterAnchorGuids(MyhomeUgcInfo oldMyhomeUgcInfo, MyhomeUgcInfo newMyhomeUgcInfo)
|
||||
{
|
||||
var old_crafter_anchor_infos = oldMyhomeUgcInfo.getCrafterAnchorInfos();
|
||||
var new_crafting_anchor_infos = newMyhomeUgcInfo.getCrafterAnchorInfos();
|
||||
|
||||
var add_crafter_anchor_guids = new List<string>();
|
||||
foreach (var (anchor_guid, anchor_info) in new_crafting_anchor_infos)
|
||||
{
|
||||
if (old_crafter_anchor_infos.TryGetValue(anchor_guid, out _))
|
||||
continue;
|
||||
|
||||
add_crafter_anchor_guids.Add(anchor_guid);
|
||||
}
|
||||
|
||||
var remove_crafting_anchor_guids = new List<string>();
|
||||
foreach (var (anchor_guid, anchor_info) in old_crafter_anchor_infos)
|
||||
{
|
||||
if (new_crafting_anchor_infos.TryGetValue(anchor_guid, out _))
|
||||
continue;
|
||||
|
||||
remove_crafting_anchor_guids.Add(anchor_guid);
|
||||
}
|
||||
|
||||
return (add_crafter_anchor_guids, remove_crafting_anchor_guids);
|
||||
}
|
||||
|
||||
public static Dictionary<string, UgcAnchorInfo> getCrafterAnchorInfos(this MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var crafter_anchor_infos = new Dictionary<string, UgcAnchorInfo>();
|
||||
|
||||
foreach (var anchorInfo in myhomeUgcInfo.AnchorInfos)
|
||||
{
|
||||
if (!anchorInfo.isCrafterProp())
|
||||
continue;
|
||||
|
||||
crafter_anchor_infos.TryAdd(anchorInfo.AnchorGuid, anchorInfo);
|
||||
}
|
||||
|
||||
return crafter_anchor_infos;
|
||||
}
|
||||
|
||||
public static Position getMyhomeStartPosAnchorPosition(this MyhomeUgcInfo myhomeUgcInfo)
|
||||
{
|
||||
var startPos = new Position();
|
||||
|
||||
foreach (var frameworkInfo in myhomeUgcInfo.FrameworkInfos)
|
||||
{
|
||||
if (frameworkInfo.InteriorItemId != MetaHelper.GameConfigMeta.MyhomeStartPoint)
|
||||
continue;
|
||||
|
||||
startPos.X = frameworkInfo.Coordinate.X;
|
||||
startPos.Y = frameworkInfo.Coordinate.Y;
|
||||
startPos.Z = frameworkInfo.Coordinate.Z;
|
||||
}
|
||||
|
||||
return startPos;
|
||||
}
|
||||
|
||||
public static MyHomeInfo toMyhomeInfo(this MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
var myhome_info = new MyHomeInfo();
|
||||
|
||||
myhome_info.MyhomeGuid = myhomeAttribute.MyhomeGuid;
|
||||
myhome_info.MyhomeName = myhomeAttribute.MyhomeName;
|
||||
myhome_info.MyhomeUgcInfo = myhomeAttribute.UgcInfo;
|
||||
|
||||
return myhome_info;
|
||||
}
|
||||
|
||||
public static string makeMyhomeUgcInfoS3FileName()
|
||||
{
|
||||
return $"{Guid.NewGuid().ToString("N")}.ugcinfo";
|
||||
}
|
||||
|
||||
public static string makeMyhomeUgcInfoS3Key(MyHomeAttrib myhomeAttrib)
|
||||
{
|
||||
return makeMyhomeUgcInfoS3Key(myhomeAttrib.MyhomeGuid, myhomeAttrib.MyhomeUgcInfoS3FileName);
|
||||
}
|
||||
|
||||
public static string makeMyhomeUgcInfoS3Key(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
return makeMyhomeUgcInfoS3Key(myhomeAttribute.MyhomeGuid, myhomeAttribute.MyhomeUgcInfoS3FileName);
|
||||
}
|
||||
|
||||
public static string makeMyhomeUgcInfoS3Key(string myhomeGuid, string myhomeUgcInfoS3FileName)
|
||||
{
|
||||
return $"{myhomeGuid}/{myhomeUgcInfoS3FileName}";
|
||||
}
|
||||
|
||||
public static async Task<(Result, MyhomeUgcInfo?)> getMyhomeUgcInfo(MyHomeAttrib myhomeAttrib)
|
||||
{
|
||||
return await getMyhomeUgcInfo(myhomeAttrib.MyhomeGuid, myhomeAttrib.MyhomeUgcInfoS3FileName);
|
||||
}
|
||||
|
||||
public static async Task<(Result, MyhomeUgcInfo?)> getMyhomeUgcInfo(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
return await getMyhomeUgcInfo(myhomeAttribute.MyhomeGuid, myhomeAttribute.MyhomeUgcInfoS3FileName);
|
||||
}
|
||||
|
||||
public static async Task<(Result, MyhomeUgcInfo?)> getMyhomeUgcInfo(string myhomeGuid, string myhomeUgcInfoS3FileName)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var myhome_ugc_info_json = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var bucket_name = server_logic.getServerConfig().AWS.S3.MyhomeUgcInfoBucketName;
|
||||
|
||||
if (server_logic.getServerConfig().OfflineMode)
|
||||
{
|
||||
var file_path = $"./S3/{bucket_name}/{myhomeGuid}/{myhomeUgcInfoS3FileName}";
|
||||
|
||||
myhome_ugc_info_json = File.ReadAllText(file_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
var myhome_ugc_info_s3_key = makeMyhomeUgcInfoS3Key(myhomeGuid, myhomeUgcInfoS3FileName);
|
||||
|
||||
var s3_client = server_logic.getS3Connector();
|
||||
(result, myhome_ugc_info_json) = await s3_client.getMyhomeUgcInfo(bucket_name, myhome_ugc_info_s3_key);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to getMyhomeUgcInfo() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
}
|
||||
|
||||
var myhome_ugc_info = JsonConvert.DeserializeObject<MyhomeUgcInfo>(myhome_ugc_info_json);
|
||||
if (myhome_ugc_info == null)
|
||||
{
|
||||
err_msg = $"Failed to JsonConvert.DeserializeObject<MyhomeUgcInfo>() !!!";
|
||||
result.setFail(ServerErrorCode.JsonConvertDeserializeFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, myhome_ugc_info);
|
||||
}
|
||||
|
||||
public static async Task<Result> uploadMyhomeUgcInfo(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
return await uploadMyhomeUgcInfo(myhomeAttribute.MyhomeGuid, myhomeAttribute.MyhomeUgcInfoS3FileName, myhomeAttribute.UgcInfo.toJson());
|
||||
}
|
||||
|
||||
public static async Task<Result> uploadMyhomeUgcInfo(string myhomeGuid, string myhomeUgcInfoS3FileName, string myhomeUgcInfo)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var bucket_name = server_logic.getServerConfig().AWS.S3.MyhomeUgcInfoBucketName;
|
||||
|
||||
if (server_logic.getServerConfig().OfflineMode)
|
||||
{
|
||||
var folder_path = $"./S3/{bucket_name}/{myhomeGuid}";
|
||||
var file_path = $"./S3/{bucket_name}/{myhomeGuid}/{myhomeUgcInfoS3FileName}";
|
||||
|
||||
if (!Directory.Exists(folder_path))
|
||||
{
|
||||
Directory.CreateDirectory(folder_path);
|
||||
}
|
||||
|
||||
File.WriteAllText(file_path, myhomeUgcInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
var myhome_ugc_info_s3_key = makeMyhomeUgcInfoS3Key(myhomeGuid, myhomeUgcInfoS3FileName);
|
||||
ArgumentNullException.ThrowIfNull(myhome_ugc_info_s3_key, $"myhome_ugc_info_s3_key is null !!!");
|
||||
|
||||
var s3_client = server_logic.getS3Connector();
|
||||
result = await s3_client.uploadMyhomeUgcInfo(bucket_name, myhome_ugc_info_s3_key, myhomeUgcInfo);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Fail to uploadMyhomeUgcInfo() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<Result> deleteMyhomeUgcInfo(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
return await deleteMyhomeUgcInfo(myhomeAttribute.MyhomeGuid, myhomeAttribute.MyhomeUgcInfoS3FileName);
|
||||
}
|
||||
|
||||
public static async Task<Result> deleteMyhomeUgcInfo(string myhomeGuid, string myhomeUgcInfoS3FileName)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var bucket_name = server_logic.getServerConfig().AWS.S3.MyhomeUgcInfoBucketName;
|
||||
|
||||
if (server_logic.getServerConfig().OfflineMode)
|
||||
{
|
||||
var file_path = $"./S3/{bucket_name}/{myhomeGuid}/{myhomeUgcInfoS3FileName}";
|
||||
|
||||
File.Delete(file_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
var myhome_ugc_info_s3_key = makeMyhomeUgcInfoS3Key(myhomeGuid, myhomeUgcInfoS3FileName);
|
||||
ArgumentNullException.ThrowIfNull(myhome_ugc_info_s3_key, $"myhome_ugc_info_s3_key is null !!!");
|
||||
|
||||
var s3_client = server_logic.getS3Connector();
|
||||
result = await s3_client.deleteMyhomeUgcInfo(bucket_name, myhome_ugc_info_s3_key);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Fail to deleteMyhomeUgcInfo() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<Result> deleteMyhomeUgcInfoFolderFile(MyhomeAttribute myhomeAttribute)
|
||||
{
|
||||
return await deleteMyhomeUgcInfoFolderFile(myhomeAttribute.MyhomeGuid);
|
||||
}
|
||||
|
||||
public static async Task<Result> deleteMyhomeUgcInfoFolderFile(string myhomeGuid)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var bucket_name = server_logic.getServerConfig().AWS.S3.MyhomeUgcInfoBucketName;
|
||||
|
||||
if (server_logic.getServerConfig().OfflineMode)
|
||||
{
|
||||
var folder_path = $"./S3/{bucket_name}/{myhomeGuid}";
|
||||
|
||||
Directory.Delete(folder_path, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var s3_client = server_logic.getS3Connector();
|
||||
result = await s3_client.deleteMyhomeUgcInfoFolderFile(bucket_name, myhomeGuid);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Fail to deleteMyhomeUgcInfoFolderFile() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<Result> checkMyhomeIsEditting(string myhomeGuid, string myhomeOwnerGuid)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
ArgumentNullException.ThrowIfNull(server_logic, $"server_logic is null !!!");
|
||||
|
||||
var instance_room_storage = new InstanceRoomStorage();
|
||||
instance_room_storage.Init(server_logic.getRedisDb(), "");
|
||||
|
||||
var edit_room_instance_room_id_base = InstanceRoomHandler.makeEditRoomInstanceRoomIdBase(myhomeOwnerGuid);
|
||||
var edit_room_instance_room_id = await InstanceRoomHandler.makeInstanceRoomId(edit_room_instance_room_id_base, 0);
|
||||
|
||||
var edit_room_instance_room_info = await instance_room_storage.GetInstanceRoomInfo(edit_room_instance_room_id);
|
||||
if (edit_room_instance_room_info != null)
|
||||
{
|
||||
if (edit_room_instance_room_info.MyhomeGuid == myhomeGuid)
|
||||
{
|
||||
err_msg = $"Myhome is Editting !!! : myhomeGuid:{myhomeGuid}";
|
||||
result.setFail(ServerErrorCode.MyhomeIsEditting, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result getMyhomeInstanceId(int editableRoomId, out int instanceId)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
instanceId = 0;
|
||||
|
||||
if (!MetaData.Instance._EditableRoomMetaTable.TryGetValue(editableRoomId, out var editable_room_meta_data))
|
||||
{
|
||||
err_msg = $"Failed to MetaData.TryGetValue() !!! : editableRoomMetaId:{editableRoomId}";
|
||||
result.setFail(ServerErrorCode.EditableRoomMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
switch(editable_room_meta_data.SizeType)
|
||||
{
|
||||
case MetaAssets.SizeType.SMALL:
|
||||
{
|
||||
instanceId = MetaHelper.GameConfigMeta.SmallTypeMyhome;
|
||||
}
|
||||
break;
|
||||
case MetaAssets.SizeType.MEDIUM:
|
||||
{
|
||||
instanceId = MetaHelper.GameConfigMeta.MediumTypeMyhome;
|
||||
}
|
||||
break;
|
||||
case MetaAssets.SizeType.LARGE:
|
||||
{
|
||||
instanceId = MetaHelper.GameConfigMeta.LargeTypeMyhome;
|
||||
}
|
||||
break;
|
||||
case MetaAssets.SizeType.GIANT:
|
||||
{
|
||||
instanceId = MetaHelper.GameConfigMeta.GiantTypeMyhome;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
err_msg = $"SizeType invalid !!! : {editable_room_meta_data.SizeType.ToString()}";
|
||||
result.setFail(ServerErrorCode.EditableRoomSizeTypeInvalid, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
149
GameServer/Contents/MyHome/Helper/MyhomeNotifyHelper.cs
Normal file
149
GameServer/Contents/MyHome/Helper/MyhomeNotifyHelper.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using ServerCommon;
|
||||
using ServerCore; using ServerBase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static ClientToGameMessage.Types;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
internal static class MyhomeNotifyHelper
|
||||
{
|
||||
public static bool send_S2C_MYHOME_INFO_NOTI(this Player player)
|
||||
{
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.MyHomeInfoNoti = new MyHomeInfoNoti();
|
||||
|
||||
var myhome_agent_action = player.getEntityAction<MyhomeAgentAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(myhome_agent_action, () => $"myhome_agent_action is null !!!");
|
||||
|
||||
if (myhome_agent_action.tryGetSelectedMyhome(out var select_myhome))
|
||||
{
|
||||
var myhome_attribute = select_myhome.getEntityAttribute<MyhomeAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(myhome_attribute, () => $"myhome_attribute is null !!!");
|
||||
|
||||
ntf_packet.Message.MyHomeInfoNoti.SelectedMyhomeGuid = myhome_attribute.MyhomeGuid;
|
||||
}
|
||||
|
||||
var user_contents_setting_attribute = player.getEntityAttribute<UserContentsSettingAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(user_contents_setting_attribute, () => $"user_contents_setting_attribute is null !!!");
|
||||
|
||||
ntf_packet.Message.MyHomeInfoNoti.OpenSlotCount = user_contents_setting_attribute.MyhomeSlotOpenCount;
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool send_S2C_NTF_MYHOME_INFO(this Player player)
|
||||
{
|
||||
var myhome_agent_action = player.getEntityAction<MyhomeAgentAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(myhome_agent_action, () => $"myhome_agent_action is null !!!");
|
||||
|
||||
var myhomes = myhome_agent_action.getMyHomes();
|
||||
foreach (var myhome in myhomes)
|
||||
{
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.NtfMyhomeInfo = new GS2C_NTF_MYHOME_INFO();
|
||||
|
||||
var myhome_action = myhome.getEntityAction<MyhomeAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(myhome_action, () => $"myhome_action is null !!!");
|
||||
|
||||
var myhome_info = myhome_action.toMyHomeInfo();
|
||||
ntf_packet.Message.NtfMyhomeInfo.MyhomeInfo = myhome_info;
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static ClientToGame makeNtfMyHomeAddPacket(int myhome_meta_id)
|
||||
{
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.MyHomeAddNoti = new MyHomeAddNoti();
|
||||
|
||||
ntf_packet.Message.MyHomeAddNoti.MyHomeId = myhome_meta_id;
|
||||
|
||||
return ntf_packet;
|
||||
}
|
||||
|
||||
public static bool send_S2C_NTF_MYHOME_UGC_INFO(Player player, MyHomeInfo myhomeInfo)
|
||||
{
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.NtfMyhomeUgcInfo = new GS2C_NTF_MYHOME_UGC_INFO();
|
||||
ntf_packet.Message.NtfMyhomeUgcInfo.MyhomeGuid = myhomeInfo.MyhomeGuid;
|
||||
ntf_packet.Message.NtfMyhomeUgcInfo.MyhomeUgcInfo = myhomeInfo.MyhomeUgcInfo;
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool send_GS2GS_NTF_EXCHANGE_MYHOME(string destServer, string roomId, string myhomeGuid, MyHomeInfo myhomeInfo)
|
||||
{
|
||||
var message = new ServerMessage();
|
||||
message.NtfExchangeMyhome = new();
|
||||
message.NtfExchangeMyhome.RoomId = roomId;
|
||||
message.NtfExchangeMyhome.MyhomeGuid = myhomeGuid;
|
||||
message.NtfExchangeMyhome.MyhomeInfo = myhomeInfo;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var rabbit_mq = server_logic.getRabbitMqConnector() as RabbitMQ4Game;
|
||||
ArgumentNullException.ThrowIfNull(rabbit_mq);
|
||||
|
||||
rabbit_mq.SendMessage(destServer, message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool send_GS2C_NTF_MYHOME_HOST_ENTER_EDIT_ROOM(Player player)
|
||||
{
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new ClientToGameMessage();
|
||||
ntf_packet.Message.NtfMyhomeHostEnterEditRoom = new GS2C_NTF_MYHOME_HOST_ENTER_EDIT_ROOM();
|
||||
|
||||
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool send_GS2GS_NTF_MYHOME_HOST_ENTER_EDIT_ROOM(string destServer, string roomId, string exceptUserGuid)
|
||||
{
|
||||
var message = new ServerMessage();
|
||||
message.NtfMyhomeHostEnterEditRoom = new();
|
||||
message.NtfMyhomeHostEnterEditRoom.RoomId = roomId;
|
||||
message.NtfMyhomeHostEnterEditRoom.ExceptUserGuid = exceptUserGuid;
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var rabbit_mq = server_logic.getRabbitMqConnector() as RabbitMQ4Game;
|
||||
ArgumentNullException.ThrowIfNull(rabbit_mq);
|
||||
|
||||
rabbit_mq.SendMessage(destServer, message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user