초기커밋
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using META_ID = System.UInt32;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using META_TYPE = System.String;
|
||||
|
||||
|
||||
namespace ServerCommon.BusinessLogDomain;
|
||||
|
||||
public static class CharacterBusinessLogHelper
|
||||
{
|
||||
public static async Task<(Result, CharacterLogInfo?)> toCharacterLogInfo(this CharacterAttribute characterAttribute)
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
(result, var character_base_doc) = await characterAttribute.toDocBase(false);
|
||||
NullReferenceCheckHelper.throwIfNull(character_base_doc, () => $"character_base_doc is null !!!");
|
||||
if (result.isFail())
|
||||
{
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var character_base_attrib = character_base_doc.getAttrib<CharacterBaseAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(character_base_attrib, () => $"character_base_attrib is null !!!");
|
||||
|
||||
var character_log_info = new CharacterLogInfo();
|
||||
character_log_info.setLogProperty( character_base_attrib.CharacterGuid
|
||||
, character_base_doc.getPK(), character_base_doc.getSK()
|
||||
, character_base_attrib.ApperanceProfileValue.CustomValues
|
||||
);
|
||||
|
||||
return await Task.FromResult((result, character_log_info));
|
||||
}
|
||||
}
|
||||
84
ServerCommon/BusinessLog/LogHelper/ItemBusinessLogHelper.cs
Normal file
84
ServerCommon/BusinessLog/LogHelper/ItemBusinessLogHelper.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Amazon.S3.Model;
|
||||
using ServerControlCenter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
|
||||
|
||||
|
||||
namespace ServerCommon.BusinessLogDomain
|
||||
{
|
||||
public static class ItemBusinessLogHelper
|
||||
{
|
||||
public static (Result, ItemLogInfo?) toItemLogInfo( this ItemAttributeBase itemAttributeBase )
|
||||
{
|
||||
var try_pending_item_doc = itemAttributeBase.getTryPendingDocBase() as ItemDoc;
|
||||
NullReferenceCheckHelper.throwIfNull(try_pending_item_doc, () => $"try_pending_item_doc is null !!!");
|
||||
var item_attrib = try_pending_item_doc.getAttrib<ItemAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(item_attrib, () => $"item_attrib is null !!! : {itemAttributeBase.toBasicString()}");
|
||||
|
||||
var result = new Result();
|
||||
|
||||
var item_meta_id = (int)itemAttributeBase.ItemMetaId;
|
||||
if (false == MetaData.Instance._ItemTable.TryGetValue(item_meta_id, out var found_item_meta_data))
|
||||
{
|
||||
var err_msg = $"Failed to TryGetValue() !!! : itemMetaId:{item_meta_id} - {itemAttributeBase.toBasicString()}";
|
||||
result.setFail(ServerErrorCode.ItemMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var log_item_info = new ItemLogInfo();
|
||||
log_item_info.setLogProperty( item_attrib.ItemGuid
|
||||
, try_pending_item_doc.getPK(), try_pending_item_doc.getSK()
|
||||
, item_attrib.OwnerEntityType, item_attrib.OwnerGuid
|
||||
, CountDeltaType.None, item_attrib.ItemStackCount, 0
|
||||
, item_attrib.ItemMetaId, found_item_meta_data.Name
|
||||
, item_attrib.Level, 0
|
||||
, found_item_meta_data.TypeLarge, found_item_meta_data.TypeSmall
|
||||
, itemAttributeBase.Attributes.Select(x => (int)x).ToList(), new List<int>() );
|
||||
|
||||
return (result, log_item_info);
|
||||
}
|
||||
|
||||
public static async Task<(Result, ItemLogInfo?)> toItemLogInfo4Create( this ItemDoc itemDoc )
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
var item_attrib = itemDoc.getAttrib<ItemAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(item_attrib, () => $"item_attrib is null !!!");
|
||||
|
||||
var item_meta_id = (int)item_attrib.ItemMetaId;
|
||||
if (false == MetaData.Instance._ItemTable.TryGetValue(item_meta_id, out var found_item_meta_data))
|
||||
{
|
||||
var err_msg = $"Failed to TryGetValue() !!! : itemMetaId:{item_meta_id} - {item_attrib.toBasicString()}";
|
||||
result.setFail(ServerErrorCode.ItemMetaDataNotFound, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var delta_stack_count = item_attrib.ItemStackCount;
|
||||
var delta_level = item_attrib.Level;
|
||||
|
||||
var log_item_info = new ItemLogInfo();
|
||||
log_item_info.setLogProperty( item_attrib.ItemGuid
|
||||
, itemDoc.getPK(), itemDoc.getSK()
|
||||
, item_attrib.OwnerEntityType, item_attrib.OwnerGuid
|
||||
, CountDeltaType.Acquire, item_attrib.ItemStackCount, delta_stack_count
|
||||
, item_attrib.ItemMetaId, found_item_meta_data.Name
|
||||
, item_attrib.Level, delta_level
|
||||
, found_item_meta_data.TypeLarge, found_item_meta_data.TypeSmall
|
||||
, item_attrib.Attributes.Select(x => (int)x).ToList(), new List<int>() );
|
||||
|
||||
return await Task.FromResult((result, log_item_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user