127 lines
3.9 KiB
C#
127 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using ServerCore; using ServerBase;
|
|
|
|
|
|
using SESSION_ID = System.Int32;
|
|
using WORLD_ID = System.UInt32;
|
|
using META_ID = System.UInt32;
|
|
using ENTITY_GUID = System.String;
|
|
using ACCOUNT_ID = System.String;
|
|
using OWNER_GUID = System.String;
|
|
using USER_GUID = System.String;
|
|
using CHARACTER_GUID = System.String;
|
|
using ITEM_GUID = System.String;
|
|
using ENTITY_UNIQUE_ID = System.String;
|
|
using ANCHOR_META_GUID = System.String;
|
|
using NPC_UNIQUE_ID = System.String;
|
|
using FARMING_ENTITY_GUID = System.String;
|
|
using LOCATION_UNIQUE_ID = System.String;
|
|
using FARMING_EFFECT_DOC_LINK_PKSK = System.String;
|
|
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class FarmingEffectOwnerAttrib : AttribBase
|
|
{
|
|
[JsonProperty("owner_entity_type")]
|
|
public OwnerEntityType OwnerEntityType { get; set; } = OwnerEntityType.None;
|
|
|
|
[JsonProperty("owner_guid")]
|
|
public OWNER_GUID OwnerGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("farming_effect_doc_link_pk_sk")]
|
|
public FARMING_EFFECT_DOC_LINK_PKSK FarmingEffectDocLinkPKSK { get; set; } = string.Empty;
|
|
|
|
|
|
public FarmingEffectOwnerAttrib()
|
|
: base(typeof(FarmingEffectOwnerAttrib).Name, false)
|
|
{ }
|
|
}
|
|
|
|
//=============================================================================================
|
|
// Primary Key
|
|
// PK(Partition Key) : "farming_effect_owner#owner_guid" [owner_guid: user_guid, npc_ugc_meta_guid]
|
|
// SK(Sort Key) : "FARMING_EFFECT_DOC_LINK_PKSK"
|
|
// DocType : "FarmingEffectOwnerDoc"
|
|
// FarmingAttrib : {}
|
|
// ...
|
|
//=============================================================================================
|
|
|
|
public class FarmingEffectOwnerDoc : DynamoDbDocBase
|
|
{
|
|
private static string getDocTypeName() { return typeof(FarmingEffectOwnerDoc).Name; }
|
|
private string getPrefixOfPK() { return $"farming_effect_owner#"; }
|
|
private string getPrefixOfSK() { return $""; }
|
|
|
|
public FarmingEffectOwnerDoc()
|
|
: base(getDocTypeName())
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public FarmingEffectOwnerDoc(OWNER_GUID ownerGuid, FARMING_EFFECT_DOC_LINK_PKSK farmingEffectDocLinkPKSK)
|
|
: base(getDocTypeName())
|
|
{
|
|
setCombinationKeyForPK(ownerGuid);
|
|
setCombinationKeyForSK(farmingEffectDocLinkPKSK);
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
}
|
|
|
|
public FarmingEffectOwnerDoc( OwnerEntityType ownerEntityType, OWNER_GUID ownerGuid
|
|
, FARMING_EFFECT_DOC_LINK_PKSK farmingEffectDocLinkPKSK )
|
|
: base(getDocTypeName())
|
|
{
|
|
setCombinationKeyForPK(ownerGuid);
|
|
setCombinationKeyForSK(farmingEffectDocLinkPKSK);
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
|
|
var to_set_farming_effect_owner_attrib = getAttrib<FarmingEffectOwnerAttrib>();
|
|
NullReferenceCheckHelper.throwIfNull(to_set_farming_effect_owner_attrib, () => $"to_set_farming_effect_owner_attrib is null !!!");
|
|
|
|
to_set_farming_effect_owner_attrib.OwnerEntityType = ownerEntityType;
|
|
to_set_farming_effect_owner_attrib.OwnerGuid = ownerGuid;
|
|
to_set_farming_effect_owner_attrib.FarmingEffectDocLinkPKSK = farmingEffectDocLinkPKSK;
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<FarmingEffectOwnerAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK()
|
|
{
|
|
return getPrefixOfPK();
|
|
}
|
|
|
|
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
|
{
|
|
var error_code = onFillupCombinationKeyForSK(sortKey, out var fillup_key);
|
|
if (error_code.isFail())
|
|
{
|
|
return error_code;
|
|
}
|
|
|
|
getPrimaryKey().fillUpSK(sortKey);
|
|
setCombinationKeyForSK(fillup_key);
|
|
|
|
return ServerErrorCode.Success;
|
|
}
|
|
}
|