초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using USER_GUID = System.String;
namespace ServerCommon;
public class CaliumAttrib : AttribBase
{
[JsonProperty("daily_calium")]
[JsonConverter(typeof(StringToDoubleEpsilonRoundConverter))]
public double DailyCalium { get; set; } = 0.0;
[JsonProperty("provided_date")]
public DateTime ProvidedDate { get; set; } = DateTimeHelper.MinTime;
public CaliumAttrib() : base(nameof(CaliumAttrib), false) {}
}
//=============================================================================================
// PK(Partition Key) : "calium#user_guid"
// SK(Sort Key) : ""
// DocType : CaliumDoc
// CaliumAttrib : {}
// ...
//=============================================================================================
public class CaliumDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "calium#"; }
private static string getPrefixOfSK() { return ""; }
public CaliumDoc() : base(nameof(CaliumDoc))
{
appendAttribWrapperAll();
}
public CaliumDoc(USER_GUID userGuid) : base(nameof(CaliumDoc))
{
setCombinationKeyForPK(userGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<CaliumAttrib>());
}
}

View File

@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ServerCore; using ServerBase;
using SESSION_ID = System.Int32;
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;
namespace ServerCommon
{
public class CharacterBaseAttrib : AttribBase
{
public class AppearanceProfile
{
[JsonProperty("basic_style")]
public UInt32 BasicStyle { get; set; } = 0;
[JsonProperty("body_shape")]
public UInt32 BodyShape { get; set; } = 0;
[JsonProperty("hair_style")]
public UInt32 HairStyle { get; set; } = 0;
[JsonProperty("custom_values")]
public List<int> CustomValues { get; set; } = new();
[JsonProperty("is_custom_completed")]
public bool IsCustomCompleted { get; set; } = false;
public void reset()
{
BasicStyle = 0;
BodyShape = 0;
HairStyle = 0;
CustomValues.Clear();
IsCustomCompleted = false;
}
public object Clone()
{
var clone = new AppearanceProfile();
clone.BasicStyle = BasicStyle;
clone.BodyShape = BodyShape;
clone.HairStyle = HairStyle;
clone.CustomValues = CustomValues.Select(x => x).ToList();
clone.IsCustomCompleted = IsCustomCompleted;
return clone;
}
public void copyFromAppearanceProfile(CharacterAttribute.AppearanceProfile attribute)
{
BasicStyle = attribute.BasicStyle;
BodyShape = attribute.BodyShape;
HairStyle = attribute.HairStyle;
CustomValues = attribute.CustomValues.Select(x => x).ToList();
IsCustomCompleted = attribute.IsCustomCompleted;
}
}
[JsonProperty("character_guid")]
public CHARACTER_GUID CharacterGuid { get; set; } = string.Empty;
[JsonProperty("user_guid")]
public USER_GUID UserGuid { get; set; } = string.Empty;
[JsonProperty("state_info")]
public EntityStateInfo StateInfo { get; set; } = new EntityStateInfo();
[JsonProperty("appearance_profile")]
public AppearanceProfile ApperanceProfileValue { get; set; } = new();
public CharacterBaseAttrib()
: base(typeof(CharacterBaseAttrib).Name)
{ }
}
//=============================================================================================
// Primary Key
// PK(Partition Key) : "character_base#user_guid"
// SK(Sort Key) : "character_guid"
// CharacterBaseAttrib :
// ...
//=============================================================================================
public class CharacterBaseDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "character_base#"; }
private static string getPrefixOfSK() { return ""; }
public CharacterBaseDoc()
: base(typeof(CharacterBaseDoc).Name)
{
appendAttribWrapperAll();
}
public CharacterBaseDoc(USER_GUID userGuid, CHARACTER_GUID characterGuid)
: base(typeof(CharacterBaseDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(characterGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<CharacterBaseAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}
}

View File

@@ -0,0 +1,81 @@
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 OWNER_GUID = System.String;
namespace ServerCommon;
public class ItemFirstPurchaseHistoryAttrib : AttribBase
{
[JsonProperty("item_meta_id")]
public META_ID ItemMetaId { get; set; } = 0;
[JsonProperty("first_purchase_time")]
public DateTime FirstPurchaseTime { get; set; } = new();
public ItemFirstPurchaseHistoryAttrib()
: base(typeof(ItemFirstPurchaseHistoryAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "item_first_purchase_history#user_guid"
// SK(Sort Key) : "item_meta_id"
// DocType : ItemFirstPurchaseHistoryDoc
// ItemFirstPurchaseHistoryAttrib : {}
// ...
//=============================================================================================
public class ItemFirstPurchaseHistoryDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "item_first_purchase_history#"; }
private static string getPrefixOfSK() { return ""; }
public ItemFirstPurchaseHistoryDoc()
: base(typeof(ItemFirstPurchaseHistoryDoc).Name)
{
appendAttribWrapperAll();
}
public ItemFirstPurchaseHistoryDoc(string userGuid, META_ID socialActionMetaId)
: base(typeof(ItemFirstPurchaseHistoryDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(socialActionMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<ItemFirstPurchaseHistoryAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using Newtonsoft.Json;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.Model;
using Amazon.DynamoDBv2.DocumentModel;
using Google.Protobuf.WellKnownTypes;
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;
namespace ServerCommon;
public class LandAuctionRefundBidPriceAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public META_ID LandMetaId { get; set; } = 0;
[JsonProperty("auction_number")]
public Int32 AuctionNumber { get; set; } = 0;
[JsonProperty("bid_user_guid")]
public USER_GUID BidUserGuid { get; set; } = string.Empty;
[JsonProperty("last_bid_type")]
public LandAuctionBidType LastBidType { get; set; } = LandAuctionBidType.None; // 마지막 입찰의 종류
[JsonProperty("bid_currency_type")]
public CurrencyType BidCurrencyType { get; set; } = CurrencyType.None;
[JsonProperty("last_bid_price")]
public double LastBidPrice { get; set; } = 0; // 마지막 입찰금
[JsonProperty("refundable_normal_bid_price")]
public double RefundableNormalBidPrice { get; set; } = 0; // 본인의 일반 환급 가능한 입찰금
[JsonProperty("refundable_blind_bid_price")]
public double RefundableBlindBidPrice { get; set; } = 0; // 본인의 블라인드 환급 가능한 입찰금
public LandAuctionRefundBidPriceAttrib()
: base(typeof(LandAuctionRefundBidPriceAttrib).Name, false)
{ }
}
//=============================================================================================
// Desc : 랜드 경매별 환급 입찰 비용
// Primary Key
// PK(Partition Key) : "land_auction_refund_bid_price#{user_guid}"
// SK(Sort Key) : "{land_meta_id}#{auction_number}"
// UserBaseAttrib : {}
// ...
//=============================================================================================
public class LandAuctionRefundBidPriceDoc : DynamoDbDocBase, ICopyDocFromEntityAttribute
{
private static string getPrefixOfPK() { return "land_auction_refund_bid_price#"; }
private static string getPrefixOfSK() { return ""; }
public LandAuctionRefundBidPriceDoc()
: base(typeof(LandAuctionRefundBidPriceDoc).Name)
{
appendAttribWrapperAll();
}
public LandAuctionRefundBidPriceDoc( USER_GUID bidUserGuid, META_ID landMetaId, Int32 auctionNumber )
: base(typeof(LandAuctionRefundBidPriceDoc).Name)
{
setCombinationKeyForPK(bidUserGuid);
setCombinationKeyForSK(makeCombinationKeyForSK(landMetaId, auctionNumber));
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
var refund_bid_price_attrib = getAttrib<LandAuctionRefundBidPriceAttrib>();
NullReferenceCheckHelper.throwIfNull(refund_bid_price_attrib, () => $"refund_bid_price_attrib is null !!!");
refund_bid_price_attrib.BidUserGuid = bidUserGuid;
refund_bid_price_attrib.LandMetaId = landMetaId;
refund_bid_price_attrib.AuctionNumber = auctionNumber;
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<LandAuctionRefundBidPriceAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
return ServerErrorCode.Success;
}
// override ICopyDocFromEntityAttribute
public bool copyDocFromEntityAttribute(EntityAttributeBase entityAttributeBase)
{
var refund_bid_price_attribute = entityAttributeBase as LandAuctionRefundBidPriceAttribute;
if (null == refund_bid_price_attribute)
{
return false;
}
var refund_bid_price_attrib = getAttrib<LandAuctionRefundBidPriceAttrib>();
NullReferenceCheckHelper.throwIfNull(refund_bid_price_attrib, () => $"refund_bid_price_attrib is null !!! - {toBasicString()}");
refund_bid_price_attrib.BidUserGuid = refund_bid_price_attribute.BidUserGuid;
refund_bid_price_attrib.LandMetaId = refund_bid_price_attribute.LandMetaId;
refund_bid_price_attrib.AuctionNumber = refund_bid_price_attribute.AuctionNumber;
refund_bid_price_attrib.LastBidType = refund_bid_price_attribute.LastBidType;
refund_bid_price_attrib.BidCurrencyType = refund_bid_price_attribute.BidCurrencyType;
refund_bid_price_attrib.LastBidPrice = refund_bid_price_attribute.LastBidPrice;
refund_bid_price_attrib.RefundableNormalBidPrice = refund_bid_price_attribute.RefundableNormalBidPrice;
refund_bid_price_attrib.RefundableBlindBidPrice = refund_bid_price_attribute.RefundableBlindBidPrice;
return true;
}
public static string makeCombinationKeyForSK(META_ID landMetaId, Int32 auctionNumber)
{
return $"{landMetaId}#{auctionNumber}";
}
}

View File

@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using Newtonsoft.Json;
using SESSION_ID = System.Int32;
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 ServerCore; using ServerBase;
namespace ServerCommon
{
public class BaseLoaction
{
[JsonProperty]
public Vector3 SpawnPos { get; set; } = Vector3.Zero;
[JsonProperty]
public float ForwardAngle { get; set; } = 0.0f;
}
public class ChannelServerLocation : BaseLoaction
{
[JsonProperty]
public string ServerName { get; set; } = string.Empty;
[JsonProperty]
public int WorldMetaId { get; set; } = 0;
}
public class IndunLocation : BaseLoaction
{
[JsonProperty]
public string InstanceRoomId { get; set; } = string.Empty;
[JsonProperty]
public int InstanceMetaId { get; set; } = 0;
}
public class LocationAttrib : AttribBase
{
[JsonProperty]
public ChannelServerLocation LastConnectedChannelServerLocation { get; set; } = new();
[JsonProperty]
public IndunLocation ReJoinIndunLocation { get; set; } = new();
public LocationAttrib()
: base(typeof(LocationAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "location#user_guid"
// SK(Sort Key) : ""
// DocType : LocationDoc
// LocationAttrib : {}
// ...
//=============================================================================================
public class LocationDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "location#"; }
private static string getPrefixOfSK() { return ""; }
public LocationDoc()
: base(typeof(LocationDoc).Name)
{
appendAttribWrapperAll();
}
public LocationDoc(string userGuid)
: base(typeof(LocationDoc).Name)
{
setCombinationKeyForPK(userGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<LocationAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
using OWNER_GUID = System.String;
namespace ServerCommon;
public class MinimapMarkerAttrib : AttribBase
{
[JsonProperty("world_meta_id")]
public META_ID WorldMetaId { get; set; } = 0;
[JsonProperty("marker_pos")]
public Vector3 MarkerPos { get; set; } = new();
public MinimapMarkerAttrib()
: base(typeof(MinimapMarkerAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "minimap_marker#user_guid"
// SK(Sort Key) : "world_meta_id"
// DocType : MinimapMarkerDoc
// MinimapMarkerAttrib : {}
// ...
//=============================================================================================
public class MinimapMarkerDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "minimap_marker#"; }
private static string getPrefixOfSK() { return ""; }
public MinimapMarkerDoc()
: base(typeof(MinimapMarkerDoc).Name)
{
appendAttribWrapperAll();
}
public MinimapMarkerDoc(string userGuid, META_ID worldMetaId)
: base(typeof(MinimapMarkerDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(worldMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<MinimapMarkerAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}

View File

@@ -0,0 +1,83 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServerCore; using ServerBase;
using META_ID = System.UInt32;
using OWNER_GUID = System.String;
namespace ServerCommon
{
public class MyHomeAttrib : AttribBase
{
[JsonProperty("myhome_guid")]
public string MyhomeGuid { get; set; } = string.Empty;
[JsonProperty("myhome_meta_id")]
public META_ID MyHomeMetaId { get; set; } = 0;
[JsonProperty("myhome_name")]
public string MyhomeName { get; set; } = string.Empty;
[JsonProperty("selected_flag")]
public UInt16 SelectedFlag { get; set; } = 0;
[JsonProperty("myhome_ugc_info_s3_key")]
public string MyhomeUgcInfoS3FileName { get; set; } = string.Empty;
public MyHomeAttrib()
: base(typeof(MyHomeAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "my_home#user_guid"
// SK(Sort Key) : "my_home_guid"
// DocType : MyHomeDoc
// MyHomeAttrib : {}
// ...
//=============================================================================================
public class MyhomeDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "my_home#"; }
private static string getPrefixOfSK() { return ""; }
public MyhomeDoc()
: base(typeof(MyhomeDoc).Name)
{
appendAttribWrapperAll();
}
public MyhomeDoc(string userGuid, string myhomeGuid)
: base(typeof(MyhomeDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(myhomeGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<MyHomeAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}
}

View File

@@ -0,0 +1,72 @@
using Newtonsoft.Json;
using ServerBase;
using META_ID = System.UInt32;
namespace ServerCommon;
public class OwnedBuildingAttrib : AttribBase
{
[JsonProperty("building_meta_id")]
public META_ID BuildingMetaId { get; set; } = 0;
[JsonProperty("owned_type")]
public OwnedType OwnedType { get; set; } = OwnedType.None;
public OwnedBuildingAttrib()
: base(typeof(OwnedBuildingAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "owned_building#user_guid"
// SK(Sort Key) : "building_meta_id"
// DocType : OwnedBuildingDoc
// OwnedBuildingAttrib : {}
// ...
//=============================================================================================
public class OwnedBuildingDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "owned_building#"; }
private static string getPrefixOfSK() { return ""; }
public OwnedBuildingDoc()
: base(typeof(OwnedBuildingDoc).Name)
{
appendAttribWrapperAll();
}
public OwnedBuildingDoc(string userGuid, META_ID buildingMetaId)
: base(typeof(OwnedBuildingDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(buildingMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<OwnedBuildingAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}

View File

@@ -0,0 +1,72 @@
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
namespace ServerCommon;
public class OwnedLandAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public META_ID LandMetaId { get; set; } = 0;
[JsonProperty("owned_type")]
public OwnedType OwnedType { get; set; } = OwnedType.None;
public OwnedLandAttrib()
: base(typeof(OwnedLandAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "owned_land#user_guid"
// SK(Sort Key) : "land_meta_id"
// DocType : OwnedLandDoc
// OwnedLandAttrib : {}
// ...
//=============================================================================================
public class OwnedLandDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "owned_land#"; }
private static string getPrefixOfSK() { return ""; }
public OwnedLandDoc()
: base(typeof(OwnedLandDoc).Name)
{
appendAttribWrapperAll();
}
public OwnedLandDoc(string userGuid, META_ID landMetaId)
: base(typeof(OwnedLandDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(landMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<OwnedLandAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}

View File

@@ -0,0 +1,104 @@
using Newtonsoft.Json;
using ServerCore; using ServerBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using OWNER_GUID = System.String;
namespace ServerCommon
{
public class RentalAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public int LandMetaId { get; set; }
[JsonProperty("building_meta_id")]
public int BuildingMetaId { get; set; }
[JsonProperty("floor")]
public int Floor { get; set; }
[JsonProperty("myhome_guid")]
public string MyhomeGuid { get; set; } = string.Empty;
[JsonProperty("rental_finish_time")]
public DateTime RentalFinishTime { get; set; } = new();
public RentalAttrib()
: base(typeof(RentalAttrib).Name, false)
{ }
}
//=============================================================================================
// PK(Partition Key) : "rental#user_guid"
// SK(Sort Key) : "address#landId#buidlingId#floor"
// DocType : RentalDoc
// RentalAttrib : {}
// ...
//=============================================================================================
public class RentalDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "rental#"; }
private static string getPrefixOfSK() { return "address#"; }
public RentalDoc()
: base(typeof(RentalDoc).Name)
{
appendAttribWrapperAll();
}
public RentalDoc(string userGuid, string address)
: base(typeof(RentalDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(address);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
public RentalDoc(string userGuid, string address, long ttlSeconds)
: base(typeof(RentalDoc).Name, ttlSeconds)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(address);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<RentalAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override string onGetPrefixOfSK()
{
return getPrefixOfSK();
}
protected override string onMakeSK()
{
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
return ServerErrorCode.Success;
}
}
}

View File

@@ -0,0 +1,92 @@
using Google.Protobuf.WellKnownTypes;
using Newtonsoft.Json;
using ServerCore; using ServerBase;
using USER_GUID = System.String;
namespace ServerCommon
{
public class ShopProductTradingMeterSubAttrib
{
[JsonProperty("product_id")]
public int ProductId { get; set; }
[JsonProperty("left_count")]
public double LeftCount { get; set; }
}
public class ShopProductTradingMeterAttrib : AttribBase
{
[JsonProperty("shop_id")]
public int ShopId { get; set; }
[JsonProperty("shop_product_trading_meter_subs")]
public List<ShopProductTradingMeterSubAttrib> ShopProductTradingMeterSubs { get; set; }= new();
[JsonProperty("end_time")]
public Timestamp EndTime { get; set; } = DateTimeHelper.MinTime.ToTimestamp();
[JsonProperty("current_renewal_count")]
public Int32 CurrentRenewalCount { get; set; } = 0;
public void onClear()
{
ShopId = 0;
EndTime = DateTimeHelper.MinTime.ToTimestamp();
CurrentRenewalCount = 0;
ShopProductTradingMeterSubs.Clear();
}
public ShopProductTradingMeterAttrib()
: base(typeof(ShopProductTradingMeterAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "shop_product_trading_meter#user_guid"
// SK(Sort Key) : "shop_id"
// DocType : ShopProductTradingMeterDoc
// ShopProductTradingMeterAttrib : {}
// ...
//=============================================================================================
public class ShopProductTradingMeterDoc : DynamoDbDocBase
{
public ShopProductTradingMeterDoc() : base(nameof(ShopProductTradingMeterDoc))
{
appendAttribWrapperAll();
}
public ShopProductTradingMeterDoc(USER_GUID userGuid, int shop_id) : base(nameof(ShopProductTradingMeterDoc))
{
onCustomCreate(userGuid, shop_id);
}
private void onCustomCreate(USER_GUID userGuid, int shop_id)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(shop_id.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<ShopProductTradingMeterAttrib>());
}
protected override string onGetPrefixOfPK()
{
return "shop_product_trading_meter#";
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}
}

View File

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using Newtonsoft.Json;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.Model;
using Amazon.DynamoDBv2.DocumentModel;
using Google.Protobuf.WellKnownTypes;
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;
namespace ServerCommon
{
public class UserBaseAttrib : AttribBase
{
[JsonProperty("user_guid")]
public USER_GUID UserGuid { get; set; } = string.Empty;
[JsonProperty("account_id")]
public ACCOUNT_ID AccountId { get; set; } = string.Empty;
[JsonProperty("eoa")]
public string EOA { get; set; } = string.Empty;
[JsonProperty("selected_character_guid")]
public CHARACTER_GUID SelectedCharacterGuid { get; set; } = string.Empty;
[JsonProperty("is_intro_completed")]
public bool IsIntroCompleted { get; set; } = false;
[JsonProperty("game_login_datetime")]
public DateTime GameLoginDateTime = DateTime.MinValue;
[JsonProperty("game_logout_datetime")]
public DateTime GameLogoutDateTime = DateTime.MinValue;
public UserBaseAttrib()
: base(typeof(UserBaseAttrib).Name)
{ }
}
//=============================================================================================
// Primary Key
// PK(Partition Key) : "user_base#user_guid"
// SK(Sort Key) : ""
// UserBaseAttrib : {}
// ...
//=============================================================================================
public class UserBaseDoc : DynamoDbDocBase, ICopyDocFromEntityAttribute
{
private static string getPrefixOfPK() { return "user_base#"; }
private static string getPrefixOfSK() { return ""; }
public UserBaseDoc()
: base(typeof(UserBaseDoc).Name)
{
appendAttribWrapperAll();
}
public UserBaseDoc(USER_GUID userGuid)
: base(typeof(UserBaseDoc).Name)
{
setCombinationKeyForPK(userGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<UserBaseAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
// override ICopyDocFromEntityAttribute
public bool copyDocFromEntityAttribute(EntityAttributeBase entityAttributeBase)
{
var user_attribute = entityAttributeBase as UserAttribute;
if (null == user_attribute)
{
return false;
}
var user_base_attrib = getAttrib<UserBaseAttrib>();
NullReferenceCheckHelper.throwIfNull(user_base_attrib, () => $"user_base_attrib is null !!! - {toBasicString()}");
user_base_attrib.UserGuid = user_attribute.UserGuid;
user_base_attrib.AccountId = user_attribute.AccountId;
user_base_attrib.EOA = user_attribute.EOA;
user_base_attrib.SelectedCharacterGuid = user_attribute.SelectedCharacterGuid;
user_base_attrib.IsIntroCompleted = user_attribute.IsIntroCompleted;
return true;
}
}
}

View File

@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using ServerCore; using ServerBase;
using OWNER_GUID = System.String;
namespace ServerCommon
{
public class UserContentsSettingAttrib : AttribBase
{
[JsonProperty("myhome_slot_open_count")]
public int MyhomeSlotOpenCount { get; set; } = 0;
[JsonProperty("beacon_app_profile_upload_time")]
public DateTime BeaconAppProfileUploadTime { get; set; } = new();
public UserContentsSettingAttrib()
: base(typeof(UserContentsSettingAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "user_contents_setting#user_guid"
// SK(Sort Key) : ""
// DocType : UserContentsSettingDoc
// UserContentsSettingAttrib : {}
// ...
//=============================================================================================
public class UserContentsSettingDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "user_contents_setting#"; }
private static string getPrefixOfSK() { return ""; }
public UserContentsSettingDoc()
: base(typeof(UserContentsSettingDoc).Name)
{
appendAttribWrapperAll();
}
public UserContentsSettingDoc(string userGuid)
: base(typeof(UserContentsSettingDoc).Name)
{
setCombinationKeyForPK(userGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<UserContentsSettingAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
}
}