using ServerCore; using ServerBase; using ServerCommon; namespace GameServer; public class BeaconShopSoldPrice : EntityBase { public BeaconShopSoldPrice(EntityBase owner) : base(EntityType.BeaconShopSoldPrice, owner) { } public override async Task onInit() { addEntityAttribute(new BeaconShopSoldPriceAttribute(this)); return await base.onInit(); } public override string toBasicString() { return $"{this.getTypeName()} - {getRootParent().toBasicString()}"; } public override string toSummaryString() { return $"{this.getTypeName()} - {getRootParent().toBasicString()}"; } public static async Task<(Result, BeaconShopSoldPrice?)> createBeaconShopSoldPriceFromDoc(Player owner, BeaconShopSoldPriceDoc doc) { var beacon_shop_sold_price = new BeaconShopSoldPrice(owner); var result = await beacon_shop_sold_price.onInit(); if (result.isFail()) { return (result, null); } var err_msg = string.Empty; var beacon_shop_sold_price_attribute = beacon_shop_sold_price.getEntityAttribute(); if (beacon_shop_sold_price_attribute == null) { err_msg = $"Failed to get beacon shop sold price attribute : {nameof(BeaconShopSoldPriceAttribute)}"; result.setFail(ServerErrorCode.EntityAttributeIsNull, err_msg); Log.getLogger().error(err_msg); return (result, null); } if (beacon_shop_sold_price_attribute.copyEntityAttributeFromDoc(doc) == false) { err_msg = $"Failed to copyEntityAttributeFromDoc !!! : doc_type {doc.GetType()} - {beacon_shop_sold_price.getRootParent().toBasicString()}"; result.setFail(ServerErrorCode.DynamoDbDocCopyToEntityAttributeFailed, err_msg); Log.getLogger().error(err_msg); return (result, null); } return (result, beacon_shop_sold_price); } }