searchstore.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef SEARCHSTORE_HPP
  4. #define SEARCHSTORE_HPP
  5. #include <memory>
  6. #include <vector>
  7. #include "../common/cbasetypes.hpp"
  8. #include "../common/mmo.hpp"
  9. #include "clif.hpp"
  10. #include "map.hpp"
  11. #define SEARCHSTORE_RESULTS_PER_PAGE 10
  12. /// information about the search being performed
  13. struct s_search_store_search {
  14. map_session_data* search_sd; // sd of the searching player
  15. const struct PACKET_CZ_SEARCH_STORE_INFO_item* itemlist;
  16. const struct PACKET_CZ_SEARCH_STORE_INFO_item* cardlist;
  17. unsigned int item_count;
  18. unsigned int card_count;
  19. unsigned int min_price;
  20. unsigned int max_price;
  21. };
  22. struct s_search_store_info_item {
  23. int store_id;
  24. uint32 account_id;
  25. char store_name[MESSAGE_SIZE];
  26. t_itemid nameid;
  27. unsigned short amount;
  28. unsigned int price;
  29. t_itemid card[MAX_SLOTS];
  30. unsigned char refine;
  31. uint8 enchantgrade;
  32. };
  33. struct s_search_store_info {
  34. std::vector<std::shared_ptr<s_search_store_info_item>> items;
  35. unsigned int pages; // amount of pages already sent to client
  36. unsigned int uses;
  37. int remote_id;
  38. time_t nextquerytime;
  39. unsigned short effect; // 0 = Normal (display coords), 1 = Cash (remote open store)
  40. unsigned char type; // 0 = Vending, 1 = Buying Store
  41. bool open;
  42. };
  43. bool searchstore_open(map_session_data* sd, unsigned int uses, unsigned short effect);
  44. void searchstore_query(map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const struct PACKET_CZ_SEARCH_STORE_INFO_item* itemlist, unsigned int item_count, const struct PACKET_CZ_SEARCH_STORE_INFO_item* cardlist, unsigned int card_count);
  45. bool searchstore_querynext(map_session_data* sd);
  46. void searchstore_next(map_session_data* sd);
  47. void searchstore_clear(map_session_data* sd);
  48. void searchstore_close(map_session_data* sd);
  49. void searchstore_click(map_session_data* sd, uint32 account_id, int store_id, t_itemid nameid);
  50. bool searchstore_queryremote(map_session_data* sd, uint32 account_id);
  51. void searchstore_clearremote(map_session_data* sd);
  52. #endif /* SEARCHSTORE_HPP */