Guest User

Untitled

a guest
Jan 27th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. /**
  2. * Tibia GIMUD Server - a free and open-source MMORPG server emulator
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18.  
  19. #ifndef FS_IOLOGINDATA_H_28B0440BEC594654AC0F4E1A5E42B2EF
  20. #define FS_IOLOGINDATA_H_28B0440BEC594654AC0F4E1A5E42B2EF
  21.  
  22. #include "account.h"
  23. #include "player.h"
  24. #include "database.h"
  25.  
  26. typedef std::list<std::pair<int32_t, Item*>> ItemBlockList;
  27.  
  28. class IOLoginData
  29. {
  30. public:
  31. static Account loadAccount(uint32_t accno);
  32. static bool saveAccount(const Account& acc);
  33.  
  34. static bool loginserverAuthentication(uint32_t accountNumber, const std::string& password, Account& account);
  35. static uint32_t gameworldAuthentication(uint32_t accountNumber, const std::string& password, std::string& characterName, bool& cast);
  36.  
  37. static AccountType_t getAccountType(uint32_t accountId);
  38. static void setAccountType(uint32_t accountId, AccountType_t accountType);
  39. static void updateOnlineStatus(uint32_t guid, bool login, bool broadcasting, const std::string& cast_password,
  40. const std::string& cast_description, uint32_t spectators);
  41. static void removeOnlineStatus(uint32_t guid);
  42. static bool preloadPlayer(Player* player, const std::string& name);
  43.  
  44. static bool loadPlayerById(Player* player, uint32_t id);
  45. static bool loadPlayerByName(Player* player, const std::string& name);
  46. static bool loadPlayer(Player* player, DBResult_ptr result);
  47. static bool savePlayer(Player* player);
  48. static uint32_t getGuidByName(const std::string& name);
  49. static bool getGuidByNameEx(uint32_t& guid, bool& specialVip, std::string& name);
  50. static std::string getNameByGuid(uint32_t guid);
  51. static bool formatPlayerName(std::string& name);
  52. static void increaseBankBalance(uint32_t guid, uint64_t bankBalance);
  53. static bool hasBiddedOnHouse(uint32_t guid);
  54.  
  55. static std::forward_list<VIPEntry> getVIPEntries(uint32_t accountId);
  56. static void addVIPEntry(uint32_t accountId, uint32_t guid);
  57. static void removeVIPEntry(uint32_t accountId, uint32_t guid);
  58.  
  59. static void addPremiumDays(uint32_t accountId, int32_t addDays);
  60. static void removePremiumDays(uint32_t accountId, int32_t removeDays);
  61.  
  62. protected:
  63. typedef std::map<uint32_t, std::pair<Item*, uint32_t>> ItemMap;
  64.  
  65. static void loadItems(ItemMap& itemMap, DBResult_ptr result);
  66. static bool saveItems(const Player* player, const ItemBlockList& itemList, DBInsert& query_insert, PropWriteStream& stream);
  67. };
  68.  
  69. #endif
Advertisement
Add Comment
Please, Sign In to add comment