buyingstore.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef BUYINGSTORE_HPP
  4. #define BUYINGSTORE_HPP
  5. #include <common/cbasetypes.hpp>
  6. #include "map.hpp" //MESSAGE_SIZE
  7. struct s_search_store_search;
  8. class map_session_data;
  9. #define MAX_BUYINGSTORE_SLOTS 5
  10. struct s_buyingstore_item
  11. {
  12. int price;
  13. unsigned short amount;
  14. t_itemid nameid;
  15. };
  16. struct s_buyingstore
  17. {
  18. struct s_buyingstore_item items[MAX_BUYINGSTORE_SLOTS];
  19. int zenylimit;
  20. unsigned char slots;
  21. };
  22. /// Autotrade entry
  23. struct s_autotrade_entry {
  24. uint32 cartinventory_id; ///< Item entry id/cartinventory_id in cart_inventory table (for vending)
  25. uint16 amount; ///< Amount
  26. uint32 price; ///< Price
  27. uint16 index; ///< Item index in cart
  28. t_itemid item_id; ///< Item ID (for buyingstore)
  29. };
  30. /// Struct of autotrader
  31. struct s_autotrader {
  32. uint32 id; ///< vendor/buyer id
  33. uint32 account_id; ///< Account ID
  34. uint32 char_id; ///< Char ID
  35. int m; ///< Map location
  36. uint16 x, ///< X location
  37. y; ///< Y location
  38. unsigned char sex, ///< Autotrader's sex
  39. dir, ///< Body direction
  40. head_dir, ///< Head direction
  41. sit; ///< Is sitting?
  42. char title[MESSAGE_SIZE]; ///< Store name
  43. uint32 limit; ///< Maximum zeny to be spent (for buyingstore)
  44. uint16 count; ///< Number of item in store
  45. struct s_autotrade_entry **entries; ///< Store details
  46. map_session_data *sd;
  47. };
  48. int8 buyingstore_setup(map_session_data* sd, unsigned char slots);
  49. int8 buyingstore_create(map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, uint32 count, struct s_autotrader *at);
  50. void buyingstore_close(map_session_data* sd);
  51. void buyingstore_open(map_session_data* sd, uint32 account_id);
  52. void buyingstore_trade(map_session_data* sd, uint32 account_id, uint32 buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, uint32 count);
  53. bool buyingstore_search(map_session_data* sd, t_itemid nameid);
  54. bool buyingstore_searchall(map_session_data* sd, const struct s_search_store_search* s);
  55. DBMap *buyingstore_getdb(void);
  56. void do_final_buyingstore(void);
  57. void do_init_buyingstore(void);
  58. void do_init_buyingstore_autotrade( void );
  59. void buyingstore_reopen( map_session_data* sd );
  60. void buyingstore_update(map_session_data &sd);
  61. #endif /* BUYINGSTORE_HPP */