bot movement cleanup and tweaks, move casterrange to distanceranged

This commit is contained in:
nytmyr
2024-11-07 16:34:20 -06:00
parent 1048cb78aa
commit e73f1259be
10 changed files with 76 additions and 130 deletions
@@ -209,18 +209,18 @@ INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, (SELECT bs.`stance_id` FROM b
INSERT INTO bot_settings SELECT NULL, 0, `bot_id`, (SELECT bs.`stance_id` FROM bot_stances bs WHERE bs.`bot_id` = bd.`bot_id`) AS stance_id, 5, 0, `archery_setting`, 'BaseSetting', 'RangedSetting' FROM bot_data WHERE `archery_setting` != 0;
INSERT INTO bot_settings
SELECT NULL, 0, `bot_id`, (SELECT bs.`stance_id` FROM bot_stances bs WHERE bs.`bot_id` = bd.`bot_id`) AS stance_id, 8, 0, `caster_range`, 'BaseSetting', 'CasterRange'
SELECT NULL, 0, `bot_id`, (SELECT bs.`stance_id` FROM bot_stances bs WHERE bs.`bot_id` = bd.`bot_id`) AS stance_id, 8, 0, `caster_range`, 'BaseSetting', 'DistanceRanged'
FROM (
SELECT `bot_id`,
(CASE
WHEN (`class` IN (1, 7, 19, 16)) THEN 0
WHEN `class` = 8 THEN 0
ELSE 90
END) AS `casterRange`,
END) AS `DistanceRanged`,
`caster_range`
FROM bot_data
) AS `subquery`
WHERE `casterRange` != `caster_range`;
WHERE `DistanceRanged` != `caster_range`;
ALTER TABLE `bot_data`
DROP COLUMN `show_helm`;
@@ -241,7 +241,7 @@ UPDATE `bot_command_settings` SET `aliases`= 'bh' WHERE `bot_command`='behindmob
UPDATE `bot_command_settings` SET `aliases`= 'bs|settings' WHERE `bot_command`='botsettings';
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|followdistance') ELSE 'followd||followdistance' END WHERE `bot_command`='botfollowdistance' AND `aliases` NOT LIKE '%followdistance%';
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|ranged|toggleranged|btr') ELSE 'ranged|toggleranged|btr' END WHERE `bot_command`='bottoggleranged' AND `aliases` NOT LIKE '%ranged|toggleranged|btr%';
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|cr') ELSE 'cr' END WHERE `bot_command`='casterrange' AND `aliases` NOT LIKE '%cr%';
UPDATE `bot_command_settings` SET `aliases`= 'distranged|dr' WHERE `bot_command`='distanceranged';
UPDATE `bot_command_settings` SET `aliases`= 'copy' WHERE `bot_command`='copysettings';
UPDATE `bot_command_settings` SET `aliases`= 'default' WHERE `bot_command`='defaultsettings';
UPDATE `bot_command_settings` SET `aliases`= CASE WHEN LENGTH(`aliases`) > 0 THEN CONCAT(`aliases`, '|enforce') ELSE 'enforce' END WHERE `bot_command`='enforcespellsettings' AND `aliases` NOT LIKE '%enforce%';
+2 -3
View File
@@ -839,15 +839,13 @@ RULE_BOOL(Bots, BotThrowingConsumesAmmo, true, "Set to false to disable Throwing
RULE_INT(Bots, StackSizeMin, 20, "20 Default. -1 to disable and use default max stack size. Minimum stack size to give a bot (Arrows/Throwing).")
RULE_INT(Bots, HasOrMayGetAggroThreshold, 90, "90 Default. Percent threshold of total hate where bots will stop casting spells that generate hate if they are set to try to not pull aggro via spells.")
RULE_BOOL(Bots, UseFlatNormalMeleeRange, false, "False Default. If true, bots melee distance will be a flat distance set by Bots:NormalMeleeRangeDistance.")
RULE_REAL(Bots, NormalMeleeRangeDistance, 0.75, "Multiplier of the max melee range at which a bot will stand in melee combat. 0.75 Recommended, max melee for all abilities to land.")
RULE_REAL(Bots, NormalMeleeRangeDistance, 0.75, "If UseFlatNormalMeleeRange is enabled, multiplier of the max melee range at which a bot will stand in melee combat. 0.75 Recommended, max melee for all abilities to land.")
RULE_REAL(Bots, PercentMinMeleeDistance, 0.60, "Multiplier of the max melee range - Minimum distance from target a bot will stand while in melee combat before trying to adjust. 0.60 Recommended.")
RULE_REAL(Bots, MaxDistanceForMelee, 20, "Maximum distance bots will stand for melee. Default 20 to allow all special attacks to land.")
RULE_REAL(Bots, TauntNormalMeleeRangeDistance, 0.50, "Multiplier of the max melee range at which a taunting bot will stand in melee combat. 0.50 Recommended, closer than others .")
RULE_REAL(Bots, PercentTauntMinMeleeDistance, 0.25, "Multiplier of max melee range - Minimum distance from target a taunting bot will stand while in melee combat before trying to adjust. 0.25 Recommended.")
RULE_REAL(Bots, PercentMaxMeleeRangeDistance, 0.95, "Multiplier of the max melee range at which a bot will stand in melee combat. 0.95 Recommended, max melee while disabling special attacks/taunt.")
RULE_REAL(Bots, PercentMinMaxMeleeRangeDistance, 0.75, "Multiplier of the closest max melee range at which a bot will stand in melee combat before trying to adjust. 0.75 Recommended, max melee while disabling special attacks/taunt.")
RULE_BOOL(Bots, CastersStayJustOutOfMeleeRange, true, "True Default. If true, caster bots will stay just out of melee range. Otherwise they use Bots:PercentMinCasterRangeDistance.")
RULE_REAL(Bots, PercentMinCasterRangeDistance, 0.60, "Multiplier of the closest caster range at which a bot will stand while casting before trying to adjust. 0.60 Recommended.")
RULE_BOOL(Bots, TauntingBotsFollowTopHate, true, "True Default. If true, bots that are taunting will attempt to stick with whoever currently is top hate.")
RULE_REAL(Bots, DistanceTauntingBotsStickMainHate, 25.00, "If TauntingBotsFollowTopHate is enabled, this is the distance bots will try to stick to whoever currently is Top Hate.")
RULE_BOOL(Bots, DisableSpecialAbilitiesAtMaxMelee, false, "False Default. If true, when bots are at max melee distance, special abilities including taunt will be disabled.")
@@ -875,6 +873,7 @@ RULE_BOOL(Bots, EnableBotTGB, true, "If enabled bots will cast group buffs as TG
RULE_BOOL(Bots, DoResponseAnimations, true, "If enabled bots will do animations to certain responses or commands.")
RULE_INT(Bots, DefaultFollowDistance, 20, "Default 20. Distance a bot will follow behind.")
RULE_INT(Bots, MaxFollowDistance, 300, "Default 300. Max distance a bot can be set to follow behind.")
RULE_INT(Bots, MaxDistanceRanged, 300, "Default 300. Max distance a bot can be set to ranged.")
RULE_CATEGORY_END()
RULE_CATEGORY(Chat)
+40 -87
View File
@@ -2151,8 +2151,9 @@ void Bot::AI_Process()
float melee_distance_min = 0.0f;
float melee_distance_max = 0.0f;
float melee_distance = 0.0f;
tar_distance = sqrt(tar_distance);
CheckCombatRange(tar, sqrt(tar_distance), atCombatRange, behindMob, p_item, s_item, melee_distance_min, melee_distance_max, melee_distance, stopMeleeLevel);
CheckCombatRange(tar, tar_distance, atCombatRange, behindMob, p_item, s_item, melee_distance_min, melee_distance, melee_distance_max, stopMeleeLevel);
// PULLING FLAG (ACTIONABLE RANGE)
@@ -2230,7 +2231,7 @@ void Bot::AI_Process()
return;
}
if (IsBotRanged() && ranged_timer.Check(false)) { // Can shoot mezzed, stunned and dead!?
if (IsBotRanged() && ranged_timer.Check(false)) {
TryRangedAttack(tar);
if (!TargetValidation(tar)) { return; }
@@ -2240,10 +2241,6 @@ void Bot::AI_Process()
}
}
else if (!IsBotRanged() && GetLevel() < stopMeleeLevel) {
if (tar->IsEnraged() && !BehindMob(tar, GetX(), GetY())) {
return;
}
if (!GetMaxMeleeRange() || !RuleB(Bots, DisableSpecialAbilitiesAtMaxMelee)) {
DoClassAttacks(tar);
}
@@ -2718,7 +2715,7 @@ bool Bot::TryEvade(Mob* tar) {
return false;
}
void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bool& behindMob, const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& s_item, float& melee_distance_min, float& melee_distance_max, float& melee_distance, uint8 stopMeleeLevel) {
void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bool& behindMob, const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& s_item, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stopMeleeLevel) {
atCombatRange= false;
p_item = GetBotItem(EQ::invslot::slotPrimary);
@@ -2734,16 +2731,16 @@ void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bo
}
// Calculate melee distances
CalcMeleeDistances(tar, p_item, s_item, behindMob, backstab_weapon, melee_distance_max, melee_distance, melee_distance_min, stopMeleeLevel);
CalcMeleeDistances(tar, p_item, s_item, behindMob, backstab_weapon, melee_distance_min, melee_distance, melee_distance_max, stopMeleeLevel);
//LogTestDebugDetail("{} is {} {}. They are currently {} away {} to be {} [{} - {}] away."
//LogTestDebugDetail("{} is {} {}. They are currently {} away {} to be between [{} - {}] away. MMR is {}."
// , GetCleanName()
// , (tar_distance <= melee_distance ? "within range of" : "too far away from")
// , (tar_distance < melee_distance_min ? "too close to" : (tar_distance <= melee_distance ? "within range of" : "too far away from"))
// , tar->GetCleanName()
// , tar_distance
// , (tar_distance <= melee_distance ? "but only needed" : "but need to be")
// , melee_distance
// , melee_distance_min
// , melee_distance
// , melee_distance_max
//); //deleteme
@@ -2752,16 +2749,14 @@ void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bo
}
}
void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& s_item, bool behindMob, bool backstab_weapon, float& melee_distance_max, float& melee_distance, float& melee_distance_min, uint8 stopMeleeLevel) {
void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& s_item, bool behindMob, bool backstab_weapon, float& melee_distance_min, float& melee_distance, float& melee_distance_max, uint8 stopMeleeLevel) {
float size_mod = GetSize();
float other_size_mod = tar->GetSize();
bool resquareDistance = false;
// For races with a fixed size
if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) {
// size_mod = 60.0f;
}
else if (size_mod < 6.0f) {
size_mod = 8.0f;
}
@@ -2770,7 +2765,6 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
if (tar->GetRace() == Race::LavaDragon || tar->GetRace() == Race::Wurm || tar->GetRace() == Race::GhostDragon) {
other_size_mod = 60.0f;
}
else if (other_size_mod < 6.0f) {
other_size_mod = 8.0f;
}
@@ -2782,11 +2776,9 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
if (size_mod > 29.0f) {
size_mod *= size_mod;
}
else if (size_mod > 19.0f) {
size_mod *= (size_mod * 2.0f);
}
else {
size_mod *= (size_mod * 4.0f);
}
@@ -2795,6 +2787,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
{
size_mod *= 1.75;
}
if (tar->GetRace() == Race::DragonSkeleton) // Dracoliche in Fear. Skeletal Dragon
{
size_mod *= 2.25;
@@ -2808,6 +2801,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
}
melee_distance_max = size_mod;
if (!RuleB(Bots, UseFlatNormalMeleeRange)) {
switch (GetClass()) {
case Class::Warrior:
@@ -2875,31 +2869,26 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
melee_distance = melee_distance_max * RuleR(Bots, TauntNormalMeleeRangeDistance);
}
if (!taunting && !IsBotRanged() && GetMaxMeleeRange()) {
bool isStopMeleeLevel = GetLevel() >= stopMeleeLevel;
if (!taunting && !IsBotRanged() && !isStopMeleeLevel && GetMaxMeleeRange()) {
melee_distance = melee_distance_max * RuleR(Bots, PercentMaxMeleeRangeDistance);
melee_distance_min = melee_distance_max * RuleR(Bots, PercentMinMaxMeleeRangeDistance);
}
/* Caster Range Checks */
bool isStopMeleeLevel = GetLevel() >= stopMeleeLevel;
if (isStopMeleeLevel) {
melee_distance = GetBotCasterMaxRange(melee_distance_max);
if (RuleB(Bots, CastersStayJustOutOfMeleeRange)) {
melee_distance_min = melee_distance_max + 1;
}
else {
melee_distance_min = melee_distance_max * RuleR(Bots, PercentMinCasterRangeDistance);
}
if (isStopMeleeLevel && !IsBotRanged()) {
float desiredRange = GetBotDistanceRanged();
melee_distance_min = std::min(melee_distance, (desiredRange / 2));
melee_distance = std::max((melee_distance + 1), desiredRange);
}
/* Archer Checks*/
if (IsBotRanged()) {
float archeryRange = GetBotRangedValue();
float casterRange = GetBotCasterRange();
float minArcheryRange = RuleI(Combat, MinRangedAttackDist);
melee_distance = std::min(archeryRange, (casterRange * 2));
melee_distance_min = std::max(std::max(minArcheryRange, (melee_distance_max + 1)), std::min(casterRange, archeryRange));
float minDistance = RuleI(Combat, MinRangedAttackDist);
float maxDistance = GetBotRangedValue();
float desiredRange = GetBotDistanceRanged();
melee_distance_min = std::max(minDistance, (desiredRange / 2));
melee_distance = std::min(maxDistance, desiredRange);
}
}
@@ -8480,29 +8469,6 @@ void Bot::SendSpellAnim(uint16 target_id, uint16 spell_id)
entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles));
}
float Bot::GetBotCasterMaxRange(float melee_distance_max) {// Calculate caster distances
float caster_distance_max = 0.0f;
float caster_distance_min = 0.0f;
float caster_distance = 0.0f;
caster_distance_max = GetBotCasterRange();
if (!GetBotCasterRange() && GetLevel() >= GetStopMeleeLevel() && GetClass() >= Class::Warrior && GetClass() <= Class::Berserker) {
caster_distance_max = GetDefaultBotBaseSetting(BotBaseSettings::CasterRange);
}
if (caster_distance_max) {
caster_distance_min = melee_distance_max;
if (caster_distance_max <= caster_distance_min) {
caster_distance_max = caster_distance_min * 1.25f;
}
}
return caster_distance_max;
}
int32 Bot::CalcItemATKCap()
{
return RuleI(Character, ItemATKCap) + itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap;
@@ -9972,8 +9938,8 @@ void Bot::SetBotBaseSetting(uint16 botSetting, int settingValue) {
case BotBaseSettings::BehindMob:
SetBehindMob(settingValue);
break;
case BotBaseSettings::CasterRange:
SetBotCasterRange(settingValue);
case BotBaseSettings::DistanceRanged:
SetBotDistanceRanged(settingValue);
break;
case BotBaseSettings::IllusionBlock:
SetIllusionBlock(settingValue);
@@ -10021,9 +9987,9 @@ int Bot::GetBotBaseSetting(uint16 botSetting) {
case BotBaseSettings::BehindMob:
//LogBotSettingsDetail("Returning current GetBehindMob of [{}] for [{}]", GetBehindMob(), GetCleanName()); //deleteme
return GetBehindMob();
case BotBaseSettings::CasterRange:
//LogBotSettingsDetail("Returning current GetBotCasterRange of [{}] for [{}]", GetBotCasterRange(), GetCleanName()); //deleteme
return GetBotCasterRange();
case BotBaseSettings::DistanceRanged:
//LogBotSettingsDetail("Returning current GetBotDistanceRanged of [{}] for [{}]", GetBotDistanceRanged(), GetCleanName()); //deleteme
return GetBotDistanceRanged();
case BotBaseSettings::IllusionBlock:
//LogBotSettingsDetail("Returning current GetIllusionBlock of [{}] for [{}]", GetIllusionBlock(), GetCleanName()); //deleteme
return GetIllusionBlock();
@@ -10070,7 +10036,7 @@ int Bot::GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance) {
else {
return false;
}
case BotBaseSettings::CasterRange:
case BotBaseSettings::DistanceRanged:
switch (GetClass()) {
case Class::Warrior:
case Class::Monk:
@@ -10707,8 +10673,8 @@ std::string Bot::GetBotSettingCategoryName(uint8 setting_type) {
return "PetSetTypeSetting";
case BotBaseSettings::BehindMob:
return "BehindMob";
case BotBaseSettings::CasterRange:
return "CasterRange";
case BotBaseSettings::DistanceRanged:
return "DistanceRanged";
case BotBaseSettings::IllusionBlock:
return "IllusionBlock";
case BotBaseSettings::MaxMeleeRange:
@@ -11026,7 +10992,7 @@ void Bot::SetCombatJitter() {
void Bot::DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, bool behindMob) {
if (HasTargetReflection()) {
if (!tar->IsFeared() && !tar->IsStunned()) {
if (!taunting && !tar->IsFeared() && !tar->IsStunned()) {
if (TryEvade(tar)) {
return;
}
@@ -11034,14 +11000,14 @@ void Bot::DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, flo
if (tar->IsRooted() && !taunting) { // Move non-taunters out of range - Above already checks if bot is targeted, otherwise they would stay
if (tar_distance <= melee_distance_max) {
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, (melee_distance_max + 1), (melee_distance_max * 2), false, false, true)) {
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, (melee_distance_max + 1), (melee_distance_max * 2), false, taunting)) {
RunToGoalWithJitter(Goal);
return;
}
}
}
if (taunting && tar_distance < melee_distance_min) { // Back up any taunting bots that are too close
if (taunting && tar_distance < melee_distance_min) { // Back up any bots that are too close
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, false, taunting)) {
RunToGoalWithJitter(Goal);
return;
@@ -11077,25 +11043,12 @@ void Bot::DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, flo
RunToGoalWithJitter(Goal);
return;
}
//else {
// if (stopMeleeLevel || IsBotArcher()) {
// if (IsBotArcher()) {
// float minArcheryRange = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist);
// if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, minArcheryRange, melee_distance, false, taunting)) {
// RunToGoalWithJitter(Goal);
// return;
// }
// }
// else {
// if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_max + 1, melee_distance, false, taunting)) {
// RunToGoalWithJitter(Goal);
// return;
// }
// }
// }
// DoFaceCheckWithJitter(tar);
// return;
//}
}
else if (tar->IsEnraged() && !taunting && !stopMeleeLevel && !behindMob) { // Move non-taunting melee bots behind target during enrage
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, true)) {
RunToGoalWithJitter(Goal);
return;
}
}
}
}
+7 -8
View File
@@ -136,7 +136,7 @@ namespace BotBaseSettings {
constexpr uint16 RangedSetting = 5;
constexpr uint16 PetSetTypeSetting = 6;
constexpr uint16 BehindMob = 7;
constexpr uint16 CasterRange = 8;
constexpr uint16 DistanceRanged = 8;
constexpr uint16 IllusionBlock = 9;
constexpr uint16 MaxMeleeRange = 10;
constexpr uint16 MedInCombat = 11;
@@ -506,8 +506,8 @@ public:
void SetMaxMeleeRange(bool value) { _maxMeleeRangeStatus = value; }
uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; }
void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; }
uint32 GetBotCasterRange() const { return _casterRange; }
void SetBotCasterRange(uint32 casterRange) { _casterRange = casterRange; }
uint32 GetBotDistanceRanged() const { return _distanceRanged; }
void SetBotDistanceRanged(uint32 distanceRanged) { _distanceRanged = distanceRanged; }
bool GetMedInCombat() const { return _medInCombat; }
void SetMedInCombat(bool value) { _medInCombat = value; }
uint8 GetHPWhenToMed() const { return _HPWhenToMed; }
@@ -640,7 +640,6 @@ public:
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
uint8 GetBotStance() { return _botStance; }
uint8 GetChanceToCastBySpellType(uint16 spellType);
float GetBotCasterMaxRange(float melee_distance_max);
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; }
@@ -929,9 +928,9 @@ public:
const EQ::ItemInstance* const& s_item,
bool behindMob,
bool backstab_weapon,
float& melee_distance_max,
float& melee_distance,
float& melee_distance_min,
float& melee_distance,
float& melee_distance_max,
uint8 stopMeleeLevel
);
@@ -947,8 +946,8 @@ public:
const EQ::ItemInstance*& p_item,
const EQ::ItemInstance*& s_item,
float& melee_distance_min,
float& melee_distance_max,
float& melee_distance,
float& melee_distance_max,
uint8 stopMeleeLevel
);
bool GetCombatJitterFlag() { return m_combat_jitter_flag; }
@@ -1065,7 +1064,7 @@ private:
bool _showHelm;
bool _botRangedSetting;
uint8 _stopMeleeLevel;
uint32 _casterRange;
uint32 _distanceRanged;
bool _behindMobStatus;
bool _maxMeleeRangeStatus;
bool _medInCombat;
+2 -2
View File
@@ -1285,7 +1285,7 @@ int bot_command_init(void)
bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", AccountStatus::Player, bot_command_update) ||
bot_command_add("botwoad", "Changes the Barbarian woad of a bot", AccountStatus::Player, bot_command_woad) ||
bot_command_add("cast", "Tells the first found specified bot to cast the given spell type", AccountStatus::Player, bot_command_cast) ||
bot_command_add("casterrange", "Controls the range casters will try to stay away from a mob (if too far, they will skip spells that are out-of-range)", AccountStatus::Player, bot_command_caster_range) ||
bot_command_add("distanceranged", "Controls the range casters and ranged will try to stay away from a mob", AccountStatus::Player, bot_command_distance_ranged) ||
bot_command_add("charm", "Attempts to have a bot charm your target", AccountStatus::Player, bot_command_charm) ||
bot_command_add("circle", "Orders a Druid bot to open a magical doorway to a specified destination", AccountStatus::Player, bot_command_circle) ||
bot_command_add("classracelist", "Lists the classes and races and their appropriate IDs", AccountStatus::Player, bot_command_class_race_list) ||
@@ -2256,7 +2256,6 @@ void Bot::SendSpellTypesWindow(Client* c, std::string arg0, std::string arg1, st
#include "bot_commands/bot.cpp"
#include "bot_commands/bot_settings.cpp"
#include "bot_commands/cast.cpp"
#include "bot_commands/caster_range.cpp"
#include "bot_commands/charm.cpp"
#include "bot_commands/class_race_list.cpp"
#include "bot_commands/click_item.cpp"
@@ -2265,6 +2264,7 @@ void Bot::SendSpellTypesWindow(Client* c, std::string arg0, std::string arg1, st
#include "bot_commands/default_settings.cpp"
#include "bot_commands/defensive.cpp"
#include "bot_commands/depart.cpp"
#include "bot_commands/distance_ranged.cpp"
#include "bot_commands/escape.cpp"
#include "bot_commands/find_aliases.cpp"
#include "bot_commands/follow.cpp"
+1 -1
View File
@@ -1673,7 +1673,7 @@ void bot_command_bind_affinity(Client *c, const Seperator *sep);
void bot_command_bot(Client *c, const Seperator *sep);
void bot_command_bot_settings(Client* c, const Seperator* sep);
void bot_command_cast(Client* c, const Seperator* sep);
void bot_command_caster_range(Client* c, const Seperator* sep);
void bot_command_distance_ranged(Client* c, const Seperator* sep);
void bot_command_charm(Client *c, const Seperator *sep);
void bot_command_class_race_list(Client* c, const Seperator* sep);
void bot_command_click_item(Client* c, const Seperator* sep);
+1 -1
View File
@@ -4,7 +4,7 @@ void bot_command_bot_settings(Client* c, const Seperator* sep)
{
std::list<const char*> subcommand_list;
subcommand_list.push_back("behindmob");
subcommand_list.push_back("casterrange");
subcommand_list.push_back("distanceranged");
subcommand_list.push_back("copysettings");
subcommand_list.push_back("defaultsettings");
subcommand_list.push_back("enforcespelllist");
+1 -1
View File
@@ -74,7 +74,7 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
"[misc] copies all miscellaneous options such as:",
"- ^showhelm, ^followd, ^stopmeleelevel",
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
"- ^behindmob, ^casterrange, ^illusionblock",
"- ^behindmob, ^distanceranged, ^illusionblock",
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
};
+1 -1
View File
@@ -68,7 +68,7 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
"[misc] restores all miscellaneous options such as:",
"- ^showhelm, ^followd, ^stopmeleelevel",
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
"- ^behindmob, ^casterrange, ^illusionblock",
"- ^behindmob, ^distanceranged, ^illusionblock",
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
};
@@ -1,14 +1,13 @@
#include "../bot_command.h"
void bot_command_caster_range(Client* c, const Seperator* sep)
void bot_command_distance_ranged(Client* c, const Seperator* sep)
{
if (helper_command_alias_fail(c, "bot_command_caster_range", sep->arg[0], "casterrange")) {
if (helper_command_alias_fail(c, "bot_command_distance_ranged", sep->arg[0], "distanceranged")) {
return;
}
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(Chat::White, "usage: %s [current | value: 0 - 300] ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | healrotationtargets | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0]);
c->Message(Chat::White, "note: Can only be used for Casters or Hybrids.");
c->Message(Chat::White, "note: Use [current] to check the current setting.");
c->Message(Chat::White, "note: Set the value to the minimum distance you want your bot to try to remain from its target.");
c->Message(Chat::White, "note: If they are too far for a spell, it will be skipped.");
@@ -21,13 +20,13 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
std::string arg1 = sep->arg[1];
int ab_arg = 1;
bool current_check = false;
uint32 crange = 0;
uint32 value = 0;
if (sep->IsNumber(1)) {
++ab_arg;
crange = atoi(sep->arg[1]);
if (crange < 0 || crange > 300) {
c->Message(Chat::White, "You must enter a value within the range of 0 - 300.");
value = atoi(sep->arg[1]);
if (value < 0 || value > RuleI(Bots, MaxDistanceRanged)) {
c->Message(Chat::Yellow, "You must enter a value within the range of 0 - 300.");
return;
}
}
@@ -36,7 +35,7 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
current_check = true;
}
else {
c->Message(Chat::White, "Incorrect argument, use %s help for a list of options.", sep->arg[0]);
c->Message(Chat::Yellow, "Incorrect argument, use %s help for a list of options.", sep->arg[0]);
return;
}
@@ -58,47 +57,43 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
int success_count = 0;
for (auto my_bot : sbl) {
if (!IsCasterClass(my_bot->GetClass()) && !IsHybridClass(my_bot->GetClass())) {
continue;
}
if (!first_found) {
first_found = my_bot;
}
if (current_check) {
c->Message(
Chat::White,
Chat::Green,
fmt::format(
"{} says, 'My current caster range is {}.'",
"{} says, 'My current Distance Ranged is {}.'",
my_bot->GetCleanName(),
my_bot->GetBotCasterRange()
my_bot->GetBotDistanceRanged()
).c_str()
);
}
else {
my_bot->SetBotCasterRange(crange);
my_bot->SetBotDistanceRanged(value);
++success_count;
}
}
if (!current_check) {
if (success_count == 1 && first_found) {
c->Message(
Chat::White,
Chat::Green,
fmt::format(
"{} says, 'My Caster Range was set to {}.'",
"{} says, 'My Distance Ranged was set to {}.'",
first_found->GetCleanName(),
crange
value
).c_str()
);
}
else {
c->Message(
Chat::White,
Chat::Green,
fmt::format(
"{} of your bots set their Caster Range to {}.",
"{} of your bots set their Distance Ranged to {}.",
success_count,
crange
value
).c_str()
);
}