mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-26 11:27:17 +00:00
bot movement cleanup and tweaks, move casterrange to distanceranged
This commit is contained in:
@@ -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, 5, 0, `archery_setting`, 'BaseSetting', 'RangedSetting' FROM bot_data WHERE `archery_setting` != 0;
|
||||||
|
|
||||||
INSERT INTO bot_settings
|
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 (
|
FROM (
|
||||||
SELECT `bot_id`,
|
SELECT `bot_id`,
|
||||||
(CASE
|
(CASE
|
||||||
WHEN (`class` IN (1, 7, 19, 16)) THEN 0
|
WHEN (`class` IN (1, 7, 19, 16)) THEN 0
|
||||||
WHEN `class` = 8 THEN 0
|
WHEN `class` = 8 THEN 0
|
||||||
ELSE 90
|
ELSE 90
|
||||||
END) AS `casterRange`,
|
END) AS `DistanceRanged`,
|
||||||
`caster_range`
|
`caster_range`
|
||||||
FROM bot_data
|
FROM bot_data
|
||||||
) AS `subquery`
|
) AS `subquery`
|
||||||
WHERE `casterRange` != `caster_range`;
|
WHERE `DistanceRanged` != `caster_range`;
|
||||||
|
|
||||||
ALTER TABLE `bot_data`
|
ALTER TABLE `bot_data`
|
||||||
DROP COLUMN `show_helm`;
|
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`= '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`, '|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`, '|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`= 'copy' WHERE `bot_command`='copysettings';
|
||||||
UPDATE `bot_command_settings` SET `aliases`= 'default' WHERE `bot_command`='defaultsettings';
|
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%';
|
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
@@ -833,15 +833,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, 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_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_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, 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, 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, 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, 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, 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_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_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_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.")
|
RULE_BOOL(Bots, DisableSpecialAbilitiesAtMaxMelee, false, "False Default. If true, when bots are at max melee distance, special abilities including taunt will be disabled.")
|
||||||
@@ -869,6 +867,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_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, 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, 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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Chat)
|
RULE_CATEGORY(Chat)
|
||||||
|
|||||||
+40
-87
@@ -2148,8 +2148,9 @@ void Bot::AI_Process()
|
|||||||
float melee_distance_min = 0.0f;
|
float melee_distance_min = 0.0f;
|
||||||
float melee_distance_max = 0.0f;
|
float melee_distance_max = 0.0f;
|
||||||
float melee_distance = 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)
|
// PULLING FLAG (ACTIONABLE RANGE)
|
||||||
|
|
||||||
@@ -2227,7 +2228,7 @@ void Bot::AI_Process()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsBotRanged() && ranged_timer.Check(false)) { // Can shoot mezzed, stunned and dead!?
|
if (IsBotRanged() && ranged_timer.Check(false)) {
|
||||||
TryRangedAttack(tar);
|
TryRangedAttack(tar);
|
||||||
|
|
||||||
if (!TargetValidation(tar)) { return; }
|
if (!TargetValidation(tar)) { return; }
|
||||||
@@ -2237,10 +2238,6 @@ void Bot::AI_Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!IsBotRanged() && GetLevel() < stopMeleeLevel) {
|
else if (!IsBotRanged() && GetLevel() < stopMeleeLevel) {
|
||||||
if (tar->IsEnraged() && !BehindMob(tar, GetX(), GetY())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GetMaxMeleeRange() || !RuleB(Bots, DisableSpecialAbilitiesAtMaxMelee)) {
|
if (!GetMaxMeleeRange() || !RuleB(Bots, DisableSpecialAbilitiesAtMaxMelee)) {
|
||||||
DoClassAttacks(tar);
|
DoClassAttacks(tar);
|
||||||
}
|
}
|
||||||
@@ -2715,7 +2712,7 @@ bool Bot::TryEvade(Mob* tar) {
|
|||||||
return false;
|
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;
|
atCombatRange= false;
|
||||||
|
|
||||||
p_item = GetBotItem(EQ::invslot::slotPrimary);
|
p_item = GetBotItem(EQ::invslot::slotPrimary);
|
||||||
@@ -2731,16 +2728,16 @@ void Bot::CheckCombatRange(Mob* tar, float tar_distance, bool& atCombatRange, bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate melee distances
|
// 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()
|
// , 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->GetCleanName()
|
||||||
// , tar_distance
|
// , tar_distance
|
||||||
// , (tar_distance <= melee_distance ? "but only needed" : "but need to be")
|
// , (tar_distance <= melee_distance ? "but only needed" : "but need to be")
|
||||||
// , melee_distance
|
|
||||||
// , melee_distance_min
|
// , melee_distance_min
|
||||||
|
// , melee_distance
|
||||||
// , melee_distance_max
|
// , melee_distance_max
|
||||||
//); //deleteme
|
//); //deleteme
|
||||||
|
|
||||||
@@ -2749,16 +2746,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 size_mod = GetSize();
|
||||||
float other_size_mod = tar->GetSize();
|
float other_size_mod = tar->GetSize();
|
||||||
bool resquareDistance = false;
|
|
||||||
|
|
||||||
// For races with a fixed size
|
// For races with a fixed size
|
||||||
if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) {
|
if (GetRace() == Race::LavaDragon || GetRace() == Race::Wurm || GetRace() == Race::GhostDragon) {
|
||||||
// size_mod = 60.0f;
|
// size_mod = 60.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (size_mod < 6.0f) {
|
else if (size_mod < 6.0f) {
|
||||||
size_mod = 8.0f;
|
size_mod = 8.0f;
|
||||||
}
|
}
|
||||||
@@ -2767,7 +2762,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) {
|
if (tar->GetRace() == Race::LavaDragon || tar->GetRace() == Race::Wurm || tar->GetRace() == Race::GhostDragon) {
|
||||||
other_size_mod = 60.0f;
|
other_size_mod = 60.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (other_size_mod < 6.0f) {
|
else if (other_size_mod < 6.0f) {
|
||||||
other_size_mod = 8.0f;
|
other_size_mod = 8.0f;
|
||||||
}
|
}
|
||||||
@@ -2779,11 +2773,9 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
|
|||||||
if (size_mod > 29.0f) {
|
if (size_mod > 29.0f) {
|
||||||
size_mod *= size_mod;
|
size_mod *= size_mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (size_mod > 19.0f) {
|
else if (size_mod > 19.0f) {
|
||||||
size_mod *= (size_mod * 2.0f);
|
size_mod *= (size_mod * 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
size_mod *= (size_mod * 4.0f);
|
size_mod *= (size_mod * 4.0f);
|
||||||
}
|
}
|
||||||
@@ -2792,6 +2784,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
|
|||||||
{
|
{
|
||||||
size_mod *= 1.75;
|
size_mod *= 1.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tar->GetRace() == Race::DragonSkeleton) // Dracoliche in Fear. Skeletal Dragon
|
if (tar->GetRace() == Race::DragonSkeleton) // Dracoliche in Fear. Skeletal Dragon
|
||||||
{
|
{
|
||||||
size_mod *= 2.25;
|
size_mod *= 2.25;
|
||||||
@@ -2805,6 +2798,7 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
|
|||||||
}
|
}
|
||||||
|
|
||||||
melee_distance_max = size_mod;
|
melee_distance_max = size_mod;
|
||||||
|
|
||||||
if (!RuleB(Bots, UseFlatNormalMeleeRange)) {
|
if (!RuleB(Bots, UseFlatNormalMeleeRange)) {
|
||||||
switch (GetClass()) {
|
switch (GetClass()) {
|
||||||
case Class::Warrior:
|
case Class::Warrior:
|
||||||
@@ -2872,31 +2866,26 @@ void Bot::CalcMeleeDistances(const Mob* tar, const EQ::ItemInstance* const& p_it
|
|||||||
melee_distance = melee_distance_max * RuleR(Bots, TauntNormalMeleeRangeDistance);
|
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 = melee_distance_max * RuleR(Bots, PercentMaxMeleeRangeDistance);
|
||||||
melee_distance_min = melee_distance_max * RuleR(Bots, PercentMinMaxMeleeRangeDistance);
|
melee_distance_min = melee_distance_max * RuleR(Bots, PercentMinMaxMeleeRangeDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isStopMeleeLevel && !IsBotRanged()) {
|
||||||
/* Caster Range Checks */
|
float desiredRange = GetBotDistanceRanged();
|
||||||
bool isStopMeleeLevel = GetLevel() >= stopMeleeLevel;
|
melee_distance_min = std::min(melee_distance, (desiredRange / 2));
|
||||||
if (isStopMeleeLevel) {
|
melee_distance = std::max((melee_distance + 1), desiredRange);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Archer Checks*/
|
/* Archer Checks*/
|
||||||
if (IsBotRanged()) {
|
if (IsBotRanged()) {
|
||||||
float archeryRange = GetBotRangedValue();
|
float minDistance = RuleI(Combat, MinRangedAttackDist);
|
||||||
float casterRange = GetBotCasterRange();
|
float maxDistance = GetBotRangedValue();
|
||||||
float minArcheryRange = RuleI(Combat, MinRangedAttackDist);
|
float desiredRange = GetBotDistanceRanged();
|
||||||
melee_distance = std::min(archeryRange, (casterRange * 2));
|
melee_distance_min = std::max(minDistance, (desiredRange / 2));
|
||||||
melee_distance_min = std::max(std::max(minArcheryRange, (melee_distance_max + 1)), std::min(casterRange, archeryRange));
|
melee_distance = std::min(maxDistance, desiredRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8490,29 +8479,6 @@ void Bot::SendSpellAnim(uint16 target_id, uint16 spell_id)
|
|||||||
entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles));
|
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()
|
int32 Bot::CalcItemATKCap()
|
||||||
{
|
{
|
||||||
return RuleI(Character, ItemATKCap) + itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap;
|
return RuleI(Character, ItemATKCap) + itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap;
|
||||||
@@ -9982,8 +9948,8 @@ void Bot::SetBotBaseSetting(uint16 botSetting, int settingValue) {
|
|||||||
case BotBaseSettings::BehindMob:
|
case BotBaseSettings::BehindMob:
|
||||||
SetBehindMob(settingValue);
|
SetBehindMob(settingValue);
|
||||||
break;
|
break;
|
||||||
case BotBaseSettings::CasterRange:
|
case BotBaseSettings::DistanceRanged:
|
||||||
SetBotCasterRange(settingValue);
|
SetBotDistanceRanged(settingValue);
|
||||||
break;
|
break;
|
||||||
case BotBaseSettings::IllusionBlock:
|
case BotBaseSettings::IllusionBlock:
|
||||||
SetIllusionBlock(settingValue);
|
SetIllusionBlock(settingValue);
|
||||||
@@ -10031,9 +9997,9 @@ int Bot::GetBotBaseSetting(uint16 botSetting) {
|
|||||||
case BotBaseSettings::BehindMob:
|
case BotBaseSettings::BehindMob:
|
||||||
//LogBotSettingsDetail("Returning current GetBehindMob of [{}] for [{}]", GetBehindMob(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetBehindMob of [{}] for [{}]", GetBehindMob(), GetCleanName()); //deleteme
|
||||||
return GetBehindMob();
|
return GetBehindMob();
|
||||||
case BotBaseSettings::CasterRange:
|
case BotBaseSettings::DistanceRanged:
|
||||||
//LogBotSettingsDetail("Returning current GetBotCasterRange of [{}] for [{}]", GetBotCasterRange(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetBotDistanceRanged of [{}] for [{}]", GetBotDistanceRanged(), GetCleanName()); //deleteme
|
||||||
return GetBotCasterRange();
|
return GetBotDistanceRanged();
|
||||||
case BotBaseSettings::IllusionBlock:
|
case BotBaseSettings::IllusionBlock:
|
||||||
//LogBotSettingsDetail("Returning current GetIllusionBlock of [{}] for [{}]", GetIllusionBlock(), GetCleanName()); //deleteme
|
//LogBotSettingsDetail("Returning current GetIllusionBlock of [{}] for [{}]", GetIllusionBlock(), GetCleanName()); //deleteme
|
||||||
return GetIllusionBlock();
|
return GetIllusionBlock();
|
||||||
@@ -10080,7 +10046,7 @@ int Bot::GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance) {
|
|||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case BotBaseSettings::CasterRange:
|
case BotBaseSettings::DistanceRanged:
|
||||||
switch (GetClass()) {
|
switch (GetClass()) {
|
||||||
case Class::Warrior:
|
case Class::Warrior:
|
||||||
case Class::Monk:
|
case Class::Monk:
|
||||||
@@ -10717,8 +10683,8 @@ std::string Bot::GetBotSettingCategoryName(uint8 setting_type) {
|
|||||||
return "PetSetTypeSetting";
|
return "PetSetTypeSetting";
|
||||||
case BotBaseSettings::BehindMob:
|
case BotBaseSettings::BehindMob:
|
||||||
return "BehindMob";
|
return "BehindMob";
|
||||||
case BotBaseSettings::CasterRange:
|
case BotBaseSettings::DistanceRanged:
|
||||||
return "CasterRange";
|
return "DistanceRanged";
|
||||||
case BotBaseSettings::IllusionBlock:
|
case BotBaseSettings::IllusionBlock:
|
||||||
return "IllusionBlock";
|
return "IllusionBlock";
|
||||||
case BotBaseSettings::MaxMeleeRange:
|
case BotBaseSettings::MaxMeleeRange:
|
||||||
@@ -11036,7 +11002,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) {
|
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 (HasTargetReflection()) {
|
||||||
if (!tar->IsFeared() && !tar->IsStunned()) {
|
if (!taunting && !tar->IsFeared() && !tar->IsStunned()) {
|
||||||
if (TryEvade(tar)) {
|
if (TryEvade(tar)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -11044,14 +11010,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->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 (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);
|
RunToGoalWithJitter(Goal);
|
||||||
return;
|
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)) {
|
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, false, taunting)) {
|
||||||
RunToGoalWithJitter(Goal);
|
RunToGoalWithJitter(Goal);
|
||||||
return;
|
return;
|
||||||
@@ -11087,25 +11053,12 @@ void Bot::DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, flo
|
|||||||
RunToGoalWithJitter(Goal);
|
RunToGoalWithJitter(Goal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//else {
|
}
|
||||||
// if (stopMeleeLevel || IsBotArcher()) {
|
else if (tar->IsEnraged() && !taunting && !stopMeleeLevel && !behindMob) { // Move non-taunting melee bots behind target during enrage
|
||||||
// if (IsBotArcher()) {
|
if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, melee_distance_min, melee_distance, true)) {
|
||||||
// float minArcheryRange = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist);
|
RunToGoalWithJitter(Goal);
|
||||||
// if (PlotBotPositionAroundTarget(tar, Goal.x, Goal.y, Goal.z, minArcheryRange, melee_distance, false, taunting)) {
|
return;
|
||||||
// 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;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-8
@@ -136,7 +136,7 @@ namespace BotBaseSettings {
|
|||||||
constexpr uint16 RangedSetting = 5;
|
constexpr uint16 RangedSetting = 5;
|
||||||
constexpr uint16 PetSetTypeSetting = 6;
|
constexpr uint16 PetSetTypeSetting = 6;
|
||||||
constexpr uint16 BehindMob = 7;
|
constexpr uint16 BehindMob = 7;
|
||||||
constexpr uint16 CasterRange = 8;
|
constexpr uint16 DistanceRanged = 8;
|
||||||
constexpr uint16 IllusionBlock = 9;
|
constexpr uint16 IllusionBlock = 9;
|
||||||
constexpr uint16 MaxMeleeRange = 10;
|
constexpr uint16 MaxMeleeRange = 10;
|
||||||
constexpr uint16 MedInCombat = 11;
|
constexpr uint16 MedInCombat = 11;
|
||||||
@@ -506,8 +506,8 @@ public:
|
|||||||
void SetMaxMeleeRange(bool value) { _maxMeleeRangeStatus = value; }
|
void SetMaxMeleeRange(bool value) { _maxMeleeRangeStatus = value; }
|
||||||
uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; }
|
uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; }
|
||||||
void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; }
|
void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; }
|
||||||
uint32 GetBotCasterRange() const { return _casterRange; }
|
uint32 GetBotDistanceRanged() const { return _distanceRanged; }
|
||||||
void SetBotCasterRange(uint32 casterRange) { _casterRange = casterRange; }
|
void SetBotDistanceRanged(uint32 distanceRanged) { _distanceRanged = distanceRanged; }
|
||||||
bool GetMedInCombat() const { return _medInCombat; }
|
bool GetMedInCombat() const { return _medInCombat; }
|
||||||
void SetMedInCombat(bool value) { _medInCombat = value; }
|
void SetMedInCombat(bool value) { _medInCombat = value; }
|
||||||
uint8 GetHPWhenToMed() const { return _HPWhenToMed; }
|
uint8 GetHPWhenToMed() const { return _HPWhenToMed; }
|
||||||
@@ -640,7 +640,6 @@ public:
|
|||||||
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
|
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
|
||||||
uint8 GetBotStance() { return _botStance; }
|
uint8 GetBotStance() { return _botStance; }
|
||||||
uint8 GetChanceToCastBySpellType(uint16 spellType);
|
uint8 GetChanceToCastBySpellType(uint16 spellType);
|
||||||
float GetBotCasterMaxRange(float melee_distance_max);
|
|
||||||
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
|
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
|
||||||
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
|
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
|
||||||
bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; }
|
bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; }
|
||||||
@@ -929,9 +928,9 @@ public:
|
|||||||
const EQ::ItemInstance* const& s_item,
|
const EQ::ItemInstance* const& s_item,
|
||||||
bool behindMob,
|
bool behindMob,
|
||||||
bool backstab_weapon,
|
bool backstab_weapon,
|
||||||
float& melee_distance_max,
|
|
||||||
float& melee_distance,
|
|
||||||
float& melee_distance_min,
|
float& melee_distance_min,
|
||||||
|
float& melee_distance,
|
||||||
|
float& melee_distance_max,
|
||||||
uint8 stopMeleeLevel
|
uint8 stopMeleeLevel
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -947,8 +946,8 @@ public:
|
|||||||
const EQ::ItemInstance*& p_item,
|
const EQ::ItemInstance*& p_item,
|
||||||
const EQ::ItemInstance*& s_item,
|
const EQ::ItemInstance*& s_item,
|
||||||
float& melee_distance_min,
|
float& melee_distance_min,
|
||||||
float& melee_distance_max,
|
|
||||||
float& melee_distance,
|
float& melee_distance,
|
||||||
|
float& melee_distance_max,
|
||||||
uint8 stopMeleeLevel
|
uint8 stopMeleeLevel
|
||||||
);
|
);
|
||||||
bool GetCombatJitterFlag() { return m_combat_jitter_flag; }
|
bool GetCombatJitterFlag() { return m_combat_jitter_flag; }
|
||||||
@@ -1065,7 +1064,7 @@ private:
|
|||||||
bool _showHelm;
|
bool _showHelm;
|
||||||
bool _botRangedSetting;
|
bool _botRangedSetting;
|
||||||
uint8 _stopMeleeLevel;
|
uint8 _stopMeleeLevel;
|
||||||
uint32 _casterRange;
|
uint32 _distanceRanged;
|
||||||
bool _behindMobStatus;
|
bool _behindMobStatus;
|
||||||
bool _maxMeleeRangeStatus;
|
bool _maxMeleeRangeStatus;
|
||||||
bool _medInCombat;
|
bool _medInCombat;
|
||||||
|
|||||||
@@ -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("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("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("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("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("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) ||
|
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.cpp"
|
||||||
#include "bot_commands/bot_settings.cpp"
|
#include "bot_commands/bot_settings.cpp"
|
||||||
#include "bot_commands/cast.cpp"
|
#include "bot_commands/cast.cpp"
|
||||||
#include "bot_commands/caster_range.cpp"
|
|
||||||
#include "bot_commands/charm.cpp"
|
#include "bot_commands/charm.cpp"
|
||||||
#include "bot_commands/class_race_list.cpp"
|
#include "bot_commands/class_race_list.cpp"
|
||||||
#include "bot_commands/click_item.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/default_settings.cpp"
|
||||||
#include "bot_commands/defensive.cpp"
|
#include "bot_commands/defensive.cpp"
|
||||||
#include "bot_commands/depart.cpp"
|
#include "bot_commands/depart.cpp"
|
||||||
|
#include "bot_commands/distance_ranged.cpp"
|
||||||
#include "bot_commands/escape.cpp"
|
#include "bot_commands/escape.cpp"
|
||||||
#include "bot_commands/find_aliases.cpp"
|
#include "bot_commands/find_aliases.cpp"
|
||||||
#include "bot_commands/follow.cpp"
|
#include "bot_commands/follow.cpp"
|
||||||
|
|||||||
+1
-1
@@ -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(Client *c, const Seperator *sep);
|
||||||
void bot_command_bot_settings(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_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_charm(Client *c, const Seperator *sep);
|
||||||
void bot_command_class_race_list(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);
|
void bot_command_click_item(Client* c, const Seperator* sep);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ void bot_command_bot_settings(Client* c, const Seperator* sep)
|
|||||||
{
|
{
|
||||||
std::list<const char*> subcommand_list;
|
std::list<const char*> subcommand_list;
|
||||||
subcommand_list.push_back("behindmob");
|
subcommand_list.push_back("behindmob");
|
||||||
subcommand_list.push_back("casterrange");
|
subcommand_list.push_back("distanceranged");
|
||||||
subcommand_list.push_back("copysettings");
|
subcommand_list.push_back("copysettings");
|
||||||
subcommand_list.push_back("defaultsettings");
|
subcommand_list.push_back("defaultsettings");
|
||||||
subcommand_list.push_back("enforcespelllist");
|
subcommand_list.push_back("enforcespelllist");
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void bot_command_copy_settings(Client* c, const Seperator* sep)
|
|||||||
"[misc] copies all miscellaneous options such as:",
|
"[misc] copies all miscellaneous options such as:",
|
||||||
"- ^showhelm, ^followd, ^stopmeleelevel",
|
"- ^showhelm, ^followd, ^stopmeleelevel",
|
||||||
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
||||||
"- ^behindmob, ^casterrange, ^illusionblock",
|
"- ^behindmob, ^distanceranged, ^illusionblock",
|
||||||
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
|
|||||||
"[misc] restores all miscellaneous options such as:",
|
"[misc] restores all miscellaneous options such as:",
|
||||||
"- ^showhelm, ^followd, ^stopmeleelevel",
|
"- ^showhelm, ^followd, ^stopmeleelevel",
|
||||||
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
"- ^enforcespellsettings, ^bottoggleranged, ^petsettype",
|
||||||
"- ^behindmob, ^casterrange, ^illusionblock",
|
"- ^behindmob, ^distanceranged, ^illusionblock",
|
||||||
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
"- ^sitincombat, ^sithppercent and ^sitmanapercent",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
#include "../bot_command.h"
|
#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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
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, "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: 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: 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.");
|
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];
|
std::string arg1 = sep->arg[1];
|
||||||
int ab_arg = 1;
|
int ab_arg = 1;
|
||||||
bool current_check = false;
|
bool current_check = false;
|
||||||
uint32 crange = 0;
|
uint32 value = 0;
|
||||||
|
|
||||||
if (sep->IsNumber(1)) {
|
if (sep->IsNumber(1)) {
|
||||||
++ab_arg;
|
++ab_arg;
|
||||||
crange = atoi(sep->arg[1]);
|
value = atoi(sep->arg[1]);
|
||||||
if (crange < 0 || crange > 300) {
|
if (value < 0 || value > RuleI(Bots, MaxDistanceRanged)) {
|
||||||
c->Message(Chat::White, "You must enter a value within the range of 0 - 300.");
|
c->Message(Chat::Yellow, "You must enter a value within the range of 0 - 300.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +35,7 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
|
|||||||
current_check = true;
|
current_check = true;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,47 +57,43 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
|
|||||||
int success_count = 0;
|
int success_count = 0;
|
||||||
|
|
||||||
for (auto my_bot : sbl) {
|
for (auto my_bot : sbl) {
|
||||||
if (!IsCasterClass(my_bot->GetClass()) && !IsHybridClass(my_bot->GetClass())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!first_found) {
|
if (!first_found) {
|
||||||
first_found = my_bot;
|
first_found = my_bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_check) {
|
if (current_check) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::Green,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} says, 'My current caster range is {}.'",
|
"{} says, 'My current Distance Ranged is {}.'",
|
||||||
my_bot->GetCleanName(),
|
my_bot->GetCleanName(),
|
||||||
my_bot->GetBotCasterRange()
|
my_bot->GetBotDistanceRanged()
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my_bot->SetBotCasterRange(crange);
|
my_bot->SetBotDistanceRanged(value);
|
||||||
++success_count;
|
++success_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!current_check) {
|
if (!current_check) {
|
||||||
if (success_count == 1 && first_found) {
|
if (success_count == 1 && first_found) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::Green,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} says, 'My Caster Range was set to {}.'",
|
"{} says, 'My Distance Ranged was set to {}.'",
|
||||||
first_found->GetCleanName(),
|
first_found->GetCleanName(),
|
||||||
crange
|
value
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::Green,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} of your bots set their Caster Range to {}.",
|
"{} of your bots set their Distance Ranged to {}.",
|
||||||
success_count,
|
success_count,
|
||||||
crange
|
value
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user