283 lines
11 KiB
C++
283 lines
11 KiB
C++
#ifndef BANK_HPP_INCLUDED
|
|
#define BANK_HPP_INCLUDED
|
|
|
|
#include "../../Core/Types/Convex.hpp"
|
|
#include <string>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
/** @addtogroup Interfaces
|
|
* @{ */
|
|
/**
|
|
* @note All methods require the Bank to be currently Open to successfully return a proper result
|
|
*/
|
|
class Bank
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Returns true if the Bank is currently Open
|
|
* @return True if the Bank is currently Open
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::IsOpen)
|
|
* return Bank::Close();
|
|
* @endcode
|
|
*/
|
|
static bool IsOpen();
|
|
|
|
/**
|
|
* @brief Attempts to Close the Bank if it's Currently Open, returns true if the Bank is currently Closed
|
|
* @return Returns True if the is successfully Closed, or the Bank is already Closed
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::IsOpen)
|
|
* return Bank::Close();
|
|
* @endcode
|
|
*/
|
|
static bool Close();
|
|
|
|
/**
|
|
* @brief Returns an array of all Item IDs in the Bank Inventory Container
|
|
* @return An array of all Item IDs in the Bank Inventory Container
|
|
* @par Example
|
|
* @code
|
|
* std::int32_t Index = Bank::GetIndexOf(995);
|
|
* std::vector<std::int32_t> BankContainerItemIDs = Bank::GetItemIDs();
|
|
* if ((Index != -1) && (Index <= BankContainerItemIDs.size()))
|
|
* std::cout << "Item with ID " << BankContainerItemIDs[Index] << " is in the " << Index << "th position in Bank" << std::endl;
|
|
* @endcode
|
|
* @see @ref ICLibFunctions
|
|
*/
|
|
static std::vector<std::int32_t> GetItemIDs();
|
|
/**
|
|
* @brief Returns an array of all Item Names in the Bank Inventory Container
|
|
* @return An array of all Item Names in the Bank Inventory Container
|
|
* @par Example
|
|
* @code
|
|
* std::int32_t Index = Bank::GetIndexOf("Coins");
|
|
* std::vector<std::int32_t> BankContainerItemNames = Bank::GetItemNames();
|
|
* if ((Index != -1) && (Index <= BankContainerItemNames.size()))
|
|
* std::cout << "Item with Name " << BankContainerItemNames[Index] << " is in the " << Index << "th position in Bank" << std::endl;
|
|
* @endcode
|
|
* @see @ref ICLibFunctions
|
|
*/
|
|
static std::vector<std::string> GetItemNames();
|
|
/**
|
|
* @brief Returns an array of all Item Names in the Bank Inventory Container
|
|
* @return An array of all Item Names in the Bank Inventory Container
|
|
* @par Example
|
|
* @code
|
|
* std::int32_t Index = Bank::GetIndexOf("Coins");
|
|
* std::vector<std::int32_t> BankContainerItemNames = Bank::GetItemNames();
|
|
* if ((Index != -1) && (Index <= BankContainerItemNames.size()))
|
|
* std::cout << "Item with Name " << BankContainerItemNames[Index] << " is in the " << Index << "th position in Bank" << std::endl;
|
|
* @endcode
|
|
* @see @ref ICLibFunctions
|
|
*/
|
|
static std::vector<std::int32_t> GetItemAmounts();
|
|
|
|
/**
|
|
* @brief Returns the total Item Amount of the specified Item matching the passed ID in the Bank
|
|
* @return The total Item Amount of the specified Item matching the passed ID in the Bank
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::GetItemAmount(995) <= 100000)
|
|
* return false;
|
|
* @endcode
|
|
*/
|
|
static std::int32_t GetItemAmount(std::int32_t ID);
|
|
|
|
/**
|
|
* @brief Returns the total Item Amount of the specified Item matching the passed Name in the Bank
|
|
* @return The total Item Amount of the specified Item matching the passed Name in the Bank
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::GetItemAmount(995) <= 100000)
|
|
* return false;
|
|
* @endcode
|
|
*/
|
|
static std::int32_t GetItemAmount(const std::string& Name);
|
|
|
|
/**
|
|
* @brief Returns the Index of the first occurrence of the specified Item matching the passed ID in the GetItemIDs() array
|
|
* @return The Index of the first occurrence of the specified Item matching the passed ID in the GetItemIDs() array
|
|
* @note Returns -1 if no occurrence of the specified Item matching the passed ID is found in the GetItemIDs() array
|
|
*/
|
|
static std::int32_t GetIndexOf(std::int32_t ID);
|
|
|
|
/**
|
|
* @brief Returns the Index of the first occurrence of the specified Item matching the passed Name in the GetItemIDs() array
|
|
* @return The Index of the first occurrence of the specified Item matching the passed Name in the GetItemIDs() array
|
|
* @note Returns -1 if no occurrence of the specified Item matching the passed Name is found in the GetItemIDs() array
|
|
*/
|
|
static std::int32_t GetIndexOf(const std::string& Name);
|
|
|
|
static Convex GetConvexOf(std::int32_t ID);
|
|
static Convex GetConvexOf(const std::string& Name);
|
|
|
|
|
|
/**
|
|
* @brief Returns true if the Bank contains the specified Item matching the passed ID
|
|
* @return True if the Bank contains the specified Item matching the passed ID
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::Contains(995))
|
|
* return Bank::WithdrawAllOf(995);
|
|
* @endcode
|
|
*/
|
|
static bool Contains(std::int32_t ID);
|
|
/**
|
|
* @brief Returns true if the Bank contains the specified Item matching the passed Name
|
|
* @return True if the Bank contains the specified Item matching the passed Name
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::Contains("Coins"))
|
|
* return Bank::WithdrawAllOf("Coins");
|
|
* @endcode
|
|
*/
|
|
static bool Contains(const std::string& Name);
|
|
/**
|
|
* @brief Returns true if the Bank contains all passed Item IDs, at least once
|
|
* @return True if the Bank contains all passed Item IDs, at least once
|
|
*/
|
|
static bool Contains(const std::vector<std::int32_t>& IDs);
|
|
/**
|
|
* @brief Returns true if the Bank contains all passed Item Names, at least once
|
|
* @return True if the Bank contains all passed Item Item Names, at least once
|
|
*/
|
|
static bool Contains(const std::vector<std::string>& Names);
|
|
|
|
/**
|
|
* @brief Returns true if the Bank contains any of the passed IDs, at least once
|
|
* @return True if the Bank contains any of the passed Item IDs, at least once
|
|
*/
|
|
static bool ContainsAny(const std::vector<std::int32_t>& IDs);
|
|
/**
|
|
* @brief Returns true if the Bank contains any of the passed Item Names, at least once
|
|
* @return True if the Bank contains any of the passed Item Names, at least once
|
|
*/
|
|
static bool ContainsAny(const std::vector<std::string>& Names);
|
|
|
|
/**
|
|
* @brief Returns true if the Bank only contains the passed Item ID
|
|
* @return True if the Bank only contains the passed Item ID
|
|
*/
|
|
static bool ContainsOnly(std::int32_t ID);
|
|
/**
|
|
* @brief Returns true if the Bank only contains the passed Item Name
|
|
* @return True if the Bank only contains the passed Item Name
|
|
*/
|
|
static bool ContainsOnly(const std::string& Name);
|
|
/**
|
|
* @brief Returns true if the Bank only contains the passed Item IDs
|
|
* @return True if the Bank only contains the passed Item IDs
|
|
*/
|
|
static bool ContainsOnly(const std::vector<std::int32_t>& IDs);
|
|
/**
|
|
* @brief Returns true if the Bank only contains the passed Item Names
|
|
* @return True if the Bank only contains the passed Item Names
|
|
*/
|
|
static bool ContainsOnly(const std::vector<std::string>& Names);
|
|
|
|
/**
|
|
* @brief Returns the currently active Bank Tab
|
|
* @return The currently active Bank Tab
|
|
* @note Returns -1 if no currently active Bank Tab is found
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::GetCurrentTab() == 0)
|
|
* Debug("The All tab is open");
|
|
* @endcode
|
|
*/
|
|
static std::int32_t GetCurrentTab();
|
|
|
|
/**
|
|
* @brief Returns the Tab Index of the specified Item matching the passed ID
|
|
* @return The Tab Index of the specified Item matching the passed ID
|
|
* @par Example
|
|
* @code
|
|
* std::int32_t TabWithCoins = Bank::GetTabOf(995);
|
|
* if (Bank::GetCurrentTab() != TabWithCoins)
|
|
* return Bank::OpenTab(TabWithCoins);
|
|
* @endcode
|
|
*/
|
|
static std::int32_t GetTabOf(std::int32_t ID);
|
|
|
|
/**
|
|
* @brief Returns the Tab Index of the specified Item Name
|
|
* @return The Tab Index of the specified Item Name
|
|
* @par Example
|
|
* @code
|
|
* std::int32_t TabWithCoins = Bank::GetTabOf("Coins");
|
|
* if (Bank::GetCurrentTab() != TabWithCoins)
|
|
* return Bank::OpenTab(TabWithCoins);
|
|
* @endcode
|
|
*/
|
|
static std::int32_t GetTabOf(const std::string& Name);
|
|
|
|
/**
|
|
* @brief Attempts to Open the specified Bank Tab, 0 being all items
|
|
* @return True if it successfully opens the specified Bank Tab
|
|
* @par Example
|
|
* @code
|
|
* if ((Bank::IsOpen()) && (Bank::GetCurrentTab() != 0))
|
|
* return Bank::OpenTab(0);
|
|
* @endcode
|
|
*/
|
|
static bool OpenTab(std::int32_t Tab);
|
|
|
|
/**
|
|
* @brief Attempts to Scroll to the specified Item matching the passed ID
|
|
* @return True if it successfully scrolls to the specified Item matching the passed ID
|
|
* @note Returns true if the Item is already in view
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::Contains(995))
|
|
* return Bank::ScrolTo(995);
|
|
* @endcode
|
|
*/
|
|
static bool ScrollTo(std::int32_t ID);
|
|
|
|
/**
|
|
* @brief Attempts to Scroll to the specified Item matching the passed Name
|
|
* @return True if it successfully scrolls to the specified Item matching the passed Name
|
|
* @note Returns true if the Item is already in view
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::Contains("Coins"))
|
|
* return Bank::ScrolTo("Coins");
|
|
* @endcode
|
|
*/
|
|
static bool ScrollTo(const std::string& Name);
|
|
/**
|
|
* @brief Attempts to Scroll to the specified Item matching the passed Name, and optionally Opens the Tab
|
|
* @return True if it successfully scrolls to the specified Item matching the passed Name
|
|
* @note Returns true if the Item is already in view
|
|
* @par Example
|
|
* @code
|
|
* if (Bank::Contains("Coins"))
|
|
* return Bank::ScrolTo("Coins");
|
|
* @endcode
|
|
*/
|
|
static bool ScrollTo(std::int32_t ID, bool OpenTab);
|
|
static bool ScrollTo(const std::string& Name, bool OpenTab);
|
|
|
|
static bool WithdrawAllOf(std::int32_t ID);
|
|
static bool WithdrawAllOf(const std::string& Name);
|
|
static bool WithdrawXOf(std::int32_t ID, std::int32_t Amount);
|
|
static bool WithdrawXOf(const std::string& Name, std::int32_t Amount);
|
|
static bool WithdrawAllButOneOf(std::int32_t ID);
|
|
static bool WithdrawAllButOneOf(const std::string& Name);
|
|
|
|
static bool DepositAllOf(std::int32_t ID);
|
|
static bool DepositAllOf(const std::string& Name);
|
|
static bool DepositXOf(std::int32_t ID, std::int32_t Amount);
|
|
static bool DepositXOf(const std::string& Name, std::int32_t Amount);
|
|
static bool DepositAll();
|
|
static bool DepositEquipment();
|
|
};
|
|
|
|
/** @} */
|
|
|
|
#endif // BANK_HPP_INCLUDED
|