1 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
2 // For more information, see LICENCE in the main folder
4 #ifndef _BUYINGSTORE_H_
5 #define _BUYINGSTORE_H_
11 struct s_search_store_search;
13 #define MAX_BUYINGSTORE_SLOTS 5
15 struct s_buyingstore_item
18 unsigned short amount;
19 unsigned short nameid;
24 struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
30 struct s_autotrade_entry {
31 uint32 cartinventory_id; ///< Item entry id/cartinventory_id in cart_inventory table (for vending)
32 uint16 amount; ///< Amount
33 uint32 price; ///< Price
34 uint16 index; ///< Item index in cart
35 uint32 item_id; ///< Item ID (for buyingstore)
38 /// Struct of autotrader
40 uint32 id; ///< vendor/buyer id
41 uint32 account_id; ///< Account ID
42 uint32 char_id; ///< Char ID
43 int m; ///< Map location
44 uint16 x, ///< X location
46 unsigned char sex, ///< Autotrader's sex
47 dir, ///< Body direction
48 head_dir, ///< Head direction
50 char title[MESSAGE_SIZE]; ///< Store name
51 uint32 limit; ///< Maximum zeny to be spent (for buyingstore)
52 uint16 count; ///< Number of item in store
53 struct s_autotrade_entry **entries; ///< Store details
54 struct map_session_data *sd;
57 int8 buyingstore_setup(struct map_session_data* sd, unsigned char slots);
58 int8 buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const uint8* itemlist, unsigned int count, struct s_autotrader *at);
59 void buyingstore_close(struct map_session_data* sd);
60 void buyingstore_open(struct map_session_data* sd, uint32 account_id);
61 void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned int buyer_id, const uint8* itemlist, unsigned int count);
62 bool buyingstore_search(struct map_session_data* sd, unsigned short nameid);
63 bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s);
64 DBMap *buyingstore_getdb(void);
65 void do_final_buyingstore(void);
66 void do_init_buyingstore(void);
68 void do_init_buyingstore_autotrade( void );
69 void buyingstore_reopen( struct map_session_data* sd );
75 #endif // _BUYINGSTORE_H_