OSDN Git Service

First version
[st-ro/stro.git] / src / map / buyingstore.h
1 // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
2 // For more information, see LICENCE in the main folder
3
4 #ifndef _BUYINGSTORE_H_
5 #define _BUYINGSTORE_H_
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 struct s_search_store_search;
12
13 #define MAX_BUYINGSTORE_SLOTS 5
14
15 struct s_buyingstore_item
16 {
17         int price;
18         unsigned short amount;
19         unsigned short nameid;
20 };
21
22 struct s_buyingstore
23 {
24         struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
25         int zenylimit;
26         unsigned char slots;
27 };
28
29 /// Autotrade entry
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)
36 };
37
38 /// Struct of autotrader
39 struct s_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
45                 y; ///< Y location
46         unsigned char sex, ///< Autotrader's sex
47                 dir, ///< Body direction
48                 head_dir, ///< Head direction
49                 sit; ///< Is sitting?
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;
55 };
56
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);
67
68 void do_init_buyingstore_autotrade( void );
69 void buyingstore_reopen( struct map_session_data* sd );
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif  // _BUYINGSTORE_H_