[Bots] Cleanup Bot Spell Functions, reduce reliance on NPC Functions/Attributes (#2495)

* [Bots] Initial Cleanup of Functions, moved Bot Casting out of mob_ai.cpp

* Moved Bots off NPC AI_Spells Struct, and AI_Spells private attribute.

* Formatting Fixes, fixed LogAI entries, Added LogAIModerate Alias

* Add Constants.

* Added Bot DB Struct, fixed some potential casting issues

* Formatting

* Formatting
This commit is contained in:
Aeadoin
2022-10-29 16:38:15 -04:00
committed by GitHub
parent 5708164511
commit bf43bda1e2
11 changed files with 610 additions and 122 deletions
+44
View File
@@ -107,6 +107,44 @@ struct DBnpcspellseffects_Struct {
DBnpcspellseffects_entries_Struct entries[0];
};
#pragma pack(1)
struct DBbotspells_entries_Struct {
uint16 spellid;
uint8 minlevel;
uint8 maxlevel;
uint32 type;
int16 manacost;
int16 priority;
int32 recast_delay;
int16 resist_adjust;
int8 min_hp;
int8 max_hp;
};
#pragma pack()
struct DBbotspells_Struct {
uint32 parent_list;
uint16 attack_proc;
uint8 proc_chance;
uint16 range_proc;
int16 rproc_chance;
uint16 defensive_proc;
int16 dproc_chance;
uint32 fail_recast;
uint32 engaged_no_sp_recast_min;
uint32 engaged_no_sp_recast_max;
uint8 engaged_beneficial_self_chance;
uint8 engaged_beneficial_other_chance;
uint8 engaged_detrimental_chance;
uint32 pursue_no_sp_recast_min;
uint32 pursue_no_sp_recast_max;
uint8 pursue_detrimental_chance;
uint32 idle_no_sp_recast_min;
uint32 idle_no_sp_recast_max;
uint8 idle_beneficial_chance;
std::vector<DBbotspells_entries_Struct> entries;
};
struct DBTradeskillRecipe_Struct {
EQ::skills::SkillType tradeskill;
int16 skill_needed;
@@ -491,6 +529,10 @@ public:
void ClearNPCSpells() { npc_spells_cache.clear(); npc_spells_loadtried.clear(); }
const NPCType* LoadNPCTypesData(uint32 id, bool bulk_load = false);
/*Bots */
DBbotspells_Struct* GetBotSpells(uint32 iDBSpellsID);
void ClearBotSpells() { Bot_Spells_Cache.clear(); Bot_Spells_LoadTried.clear(); }
/* Mercs */
const NPCType* GetMercType(uint32 id, uint16 raceid, uint32 clientlevel);
void LoadMercEquipment(Merc *merc);
@@ -595,6 +637,8 @@ protected:
std::unordered_set<uint32> npc_spells_loadtried;
DBnpcspellseffects_Struct** npc_spellseffects_cache;
bool* npc_spellseffects_loadtried;
std::unordered_map<uint32, DBbotspells_Struct> Bot_Spells_Cache;
std::unordered_set<uint32> Bot_Spells_LoadTried;
};
extern ZoneDatabase database;