Bot definition clean-up

This commit is contained in:
Uleat 2019-02-09 06:38:26 -05:00
parent bef849b5c1
commit 3bdd6c20a5
5 changed files with 61 additions and 111 deletions

View File

@ -9096,6 +9096,6 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
return saylink; return saylink;
} }
uint8 Bot::spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 }; uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
#endif #endif

View File

@ -54,63 +54,7 @@ const int MaxDisciplineTimer = 10;
const int DisciplineReuseStart = MaxSpellTimer + 1; const int DisciplineReuseStart = MaxSpellTimer + 1;
const int MaxTimer = MaxSpellTimer + MaxDisciplineTimer; const int MaxTimer = MaxSpellTimer + MaxDisciplineTimer;
#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::invslot::EQUIPMENT_BEGIN && x <= EQEmu::invslot::EQUIPMENT_END) ? (x) : (EQEmu::invslot::EQUIPMENT_COUNT))
static const std::string bot_equip_slot_name[EQEmu::invslot::EQUIPMENT_COUNT + 1] =
{
"Charm", // slotCharm
"Ear 1", // slotEar1
"Head", // slotHead
"Face", // slotFace
"Ear 2", // slotEar2
"Neck", // slotNeck
"Shoulders", // slotShoulders
"Arms", // slotArms
"Back", // slotBack
"Wrist 1", // slotWrist1
"Wrist 2", // slotWrist2
"Range", // slotRange
"Hands", // slotHands
"Primary", // slotPrimary
"Secondary", // slotSecondary
"Finger 1", // slotFinger1
"Finger 2", // slotFinger2
"Chest", // slotChest
"Legs", // slotLegs
"Feet", // slotFeet
"Waist", // slotWaist
"Power Source", // slotPowerSource
"Ammo", // slotAmmo
"Unknown"
};
static const char* GetBotEquipSlotName(int slot_id) { return bot_equip_slot_name[VALIDBOTEQUIPSLOT(slot_id)].c_str(); }
enum SpellTypeIndex {
SpellType_NukeIndex,
SpellType_HealIndex,
SpellType_RootIndex,
SpellType_BuffIndex,
SpellType_EscapeIndex,
SpellType_PetIndex,
SpellType_LifetapIndex,
SpellType_SnareIndex,
SpellType_DOTIndex,
SpellType_DispelIndex,
SpellType_InCombatBuffIndex,
SpellType_MezIndex,
SpellType_CharmIndex,
SpellType_SlowIndex,
SpellType_DebuffIndex,
SpellType_CureIndex,
SpellType_ResurrectIndex,
SpellType_HateReduxIndex,
SpellType_InCombatBuffSongIndex,
SpellType_OutOfCombatBuffSongIndex,
SpellType_PreCombatBuffIndex,
SpellType_PreCombatBuffSongIndex,
MaxSpellTypes
};
// nHSND negative Healer/Slower/Nuker/Doter // nHSND negative Healer/Slower/Nuker/Doter
// pH positive Healer // pH positive Healer
@ -200,29 +144,35 @@ public:
BotRoleRaidHealer BotRoleRaidHealer
}; };
enum EqExpansions { // expansions are off..EQ should be '0' enum SpellTypeIndex : uint32 {
ExpansionNone, spellTypeIndexNuke,
ExpansionEQ, spellTypeIndexHeal,
ExpansionRoK, spellTypeIndexRoot,
ExpansionSoV, spellTypeIndexBuff,
ExpansionSoL, spellTypeIndexEscape,
ExpansionPoP, spellTypeIndexPet,
ExpansionLoY, spellTypeIndexLifetap,
ExpansionLDoN, spellTypeIndexSnare,
ExpansionGoD, spellTypeIndexDot,
ExpansionOoW, spellTypeIndexDispel,
ExpansionDoN, spellTypeIndexInCombatBuff,
ExpansionDoDH, spellTypeIndexMez,
ExpansionPoR, spellTypeIndexCharm,
ExpansionTSS, spellTypeIndexSlow,
ExpansionSoF, spellTypeIndexDebuff,
ExpansionSoD, spellTypeIndexCure,
ExpansionUF, spellTypeIndexResurrect,
ExpansionHoT, spellTypeIndexHateRedux,
ExpansionVoA, spellTypeIndexInCombatBuffSong,
ExpansionRoF spellTypeIndexOutOfCombatBuffSong,
spellTypeIndexPreCombatBuff,
spellTypeIndexPreCombatBuffSong
}; };
static const uint32 SPELL_TYPE_FIRST = spellTypeIndexNuke;
static const uint32 SPELL_TYPE_LAST = spellTypeIndexPreCombatBuffSong;
static const uint32 SPELL_TYPE_COUNT = SPELL_TYPE_LAST + 1;
// Class Constructors // Class Constructors
Bot(NPCType *npcTypeData, Client* botOwner); Bot(NPCType *npcTypeData, Client* botOwner);
Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData); Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData);
@ -771,7 +721,7 @@ private:
bool DeletePet(); bool DeletePet();
public: public:
static uint8 spell_casting_chances[MaxSpellTypes][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND]; static uint8 spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND];
}; };
#endif // BOTS #endif // BOTS

