mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Moved class Bot database code into class BotDatbase
This commit is contained in:
+213
-32
@@ -29,9 +29,16 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Bot;
|
||||
class ItemInst;
|
||||
class Inventory;
|
||||
struct BotsAvailableList;
|
||||
enum BotStanceType;
|
||||
|
||||
|
||||
class BotDatabase : public DBcore
|
||||
{
|
||||
|
||||
public:
|
||||
BotDatabase();
|
||||
BotDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
@@ -39,49 +46,223 @@ public:
|
||||
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
|
||||
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
|
||||
bool LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
|
||||
|
||||
// Bot command functions
|
||||
bool GetInspectMessage(uint32 bot_id, InspectMessage_Struct* message);
|
||||
bool SetInspectMessage(uint32 bot_id, const InspectMessage_Struct* message);
|
||||
bool SetAllInspectMessages(uint32 owner_id, const InspectMessage_Struct* message);
|
||||
|
||||
bool SetAllArmorColorBySlot(uint32 owner_id, int16 slot_id, uint32 rgb_value);
|
||||
bool SetAllArmorColors(uint32 owner_id, uint32 rgb_value);
|
||||
/* Bot functions */
|
||||
bool QueryNameAvailablity(const std::string& bot_name, bool& available_flag);
|
||||
bool QueryBotCount(const uint32 owner_id, uint32& bot_count);
|
||||
bool LoadQuestableSpawnCount(const uint32 owner_id, int& spawn_count);
|
||||
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list);
|
||||
|
||||
bool SetHelmAppearance(uint32 owner_id, uint32 bot_id, bool show_flag = true);
|
||||
bool SetAllHelmAppearances(uint32 owner_id, bool show_flag = true);
|
||||
bool LoadOwnerID(const std::string& bot_name, uint32& owner_id);
|
||||
bool LoadOwnerID(const uint32 bot_id, uint32& owner_id);
|
||||
bool LoadBotID(const uint32 owner_id, const std::string& bot_name, uint32& bot_id);
|
||||
|
||||
bool ToggleHelmAppearance(uint32 owner_id, uint32 bot_id);
|
||||
bool ToggleAllHelmAppearances(uint32 owner_id);
|
||||
bool LoadBot(const uint32 bot_id, Bot*& loaded_bot);
|
||||
bool SaveNewBot(Bot* bot_inst, uint32& bot_id);
|
||||
bool SaveBot(Bot* bot_inst);
|
||||
bool DeleteBot(const uint32 bot_id);
|
||||
|
||||
bool SetFollowDistance(uint32 owner_id, uint32 bot_id, uint32 follow_distance);
|
||||
bool SetAllFollowDistances(uint32 owner_id, uint32 follow_distance);
|
||||
bool LoadBuffs(Bot* bot_inst);
|
||||
bool SaveBuffs(Bot* bot_inst);
|
||||
bool DeleteBuffs(const uint32 bot_id);
|
||||
|
||||
uint32 Clone(uint32 owner_id, uint32 bot_id, const char* clone_name);
|
||||
bool CloneInventory(uint32 owner_id, uint32 bot_id, uint32 clone_id);
|
||||
bool LoadStance(const uint32 bot_id, BotStanceType& bot_stance);
|
||||
bool LoadStance(Bot* bot_inst, bool& stance_flag);
|
||||
bool SaveStance(const uint32 bot_id, const BotStanceType bot_stance);
|
||||
bool SaveStance(Bot* bot_inst);
|
||||
bool DeleteStance(const uint32 bot_id);
|
||||
|
||||
// Bot-group functions
|
||||
bool DoesBotGroupExist(std::string& group_name);
|
||||
bool LoadTimers(Bot* bot_inst);
|
||||
bool SaveTimers(Bot* bot_inst);
|
||||
bool DeleteTimers(const uint32 bot_id);
|
||||
|
||||
uint32 GetGroupIDByGroupName(std::string& group_name, std::string& error_message);
|
||||
uint32 GetLeaderIDByGroupName(std::string& group_name, std::string& error_message);
|
||||
std::string GetGroupNameByGroupID(uint32 group_id, std::string& error_message);
|
||||
std::string GetGroupNameByLeaderID(uint32 leader_id, std::string& error_message);
|
||||
uint32 GetGroupIDByLeaderID(uint32 leader_id, std::string& error_message);
|
||||
uint32 GetLeaderIDByGroupID(uint32 group_id, std::string& error_message);
|
||||
bool LoadGuildMembership(const uint32 bot_id, uint32& guild_id, uint8& guild_rank, std::string& guild_name);
|
||||
bool SaveGuildMembership(const uint32 bot_id, const uint32 guild_id, const uint8 guild_rank);
|
||||
bool DeleteGuildMembership(const uint32 bot_id);
|
||||
|
||||
uint32 GetGroupIDByMemberID(uint32 member_id, std::string& error_message);
|
||||
|
||||
bool CreateBotGroup(std::string& group_name, uint32 leader_id, std::string& error_message);
|
||||
bool DeleteBotGroup(uint32 leader_id, std::string& error_message);
|
||||
bool AddMemberToBotGroup(uint32 leader_id, uint32 member_id, std::string& error_message);
|
||||
bool RemoveMemberFromBotGroup(uint32 member_id, std::string& error_message);
|
||||
/* Bot inventory functions */
|
||||
bool QueryInventoryCount(const uint32 bot_id, uint32& item_count);
|
||||
|
||||
uint32 GetGroupIDForLoadGroup(uint32 owner_id, std::string& group_name, std::string& error_message);
|
||||
std::map<uint32, std::list<uint32>> LoadGroup(std::string& group_name, std::string& error_message);
|
||||
bool LoadItems(const uint32 bot_id, Inventory &inventory_inst);
|
||||
bool SaveItems(Bot* bot_inst);
|
||||
bool DeleteItems(const uint32 bot_id);
|
||||
|
||||
bool LoadItemBySlot(Bot* bot_inst);
|
||||
bool LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint32& item_id);
|
||||
bool SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const ItemInst* item_inst);
|
||||
bool DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id);
|
||||
|
||||
bool LoadEquipmentColor(const uint32 bot_id, const uint8 material_slot_id, uint32& rgb);
|
||||
bool SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, const uint32 rgb);
|
||||
|
||||
|
||||
/* Bot pet functions */
|
||||
bool LoadPetIndex(const uint32 bot_id, uint32& pet_index);
|
||||
bool LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id);
|
||||
|
||||
std::list<std::pair<std::string, std::string>> GetGroupsListByOwnerID(uint32 owner_id, std::string& error_message);
|
||||
bool LoadPetStats(const uint32 bot_id, std::string& pet_name, uint32& pet_mana, uint32& pet_hp, uint32& pet_spell_id);
|
||||
bool SavePetStats(const uint32 bot_id, const std::string& pet_name, const uint32 pet_mana, const uint32 pet_hp, const uint32 pet_spell_id);
|
||||
bool DeletePetStats(const uint32 bot_id);
|
||||
|
||||
bool LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs);
|
||||
bool SavePetBuffs(const uint32 bot_id, const SpellBuff_Struct* pet_buffs, bool delete_flag = false);
|
||||
bool DeletePetBuffs(const uint32 bot_id);
|
||||
|
||||
bool LoadPetItems(const uint32 bot_id, uint32* pet_items);
|
||||
bool SavePetItems(const uint32 bot_id, const uint32* pet_items, bool delete_flag = false);
|
||||
bool DeletePetItems(const uint32 bot_id);
|
||||
|
||||
|
||||
/* Bot command functions */
|
||||
bool LoadInspectMessage(const uint32 bot_id, InspectMessage_Struct& inspect_message);
|
||||
bool SaveInspectMessage(const uint32 bot_id, const InspectMessage_Struct& inspect_message);
|
||||
bool DeleteInspectMessage(const uint32 bot_id);
|
||||
|
||||
bool SaveAllInspectMessages(const uint32 owner_id, const InspectMessage_Struct& inspect_message);
|
||||
bool DeleteAllInspectMessages(const uint32 owner_id);
|
||||
|
||||
bool SaveAllArmorColorBySlot(const uint32 owner_id, const int16 slot_id, const uint32 rgb_value);
|
||||
bool SaveAllArmorColors(const uint32 owner_id, const uint32 rgb_value);
|
||||
|
||||
bool SaveHelmAppearance(const uint32 owner_id, const uint32 bot_id, const bool show_flag = true);
|
||||
bool SaveAllHelmAppearances(const uint32 owner_id, const bool show_flag = true);
|
||||
|
||||
bool ToggleHelmAppearance(const uint32 owner_id, const uint32 bot_id);
|
||||
bool ToggleAllHelmAppearances(const uint32 owner_id);
|
||||
|
||||
bool SaveFollowDistance(const uint32 owner_id, const uint32 bot_id, const uint32 follow_distance);
|
||||
bool SaveAllFollowDistances(const uint32 owner_id, const uint32 follow_distance);
|
||||
|
||||
bool CreateCloneBot(const uint32 owner_id, const uint32 bot_id, const std::string& clone_name, uint32& clone_id);
|
||||
bool CreateCloneBotInventory(const uint32 owner_id, const uint32 bot_id, const uint32 clone_id);
|
||||
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag);
|
||||
|
||||
bool LoadBotGroupIDByBotGroupName(const std::string& botgroup_name, uint32& botgroup_id);
|
||||
bool LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgroup_id);
|
||||
bool LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgroup_id);
|
||||
|
||||
bool LoadLeaderIDByBotGroupName(const std::string& botgroup_name, uint32& leader_id);
|
||||
bool LoadLeaderIDByBotGroupID(const uint32 botgroup_id, uint32& leader_id);
|
||||
|
||||
bool LoadBotGroupNameByBotGroupID(const uint32 botgroup_id, std::string& botgroup_name);
|
||||
bool LoadBotGroupNameByLeaderID(const uint32 leader_id, std::string& botgroup_name);
|
||||
|
||||
bool CreateBotGroup(const std::string& botgroup_name, const uint32 leader_id);
|
||||
bool DeleteBotGroup(const uint32 leader_id);
|
||||
bool AddMemberToBotGroup(const uint32 leader_id, const uint32 member_id);
|
||||
bool RemoveMemberFromBotGroup(const uint32 member_id);
|
||||
|
||||
bool LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, const std::string& botgroup_name, uint32& botgroup_id);
|
||||
bool LoadBotGroup(const std::string& botgroup_name, std::map<uint32, std::list<uint32>>& member_list);
|
||||
|
||||
bool LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<std::pair<std::string, std::string>>& botgroups_list);
|
||||
|
||||
|
||||
/* Bot group functions */
|
||||
bool LoadGroupedBotsByGroupID(const uint32 group_id, std::list<uint32>& group_list);
|
||||
|
||||
|
||||
/* Bot miscellaneous functions */
|
||||
|
||||
|
||||
class fail {
|
||||
public:
|
||||
/* fail::Bot functions */
|
||||
static const char* QueryNameAvailablity();
|
||||
static const char* QueryBotCount();
|
||||
static const char* LoadQuestableSpawnCount();
|
||||
static const char* LoadBotsList();
|
||||
static const char* LoadOwnerID();
|
||||
static const char* LoadBotID();
|
||||
static const char* LoadBot();
|
||||
static const char* SaveNewBot();
|
||||
static const char* SaveBot();
|
||||
static const char* DeleteBot();
|
||||
static const char* LoadBuffs();
|
||||
static const char* SaveBuffs();
|
||||
static const char* DeleteBuffs();
|
||||
static const char* LoadStance();
|
||||
static const char* SaveStance();
|
||||
static const char* DeleteStance();
|
||||
static const char* LoadTimers();
|
||||
static const char* SaveTimers();
|
||||
static const char* DeleteTimers();
|
||||
static const char* LoadGuildMembership();
|
||||
static const char* SaveGuildMembership();
|
||||
static const char* DeleteGuildMembership();
|
||||
|
||||
/* fail::Bot inventory functions */
|
||||
static const char* QueryInventoryCount();
|
||||
static const char* LoadItems();
|
||||
static const char* SaveItems();
|
||||
static const char* DeleteItems();
|
||||
static const char* LoadItemBySlot();
|
||||
static const char* SaveItemBySlot();
|
||||
static const char* DeleteItemBySlot();
|
||||
static const char* LoadEquipmentColor();
|
||||
static const char* SaveEquipmentColor();
|
||||
|
||||
/* fail::Bot pet functions */
|
||||
static const char* LoadPetIndex();
|
||||
static const char* LoadPetSpellID();
|
||||
static const char* LoadPetStats();
|
||||
static const char* SavePetStats();
|
||||
static const char* DeletePetStats();
|
||||
static const char* LoadPetBuffs();
|
||||
static const char* SavePetBuffs();
|
||||
static const char* DeletePetBuffs();
|
||||
static const char* LoadPetItems();
|
||||
static const char* SavePetItems();
|
||||
static const char* DeletePetItems();
|
||||
|
||||
/* fail::Bot command functions */
|
||||
static const char* LoadInspectMessage();
|
||||
static const char* SaveInspectMessage();
|
||||
static const char* DeleteInspectMessage();
|
||||
static const char* SaveAllInspectMessages();
|
||||
static const char* DeleteAllInspectMessages();
|
||||
static const char* SaveAllArmorColorBySlot();
|
||||
static const char* SaveAllArmorColors();
|
||||
static const char* SaveHelmAppearance();
|
||||
static const char* SaveAllHelmAppearances();
|
||||
static const char* ToggleHelmAppearance();
|
||||
static const char* ToggleAllHelmAppearances();
|
||||
static const char* SaveFollowDistance();
|
||||
static const char* SaveAllFollowDistances();
|
||||
static const char* CreateCloneBot();
|
||||
static const char* CreateCloneBotInventory();
|
||||
|
||||
/* fail::Bot bot-group functions */
|
||||
static const char* QueryBotGroupExistence();
|
||||
static const char* LoadBotGroupIDByBotGroupName();
|
||||
static const char* LoadBotGroupIDByLeaderID();
|
||||
static const char* LoadBotGroupIDByMemberID();
|
||||
static const char* LoadLeaderIDByBotGroupName();
|
||||
static const char* LoadLeaderIDByBotGroupID();
|
||||
static const char* LoadBotGroupNameByBotGroupID();
|
||||
static const char* LoadBotGroupNameByLeaderID();
|
||||
static const char* CreateBotGroup();
|
||||
static const char* DeleteBotGroup();
|
||||
static const char* AddMemberToBotGroup();
|
||||
static const char* RemoveMemberFromBotGroup();
|
||||
static const char* LoadBotGroupIDForLoadBotGroup();
|
||||
static const char* LoadBotGroup();
|
||||
static const char* LoadBotGroupsListByOwnerID();
|
||||
|
||||
/* fail::Bot group functions */
|
||||
static const char* LoadGroupedBotsByGroupID();
|
||||
|
||||
/* fail::Bot miscellaneous functions */
|
||||
};
|
||||
|
||||
private:
|
||||
std::string query;
|
||||
};
|
||||
|
||||
extern BotDatabase botdb;
|
||||
|
||||
Reference in New Issue
Block a user