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;
}
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

View File

@ -54,63 +54,7 @@ const int MaxDisciplineTimer = 10;
const int DisciplineReuseStart = MaxSpellTimer + 1;
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
// pH positive Healer
@ -200,29 +144,35 @@ public:
BotRoleRaidHealer
};
enum EqExpansions { // expansions are off..EQ should be '0'
ExpansionNone,
ExpansionEQ,
ExpansionRoK,
ExpansionSoV,
ExpansionSoL,
ExpansionPoP,
ExpansionLoY,
ExpansionLDoN,
ExpansionGoD,
ExpansionOoW,
ExpansionDoN,
ExpansionDoDH,
ExpansionPoR,
ExpansionTSS,
ExpansionSoF,
ExpansionSoD,
ExpansionUF,
ExpansionHoT,
ExpansionVoA,
ExpansionRoF
enum SpellTypeIndex : uint32 {
spellTypeIndexNuke,
spellTypeIndexHeal,
spellTypeIndexRoot,
spellTypeIndexBuff,
spellTypeIndexEscape,
spellTypeIndexPet,
spellTypeIndexLifetap,
spellTypeIndexSnare,
spellTypeIndexDot,
spellTypeIndexDispel,
spellTypeIndexInCombatBuff,
spellTypeIndexMez,
spellTypeIndexCharm,
spellTypeIndexSlow,
spellTypeIndexDebuff,
spellTypeIndexCure,
spellTypeIndexResurrect,
spellTypeIndexHateRedux,
spellTypeIndexInCombatBuffSong,
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
Bot(NPCType *npcTypeData, Client* botOwner);
Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData);
@ -771,7 +721,7 @@ private:
bool DeletePet();
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

View File

@ -7230,7 +7230,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
inst = my_bot->CastToBot()->GetBotItem(i);
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;
}
@ -7240,7 +7240,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
}
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;
}
@ -7343,14 +7343,14 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
case EQEmu::invslot::slotWaist:
case EQEmu::invslot::slotPowerSource:
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;
case EQEmu::invslot::slotShoulders:
case EQEmu::invslot::slotArms:
case EQEmu::invslot::slotHands:
case EQEmu::invslot::slotLegs:
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;
default:
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();
window_text.append("<c \"#FFFFFF\">");
window_text.append(GetBotEquipSlotName(i));
window_text.append(EQEmu::invslot::GetInvPossessionsSlotName(i));
window_text.append(": ");
if (item) {
//window_text.append("</c>");

View File

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

View File

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