View File

@ -7230,7 +7230,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
inst = my_bot->CastToBot()->GetBotItem(i); inst = my_bot->CastToBot()->GetBotItem(i);
if (!inst || !inst->GetItem()) { if (!inst || !inst->GetItem()) {
c->Message(m_message, "I need something for my %s (slot %i)", GetBotEquipSlotName(i), i); c->Message(m_message, "I need something for my %s (slot %i)", EQEmu::invslot::GetInvPossessionsSlotName(i), i);
continue; continue;
} }
@ -7240,7 +7240,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
} }
linker.SetItemInst(inst); linker.SetItemInst(inst);
c->Message(m_message, "Using %s in my %s (slot %i)", linker.GenerateLink().c_str(), GetBotEquipSlotName(i), i); c->Message(m_message, "Using %s in my %s (slot %i)", linker.GenerateLink().c_str(), EQEmu::invslot::GetInvPossessionsSlotName(i), i);
++inventory_count; ++inventory_count;
} }
@ -7343,14 +7343,14 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
case EQEmu::invslot::slotWaist: case EQEmu::invslot::slotWaist:
case EQEmu::invslot::slotPowerSource: case EQEmu::invslot::slotPowerSource:
case EQEmu::invslot::slotAmmo: case EQEmu::invslot::slotAmmo:
c->Message(m_message, "My %s is %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); c->Message(m_message, "My %s is %s unequipped", EQEmu::invslot::GetInvPossessionsSlotName(slotId), ((itm) ? ("now") : ("already")));
break; break;
case EQEmu::invslot::slotShoulders: case EQEmu::invslot::slotShoulders:
case EQEmu::invslot::slotArms: case EQEmu::invslot::slotArms:
case EQEmu::invslot::slotHands: case EQEmu::invslot::slotHands:
case EQEmu::invslot::slotLegs: case EQEmu::invslot::slotLegs:
case EQEmu::invslot::slotFeet: case EQEmu::invslot::slotFeet:
c->Message(m_message, "My %s are %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); c->Message(m_message, "My %s are %s unequipped", EQEmu::invslot::GetInvPossessionsSlotName(slotId), ((itm) ? ("now") : ("already")));
break; break;
default: default:
c->Message(m_fail, "I'm soo confused..."); c->Message(m_fail, "I'm soo confused...");
@ -7393,7 +7393,7 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep)
item = inst->GetItem(); item = inst->GetItem();
window_text.append("<c \"#FFFFFF\">"); window_text.append("<c \"#FFFFFF\">");
window_text.append(GetBotEquipSlotName(i)); window_text.append(EQEmu::invslot::GetInvPossessionsSlotName(i));
window_text.append(": "); window_text.append(": ");
if (item) { if (item) {
//window_text.append("</c>"); //window_text.append("</c>");

View File

@ -115,7 +115,7 @@ bool BotDatabase::LoadBotSpellCastingChances()
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
uint8 spell_type_index = atoi(row[0]); uint8 spell_type_index = atoi(row[0]);
if (spell_type_index >= MaxSpellTypes) if (spell_type_index >= Bot::SPELL_TYPE_COUNT)
continue; continue;
uint8 class_index = atoi(row[1]); uint8 class_index = atoi(row[1]);
if (class_index < WARRIOR || class_index > BERSERKER) if (class_index < WARRIOR || class_index > BERSERKER)
@ -2849,7 +2849,7 @@ bool BotDatabase::DeleteAllHealRotations(const uint32 owner_id)
/* Bot miscellaneous functions */ /* Bot miscellaneous functions */
uint8 BotDatabase::GetSpellCastingChance(uint8 spell_type_index, uint8 class_index, uint8 stance_index, uint8 conditional_index) // class_index is 0-based uint8 BotDatabase::GetSpellCastingChance(uint8 spell_type_index, uint8 class_index, uint8 stance_index, uint8 conditional_index) // class_index is 0-based
{ {
if (spell_type_index >= MaxSpellTypes) if (spell_type_index >= Bot::SPELL_TYPE_COUNT)
return 0; return 0;
if (class_index >= PLAYER_CLASS_COUNT) if (class_index >= PLAYER_CLASS_COUNT)
return 0; return 0;

View File

@ -2570,79 +2570,79 @@ bool Bot::CheckDisciplineRecastTimers(Bot *caster, int timer_index) {
uint8 Bot::GetChanceToCastBySpellType(uint32 spellType) uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
{ {
uint8 spell_type_index = MaxSpellTypes; uint8 spell_type_index = SPELL_TYPE_COUNT;
switch (spellType) { switch (spellType) {
case SpellType_Nuke: case SpellType_Nuke:
spell_type_index = SpellType_NukeIndex; spell_type_index = spellTypeIndexNuke;
break; break;
case SpellType_Heal: case SpellType_Heal:
spell_type_index = SpellType_HealIndex; spell_type_index = spellTypeIndexHeal;
break; break;
case SpellType_Root: case SpellType_Root:
spell_type_index = SpellType_RootIndex; spell_type_index = spellTypeIndexRoot;
break; break;
case SpellType_Buff: case SpellType_Buff:
spell_type_index = SpellType_BuffIndex; spell_type_index = spellTypeIndexBuff;
break; break;
case SpellType_Escape: case SpellType_Escape:
spell_type_index = SpellType_EscapeIndex; spell_type_index = spellTypeIndexEscape;
break; break;
case SpellType_Pet: case SpellType_Pet:
spell_type_index = SpellType_PetIndex; spell_type_index = spellTypeIndexPet;
break; break;
case SpellType_Lifetap: case SpellType_Lifetap:
spell_type_index = SpellType_LifetapIndex; spell_type_index = spellTypeIndexLifetap;
break; break;
case SpellType_Snare: case SpellType_Snare:
spell_type_index = SpellType_SnareIndex; spell_type_index = spellTypeIndexSnare;
break; break;
case SpellType_DOT: case SpellType_DOT:
spell_type_index = SpellType_DOTIndex; spell_type_index = spellTypeIndexDot;
break; break;
case SpellType_Dispel: case SpellType_Dispel:
spell_type_index = SpellType_DispelIndex; spell_type_index = spellTypeIndexDispel;
break; break;
case SpellType_InCombatBuff: case SpellType_InCombatBuff:
spell_type_index = SpellType_InCombatBuffIndex; spell_type_index = spellTypeIndexInCombatBuff;
break; break;
case SpellType_Mez: case SpellType_Mez:
spell_type_index = SpellType_MezIndex; spell_type_index = spellTypeIndexMez;
break; break;
case SpellType_Charm: case SpellType_Charm:
spell_type_index = SpellType_CharmIndex; spell_type_index = spellTypeIndexCharm;
break; break;
case SpellType_Slow: case SpellType_Slow:
spell_type_index = SpellType_SlowIndex; spell_type_index = spellTypeIndexSlow;
break; break;
case SpellType_Debuff: case SpellType_Debuff:
spell_type_index = SpellType_DebuffIndex; spell_type_index = spellTypeIndexDebuff;
break; break;
case SpellType_Cure: case SpellType_Cure:
spell_type_index = SpellType_CureIndex; spell_type_index = spellTypeIndexCure;
break; break;
case SpellType_Resurrect: case SpellType_Resurrect:
spell_type_index = SpellType_ResurrectIndex; spell_type_index = spellTypeIndexResurrect;
break; break;
case SpellType_HateRedux: case SpellType_HateRedux:
spell_type_index = SpellType_HateReduxIndex; spell_type_index = spellTypeIndexHateRedux;
break; break;
case SpellType_InCombatBuffSong: case SpellType_InCombatBuffSong:
spell_type_index = SpellType_InCombatBuffSongIndex; spell_type_index = spellTypeIndexInCombatBuffSong;
break; break;
case SpellType_OutOfCombatBuffSong: case SpellType_OutOfCombatBuffSong:
spell_type_index = SpellType_OutOfCombatBuffSongIndex; spell_type_index = spellTypeIndexOutOfCombatBuffSong;
break; break;
case SpellType_PreCombatBuff: case SpellType_PreCombatBuff:
spell_type_index = SpellType_PreCombatBuffIndex; spell_type_index = spellTypeIndexPreCombatBuff;
break; break;
case SpellType_PreCombatBuffSong: case SpellType_PreCombatBuffSong:
spell_type_index = SpellType_PreCombatBuffSongIndex; spell_type_index = spellTypeIndexPreCombatBuffSong;
break; break;
default: default:
spell_type_index = MaxSpellTypes; spell_type_index = SPELL_TYPE_COUNT;
break; break;
} }
if (spell_type_index >= MaxSpellTypes) if (spell_type_index >= SPELL_TYPE_COUNT)
return 0; return 0;
uint8 class_index = GetClass(); uint8 class_index = GetClass();