feat: implement offline shop and shop search systems (Stage 5 Part 2)
- Enable ENABLE_OFFLINESHOP_SYSTEM and ENABLE_SHOP_SEARCH_SYSTEM in service.h - Define OFFLINE_SHOP_HOST_ITEM_MAX_NUM (80) and SHOP_SIGN_MAX_LEN (45) in length.h - Add CG57, CG58, CG143, GC47, GC48, GC156 packet definitions and subheaders - Port offline shop, shop manager, search manager, and DB client manager - Auto-bootstrap offline shop SQL tables and player.shop_money/shopFlag columns - Add 72319 item consumption for shop slot expansion (bPos 40..79) - Add comprehensive feature tests in test_offlineshop.py
This commit is contained in:
@@ -156,6 +156,9 @@ enum
|
||||
|
||||
HEADER_GD_UPDATE_CHANNELSTATUS = 139,
|
||||
HEADER_GD_REQUEST_CHANNELSTATUS = 140,
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
HEADER_GD_OFFLINESHOP = 146,
|
||||
#endif
|
||||
|
||||
HEADER_GD_SETUP = 0xff,
|
||||
|
||||
@@ -203,6 +206,9 @@ enum
|
||||
HEADER_DG_PARTY_STATE_CHANGE = 63,
|
||||
HEADER_DG_PARTY_HEAL_USE = 64,
|
||||
HEADER_DG_PARTY_SET_MEMBER_LEVEL = 65,
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
HEADER_DG_OFFLINESHOP = 66,
|
||||
#endif
|
||||
|
||||
HEADER_DG_TIME = 90,
|
||||
HEADER_DG_ITEM_ID_RANGE = 91,
|
||||
@@ -492,6 +498,9 @@ typedef struct SPlayerTable
|
||||
#ifdef UNLOCK_INVENTORY_WORLDARD
|
||||
DWORD inventory_unlock[UNLOCK_INVENTORY_MAX];
|
||||
#endif
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
unsigned long long shopFlag;
|
||||
#endif
|
||||
} TPlayerTable;
|
||||
|
||||
typedef struct SMobSkillLevel
|
||||
@@ -1609,5 +1618,158 @@ typedef struct SPetSkill
|
||||
} TPetSkill;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
typedef struct offline_shop_item
|
||||
{
|
||||
DWORD id;
|
||||
DWORD owner_id;
|
||||
BYTE pos;
|
||||
int count;
|
||||
long long price;
|
||||
DWORD vnum;
|
||||
long alSockets[ITEM_SOCKET_MAX_NUM];
|
||||
TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
|
||||
BYTE status;
|
||||
char szBuyerName[CHARACTER_NAME_MAX_LEN+1];
|
||||
#ifdef ENABLE_CHANGELOOK_SYSTEM
|
||||
DWORD transmutation;
|
||||
#endif
|
||||
char szOwnerName[CHARACTER_NAME_MAX_LEN+1];
|
||||
} OFFLINE_SHOP_ITEM;
|
||||
|
||||
typedef struct ShopLog {
|
||||
char name[CHARACTER_NAME_MAX_LEN+1];
|
||||
char date[25];
|
||||
DWORD itemVnum;
|
||||
DWORD itemCount;
|
||||
long long price;
|
||||
} TShopLog;
|
||||
|
||||
typedef struct SShopDecoration {
|
||||
char sign[SHOP_SIGN_MAX_LEN + 1];
|
||||
DWORD owner_id;
|
||||
BYTE vnum;
|
||||
BYTE type;
|
||||
} TShopDecoration;
|
||||
|
||||
typedef struct SGDOfflineShopCreate
|
||||
{
|
||||
DWORD owner_id;
|
||||
char owner_name[CHARACTER_NAME_MAX_LEN+1];
|
||||
char sign[SHOP_SIGN_MAX_LEN + 1];
|
||||
long x;
|
||||
long y;
|
||||
long z;
|
||||
DWORD mapindex;
|
||||
DWORD type;
|
||||
BYTE channel;
|
||||
unsigned long long slotflag;
|
||||
OFFLINE_SHOP_ITEM items[OFFLINE_SHOP_HOST_ITEM_MAX_NUM];
|
||||
long long price;
|
||||
ShopLog log[OFFLINE_SHOP_HOST_ITEM_MAX_NUM];
|
||||
int time;
|
||||
} TOfflineShop;
|
||||
|
||||
typedef struct SOfflineShopBuy
|
||||
{
|
||||
OFFLINE_SHOP_ITEM item;
|
||||
DWORD customer_id;
|
||||
char customer_name[CHARACTER_NAME_MAX_LEN + 1];
|
||||
ShopLog log;
|
||||
int log_index;
|
||||
} TOfflineShopBuy;
|
||||
|
||||
typedef struct SOfflineShopChangeTitle
|
||||
{
|
||||
DWORD owner_id;
|
||||
char sign[SHOP_SIGN_MAX_LEN + 1];
|
||||
} TOfflineShopChangeTitle;
|
||||
|
||||
typedef struct SOfflineShopItemTable
|
||||
{
|
||||
DWORD vnum;
|
||||
int count;
|
||||
TItemPos pos;
|
||||
long long price;
|
||||
BYTE display_pos;
|
||||
} TOfflineShopItemTable;
|
||||
|
||||
typedef struct SOfflineShopAddItem
|
||||
{
|
||||
TItemPos bPos;
|
||||
BYTE bDisplayPos;
|
||||
long long lPrice;
|
||||
} TOfflineShopAddItem;
|
||||
|
||||
typedef struct SOfflineShopOpenSlot
|
||||
{
|
||||
DWORD owner_id;
|
||||
unsigned long long flag;
|
||||
} TOfflineShopOpenSlot;
|
||||
|
||||
typedef struct SOfflineShopBackItem
|
||||
{
|
||||
DWORD owner_id;
|
||||
OFFLINE_SHOP_ITEM items[OFFLINE_SHOP_HOST_ITEM_MAX_NUM];
|
||||
} TOfflineShopBackItem;
|
||||
|
||||
enum {
|
||||
// db
|
||||
CREATE_OFFLINESHOP,
|
||||
DESTROY_OFFLINESHOP,
|
||||
REMOVE_ITEM,
|
||||
ADD_ITEM,
|
||||
BUY_ITEM,
|
||||
WITHDRAW_MONEY,
|
||||
CHANGE_TITLE,
|
||||
CLEAR_LOG,
|
||||
CHANGE_DECORATION,
|
||||
CHANGE_OPEN_SLOT,
|
||||
TIME_DONE,
|
||||
GET_BACK_ITEM,
|
||||
ADD_TIME,
|
||||
};
|
||||
|
||||
struct shop_decoration {
|
||||
BYTE subheader;
|
||||
TShopDecoration decoration;
|
||||
};
|
||||
|
||||
struct shop_create {
|
||||
BYTE subheader;
|
||||
TOfflineShop offlineshop;
|
||||
};
|
||||
|
||||
struct shop_buy {
|
||||
BYTE subheader;
|
||||
TOfflineShopBuy buyItem;
|
||||
};
|
||||
|
||||
struct shop_title {
|
||||
BYTE subheader;
|
||||
TOfflineShopChangeTitle title;
|
||||
};
|
||||
|
||||
struct shop_owner {
|
||||
BYTE subheader;
|
||||
DWORD owner_id;
|
||||
};
|
||||
|
||||
struct shop_item {
|
||||
BYTE subheader;
|
||||
OFFLINE_SHOP_ITEM item;
|
||||
};
|
||||
|
||||
struct shop_slot {
|
||||
BYTE subheader;
|
||||
TOfflineShopOpenSlot ch;
|
||||
};
|
||||
|
||||
struct shop_back {
|
||||
BYTE subheader;
|
||||
TOfflineShopBackItem back;
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user