Files
Sun1602/Server/ShopServer/ShopItemObject.h
T
2022-10-26 12:25:11 +08:00

50 lines
1.7 KiB
C++

#pragma once
#include "CashShopHeader.h"
class CShopProduct;
class CShopProductLink;
namespace ConvenienceStore
{
//------------------------------------------------------------------------------
enum ShopItemObjectType
{
OBJECT_TYPE_PRODUCT,
OBJECT_TYPE_PURCHASE,
OBJECT_TYPE_STORAGE_BUY,
OBJECT_TYPE_STORAGE_GIFT,
};
//------------------------------------------------------------------------------
class ShopItemObject
{
protected:
ShopItemObject():nPackageSeq(0) {}
private:
int nPackageSeq;
public:
virtual ShopItemObjectType GetObjectType() PURE;
virtual LPCTSTR GetName() PURE;
bool IsProductItem() { return GetObjectType() == OBJECT_TYPE_PRODUCT; }
bool IsPurchase() { return GetObjectType() == OBJECT_TYPE_PURCHASE; }
bool IsStorageBuy() { return GetObjectType() == OBJECT_TYPE_STORAGE_BUY; }
bool IsStorageGift() { return GetObjectType() == OBJECT_TYPE_STORAGE_GIFT; }
bool IsProduct() { return IsProductItem() || IsPurchase(); }
bool IsStorageItem() { return IsStorageBuy() || IsStorageGift(); }
int GetPackageSeq(){return nPackageSeq;}
void SetPackageSeq(int Seq){nPackageSeq=Seq;}
protected:
static bool CheckProperty(CShopProduct* shop_product, CShopProductLink* shop_product_link, int waste_seq, int infinite_seq, int date_seq);
static bool FindProperty(Define::ShopPropertyType property_type, CShopProduct* shop_product, int price_seq, /*eCHAR_TYPE char_type,*/ OUT CShopProductLink*& shop_product_link, OUT CShopProperty*& shop_property);
static bool FillProductInfo(CShopProduct* shop_product, int price_seq, /*eCHAR_TYPE char_type,*/ OUT ProductInfo& product_info);
};
}