From fca4d17c976423328d247e05cfcb141682fe826f Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 2 Aug 2023 03:46:15 +0800 Subject: [PATCH] test: ms_time --- src/strategy/Trigger.cpp | 5 +++-- src/strategy/Trigger.h | 2 +- src/strategy/Value.cpp | 9 ++++---- src/strategy/Value.h | 22 ++++++++++++------- src/strategy/actions/MovementActions.cpp | 6 ++++-- src/strategy/druid/DruidTriggers.h | 8 +++---- src/strategy/mage/MageTriggers.h | 6 +++--- src/strategy/paladin/PaladinTriggers.h | 10 ++++----- src/strategy/priest/PriestTriggers.h | 12 +++++------ src/strategy/shaman/ShamanTriggers.h | 8 +++---- src/strategy/triggers/CureTriggers.h | 2 +- src/strategy/triggers/GenericTriggers.cpp | 7 +++--- src/strategy/triggers/GenericTriggers.h | 26 +++++++++++------------ src/strategy/triggers/LfgTriggers.h | 4 ++-- src/strategy/values/AttackersValue.h | 2 +- src/strategy/values/EnemyPlayerValue.h | 2 +- src/strategy/values/GroupValues.h | 4 ++-- src/strategy/values/ItemForSpellValue.h | 2 +- src/strategy/values/LootValues.h | 4 ++-- src/strategy/values/MaintenanceValues.h | 14 ++++++------ src/strategy/values/NearestGameObjects.h | 2 +- src/strategy/values/NearestUnitsValue.h | 2 +- src/strategy/values/PartyMemberToDispel.h | 2 +- src/strategy/values/PartyMemberValue.h | 2 +- src/strategy/values/SpellIdValue.cpp | 2 +- src/strategy/values/TargetValue.h | 8 +++---- 26 files changed, 91 insertions(+), 82 deletions(-) diff --git a/src/strategy/Trigger.cpp b/src/strategy/Trigger.cpp index 2da7281e..564d1962 100644 --- a/src/strategy/Trigger.cpp +++ b/src/strategy/Trigger.cpp @@ -5,9 +5,10 @@ #include "Trigger.h" #include "Event.h" #include "Playerbots.h" +#include "Timer.h" Trigger::Trigger(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : - AiNamedObject(botAI, name), checkInterval(checkInterval), lastCheckTime(time(nullptr) - rand() % checkInterval) + AiNamedObject(botAI, name), checkInterval(checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)), lastCheckTime(0) { } @@ -38,7 +39,7 @@ bool Trigger::needCheck() if (checkInterval < 2) return true; - time_t now = time(nullptr); + uint32 now = getMSTime(); if (!lastCheckTime || now - lastCheckTime >= checkInterval) { lastCheckTime = now; diff --git a/src/strategy/Trigger.h b/src/strategy/Trigger.h index 46a03843..eeaaea97 100644 --- a/src/strategy/Trigger.h +++ b/src/strategy/Trigger.h @@ -33,7 +33,7 @@ class Trigger : public AiNamedObject protected: int32 checkInterval; - time_t lastCheckTime; + uint32 lastCheckTime; }; class TriggerNode diff --git a/src/strategy/Value.cpp b/src/strategy/Value.cpp index a9067b31..76f395ab 100644 --- a/src/strategy/Value.cpp +++ b/src/strategy/Value.cpp @@ -5,10 +5,10 @@ #include "Value.h" #include "PerformanceMonitor.h" #include "Playerbots.h" +#include "Timer.h" UnitCalculatedValue::UnitCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue(botAI, name, checkInterval) { - lastCheckTime = time(nullptr) - checkInterval / 2; } std::string const UnitCalculatedValue::Format() @@ -47,7 +47,7 @@ std::string const FloatCalculatedValue::Format() CDPairCalculatedValue::CDPairCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue(botAI, name, checkInterval) { - lastCheckTime = time(nullptr) - checkInterval / 2; + // lastCheckTime = getMSTime() - checkInterval / 2; } std::string const CDPairCalculatedValue::Format() @@ -65,7 +65,7 @@ std::string const CDPairCalculatedValue::Format() CDPairListCalculatedValue::CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue>(botAI, name, checkInterval) { - lastCheckTime = time(nullptr) - checkInterval / 2; + // lastCheckTime = time(nullptr) - checkInterval / 2; } std::string const CDPairListCalculatedValue::Format() @@ -84,7 +84,7 @@ std::string const CDPairListCalculatedValue::Format() ObjectGuidCalculatedValue::ObjectGuidCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue(botAI, name, checkInterval) { - lastCheckTime = time(nullptr) - checkInterval / 2; + // lastCheckTime = time(nullptr) - checkInterval / 2; } std::string const ObjectGuidCalculatedValue::Format() @@ -96,7 +96,6 @@ std::string const ObjectGuidCalculatedValue::Format() ObjectGuidListCalculatedValue::ObjectGuidListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue(botAI, name, checkInterval) { - lastCheckTime = time(nullptr) - checkInterval / 2; } std::string const ObjectGuidListCalculatedValue::Format() diff --git a/src/strategy/Value.h b/src/strategy/Value.h index bff21d09..bf29d074 100644 --- a/src/strategy/Value.h +++ b/src/strategy/Value.h @@ -8,6 +8,7 @@ #include "AiObject.h" #include "ObjectGuid.h" #include "PerformanceMonitor.h" +#include "Timer.h" #include @@ -45,23 +46,28 @@ class CalculatedValue : public UntypedValue, public Value { public: CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", uint32 checkInterval = 1) : UntypedValue(botAI, name), - checkInterval(checkInterval), lastCheckTime(0) { } + checkInterval(checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)) /*turn s -> ms?*/, lastCheckTime(0) { } virtual ~CalculatedValue() { } T Get() override { - time_t now = time(nullptr); - if (!lastCheckTime || checkInterval < 2 || now - lastCheckTime >= checkInterval / 2) - { - lastCheckTime = now; - + if (checkInterval < 2) { PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr); value = Calculate(); if (pmo) pmo->finish(); + } else { + time_t now = getMSTime(); + if (!lastCheckTime || now - lastCheckTime >= checkInterval) + { + lastCheckTime = now; + PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr); + value = Calculate(); + if (pmo) + pmo->finish(); + } } - return value; } @@ -81,7 +87,7 @@ class CalculatedValue : public UntypedValue, public Value virtual T Calculate() = 0; uint32 checkInterval; - time_t lastCheckTime; + uint32 lastCheckTime; T value; }; diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index 41e13f78..00f3b789 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -674,9 +674,11 @@ bool MovementAction::MoveTo(Unit* target, float distance) float dx = cos(angle) * needToGo + bx; float dy = sin(angle) * needToGo + by; - float dz = std::max(bz, tz); // calc accurate z position to avoid stuck + float dz; // = std::max(bz, tz); // calc accurate z position to avoid stuck if (distanceToTarget > CONTACT_DISTANCE) { - dz = std::max(dz, bz + (tz - bz) * (needToGo / distanceToTarget)); + dz = bz + (tz - bz) * (needToGo / distanceToTarget); + } else { + dz = tz; } return MoveTo(target->GetMapId(), dx, dy, dz); } diff --git a/src/strategy/druid/DruidTriggers.h b/src/strategy/druid/DruidTriggers.h index a45be4cf..b94f78d4 100644 --- a/src/strategy/druid/DruidTriggers.h +++ b/src/strategy/druid/DruidTriggers.h @@ -13,7 +13,7 @@ class PlayerbotAI; class MarkOfTheWildOnPartyTrigger : public BuffOnPartyTrigger { public: - MarkOfTheWildOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "mark of the wild", 2) { } + MarkOfTheWildOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "mark of the wild", 2 * 2000) { } bool IsActive() override; }; @@ -21,7 +21,7 @@ class MarkOfTheWildOnPartyTrigger : public BuffOnPartyTrigger class MarkOfTheWildTrigger : public BuffTrigger { public: - MarkOfTheWildTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "mark of the wild", 2) { } + MarkOfTheWildTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "mark of the wild", 2 * 2000) { } bool IsActive() override; }; @@ -29,7 +29,7 @@ class MarkOfTheWildTrigger : public BuffTrigger class ThornsOnPartyTrigger : public BuffOnPartyTrigger { public: - ThornsOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "thorns", 2) { } + ThornsOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "thorns", 2 * 2000) { } bool IsActive() override; }; @@ -37,7 +37,7 @@ class ThornsOnPartyTrigger : public BuffOnPartyTrigger class ThornsTrigger : public BuffTrigger { public: - ThornsTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "thorns", 2) { } + ThornsTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "thorns", 2 * 2000) { } bool IsActive() override; }; diff --git a/src/strategy/mage/MageTriggers.h b/src/strategy/mage/MageTriggers.h index 3696180f..04ea5fb6 100644 --- a/src/strategy/mage/MageTriggers.h +++ b/src/strategy/mage/MageTriggers.h @@ -16,7 +16,7 @@ DEFLECT_TRIGGER(FrostWardTrigger, "frost ward"); class ArcaneIntellectOnPartyTrigger : public BuffOnPartyTrigger { public: - ArcaneIntellectOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "arcane intellect", 2) { } + ArcaneIntellectOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "arcane intellect", 2 * 2000) { } bool IsActive() override; }; @@ -24,7 +24,7 @@ class ArcaneIntellectOnPartyTrigger : public BuffOnPartyTrigger class ArcaneIntellectTrigger : public BuffTrigger { public: - ArcaneIntellectTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "arcane intellect", 2) { } + ArcaneIntellectTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "arcane intellect", 2 * 2000) { } bool IsActive() override; }; @@ -32,7 +32,7 @@ class ArcaneIntellectTrigger : public BuffTrigger class MageArmorTrigger : public BuffTrigger { public: - MageArmorTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "mage armor", 5) { } + MageArmorTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "mage armor", 5 * 2000) { } bool IsActive() override; }; diff --git a/src/strategy/paladin/PaladinTriggers.h b/src/strategy/paladin/PaladinTriggers.h index 60dfc1f0..8d700d13 100644 --- a/src/strategy/paladin/PaladinTriggers.h +++ b/src/strategy/paladin/PaladinTriggers.h @@ -75,13 +75,13 @@ INTERRUPT_TRIGGER(RepentanceInterruptTrigger, "repentance"); class BlessingOnPartyTrigger : public BuffOnPartyTrigger { public: - BlessingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of kings,blessing of might,blessing of wisdom", 2) { } + BlessingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of kings,blessing of might,blessing of wisdom", 2 * 2000) { } }; class BlessingTrigger : public BuffTrigger { public: - BlessingTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "blessing of sanctuary", 2) { } + BlessingTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "blessing of sanctuary", 2 * 2000) { } bool IsActive() override; }; @@ -202,18 +202,18 @@ public: class BlessingOfKingsOnPartyTrigger : public BuffOnPartyTrigger { public: - BlessingOfKingsOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of kings", 2) { } + BlessingOfKingsOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of kings", 2 * 2000) { } }; class BlessingOfWisdomOnPartyTrigger : public BuffOnPartyTrigger { public: - BlessingOfWisdomOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2) { } + BlessingOfWisdomOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2 * 2000) { } }; class BlessingOfMightOnPartyTrigger : public BuffOnPartyTrigger { public: - BlessingOfMightOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2) { } + BlessingOfMightOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2 * 2000) { } }; #endif diff --git a/src/strategy/priest/PriestTriggers.h b/src/strategy/priest/PriestTriggers.h index 717c4d90..7d529843 100644 --- a/src/strategy/priest/PriestTriggers.h +++ b/src/strategy/priest/PriestTriggers.h @@ -43,7 +43,7 @@ BOOST_TRIGGER_A(ShadowfiendTrigger, "shadowfiend"); class PowerWordFortitudeOnPartyTrigger : public BuffOnPartyTrigger { public: - PowerWordFortitudeOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "power word: fortitude", 4) { } + PowerWordFortitudeOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "power word: fortitude", 4 * 2000) { } bool IsActive() override; }; @@ -51,7 +51,7 @@ class PowerWordFortitudeOnPartyTrigger : public BuffOnPartyTrigger class PowerWordFortitudeTrigger : public BuffTrigger { public: - PowerWordFortitudeTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "power word: fortitude", 4) { } + PowerWordFortitudeTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "power word: fortitude", 4 * 2000) { } bool IsActive() override; }; @@ -59,7 +59,7 @@ class PowerWordFortitudeTrigger : public BuffTrigger class DivineSpiritOnPartyTrigger : public BuffOnPartyTrigger { public: - DivineSpiritOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "divine spirit", 4) { } + DivineSpiritOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "divine spirit", 4 * 2000) { } bool IsActive() override; }; @@ -67,7 +67,7 @@ class DivineSpiritOnPartyTrigger : public BuffOnPartyTrigger class DivineSpiritTrigger : public BuffTrigger { public: - DivineSpiritTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "divine spirit", 4) { } + DivineSpiritTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "divine spirit", 4 * 2000) { } bool IsActive() override; }; @@ -75,7 +75,7 @@ class DivineSpiritTrigger : public BuffTrigger class PrayerOfFortitudeTrigger : public BuffOnPartyTrigger { public: - PrayerOfFortitudeTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "prayer of fortitude", 3) { } + PrayerOfFortitudeTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "prayer of fortitude", 3 * 2000) { } bool IsActive() override; }; @@ -83,7 +83,7 @@ class PrayerOfFortitudeTrigger : public BuffOnPartyTrigger class PrayerOfSpiritTrigger : public BuffOnPartyTrigger { public: - PrayerOfSpiritTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "prayer of spirit", 2) { } + PrayerOfSpiritTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "prayer of spirit", 2 * 2000) { } bool IsActive() override; }; diff --git a/src/strategy/shaman/ShamanTriggers.h b/src/strategy/shaman/ShamanTriggers.h index 1b563d48..4dae65e0 100644 --- a/src/strategy/shaman/ShamanTriggers.h +++ b/src/strategy/shaman/ShamanTriggers.h @@ -14,7 +14,7 @@ class PlayerbotAI; class ShamanWeaponTrigger : public BuffTrigger { public: - ShamanWeaponTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "rockbiter weapon", 2) { } + ShamanWeaponTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "rockbiter weapon", 2 * 2000) { } bool IsActive() override; @@ -112,7 +112,7 @@ class WaterWalkingTrigger : public BuffTrigger class WaterBreathingTrigger : public BuffTrigger { public: - WaterBreathingTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "water breathing", 5) { } + WaterBreathingTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "water breathing", 5 * 2000) { } bool IsActive() override; }; @@ -120,7 +120,7 @@ class WaterBreathingTrigger : public BuffTrigger class WaterWalkingOnPartyTrigger : public BuffOnPartyTrigger { public: - WaterWalkingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "water walking on party", 2) { } + WaterWalkingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "water walking on party", 2 * 2000) { } bool IsActive() override; }; @@ -128,7 +128,7 @@ class WaterWalkingOnPartyTrigger : public BuffOnPartyTrigger class WaterBreathingOnPartyTrigger : public BuffOnPartyTrigger { public: - WaterBreathingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "water breathing on party", 2) { } + WaterBreathingOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "water breathing on party", 2 * 2000) { } bool IsActive() override; }; diff --git a/src/strategy/triggers/CureTriggers.h b/src/strategy/triggers/CureTriggers.h index 527700a3..4632f154 100644 --- a/src/strategy/triggers/CureTriggers.h +++ b/src/strategy/triggers/CureTriggers.h @@ -13,7 +13,7 @@ class Unit; class NeedCureTrigger : public SpellTrigger { public: - NeedCureTrigger(PlayerbotAI* botAI, std::string const spell, uint32 dispelType) : SpellTrigger(botAI, spell, 2), dispelType(dispelType) { } + NeedCureTrigger(PlayerbotAI* botAI, std::string const spell, uint32 dispelType) : SpellTrigger(botAI, spell, 2 * 1000), dispelType(dispelType) { } std::string const GetTargetName() override { return "self target"; } bool IsActive() override; diff --git a/src/strategy/triggers/GenericTriggers.cpp b/src/strategy/triggers/GenericTriggers.cpp index 44781524..81c4389b 100644 --- a/src/strategy/triggers/GenericTriggers.cpp +++ b/src/strategy/triggers/GenericTriggers.cpp @@ -8,6 +8,7 @@ #include "Playerbots.h" #include "SharedDefines.h" #include "TemporarySummon.h" +#include "Timer.h" #include bool LowManaTrigger::IsActive() @@ -224,16 +225,16 @@ bool SpellNoCooldownTrigger::IsActive() return !bot->HasSpellCooldown(spellId); } -RandomTrigger::RandomTrigger(PlayerbotAI* botAI, std::string const name, int32 probability) : Trigger(botAI, name), probability(probability), lastCheck(time(nullptr)) +RandomTrigger::RandomTrigger(PlayerbotAI* botAI, std::string const name, int32 probability) : Trigger(botAI, name), probability(probability), lastCheck(getMSTime()) { } bool RandomTrigger::IsActive() { - if (time(nullptr) - lastCheck < sPlayerbotAIConfig->repeatDelay / 1000) + if (getMSTime() - lastCheck < sPlayerbotAIConfig->repeatDelay) return false; - lastCheck = time(nullptr); + lastCheck = getMSTime(); int32 k = (int32)(probability / sPlayerbotAIConfig->randomChangeMultiplier); if (k < 1) k = 1; diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index 83b2f294..282146de 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -343,7 +343,7 @@ class RandomTrigger : public Trigger protected: int32 probability; - time_t lastCheck; + uint32 lastCheck; }; class AndTrigger : public Trigger @@ -415,7 +415,7 @@ END_TRIGGER() class NoPetTrigger : public Trigger { public: - NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 5) { } + NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 5 * 1000) { } virtual bool IsActive() override; }; @@ -423,7 +423,7 @@ class NoPetTrigger : public Trigger class HasPetTrigger : public Trigger { public: - HasPetTrigger(PlayerbotAI* ai) : Trigger(ai, "has pet", 5) {} + HasPetTrigger(PlayerbotAI* ai) : Trigger(ai, "has pet", 5 * 1000) {} virtual bool IsActive() override; }; @@ -431,7 +431,7 @@ public: class ItemCountTrigger : public Trigger { public: - ItemCountTrigger(PlayerbotAI* botAI, std::string const item, int32 count, int32 interval = 30) : Trigger(botAI, item, interval), item(item), count(count) { } + ItemCountTrigger(PlayerbotAI* botAI, std::string const item, int32 count, int32 interval = 30 * 1000) : Trigger(botAI, item, interval), item(item), count(count) { } bool IsActive() override; std::string const getName() override { return "item count"; } @@ -444,7 +444,7 @@ class ItemCountTrigger : public Trigger class AmmoCountTrigger : public ItemCountTrigger { public: - AmmoCountTrigger(PlayerbotAI* botAI, std::string const item, uint32 count = 1, int32 interval = 30) : ItemCountTrigger(botAI, item, count, interval) { } + AmmoCountTrigger(PlayerbotAI* botAI, std::string const item, uint32 count = 1, int32 interval = 30 * 1000) : ItemCountTrigger(botAI, item, count, interval) { } }; class HasAuraTrigger : public Trigger @@ -612,7 +612,7 @@ class InterruptEnemyHealerTrigger : public SpellTrigger class RandomBotUpdateTrigger : public RandomTrigger { public: - RandomBotUpdateTrigger(PlayerbotAI* botAI) : RandomTrigger(botAI, "random bot update", 30) { } + RandomBotUpdateTrigger(PlayerbotAI* botAI) : RandomTrigger(botAI, "random bot update", 30 * 1000) { } bool IsActive() override; }; @@ -620,7 +620,7 @@ class RandomBotUpdateTrigger : public RandomTrigger class NoNonBotPlayersAroundTrigger : public Trigger { public: - NoNonBotPlayersAroundTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no non bot players around", 10) { } + NoNonBotPlayersAroundTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no non bot players around", 10 * 1000) { } bool IsActive() override; }; @@ -628,7 +628,7 @@ class NoNonBotPlayersAroundTrigger : public Trigger class NewPlayerNearbyTrigger : public Trigger { public: - NewPlayerNearbyTrigger(PlayerbotAI* botAI) : Trigger(botAI, "new player nearby", 10) { } + NewPlayerNearbyTrigger(PlayerbotAI* botAI) : Trigger(botAI, "new player nearby", 10 * 1000) { } bool IsActive() override; }; @@ -644,7 +644,7 @@ class CollisionTrigger : public Trigger class StayTimeTrigger : public Trigger { public: - StayTimeTrigger(PlayerbotAI* botAI, uint32 delay, std::string const name) : Trigger(botAI, name, 5), delay(delay) { } + StayTimeTrigger(PlayerbotAI* botAI, uint32 delay, std::string const name) : Trigger(botAI, name, 5 * 1000), delay(delay) { } bool IsActive() override; @@ -667,7 +667,7 @@ class ReturnTrigger : public StayTimeTrigger class GiveItemTrigger : public Trigger { public: - GiveItemTrigger(PlayerbotAI* botAI, std::string const name, std::string const item) : Trigger(botAI, name, 2), item(item) { } + GiveItemTrigger(PlayerbotAI* botAI, std::string const name, std::string const item) : Trigger(botAI, name, 2 * 1000), item(item) { } bool IsActive() override; @@ -702,7 +702,7 @@ class IsMountedTrigger : public Trigger class CorpseNearTrigger : public Trigger { public: - CorpseNearTrigger(PlayerbotAI* botAI) : Trigger(botAI, "corpse near", 10) { } + CorpseNearTrigger(PlayerbotAI* botAI) : Trigger(botAI, "corpse near", 10 * 1000) { } bool IsActive() override; }; @@ -710,7 +710,7 @@ class CorpseNearTrigger : public Trigger class IsFallingTrigger : public Trigger { public: - IsFallingTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling", 10) { } + IsFallingTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling", 10 * 1000) { } bool IsActive() override; }; @@ -718,7 +718,7 @@ class IsFallingTrigger : public Trigger class IsFallingFarTrigger : public Trigger { public: - IsFallingFarTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling far", 10) { } + IsFallingFarTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling far", 10 * 1000) { } bool IsActive() override; }; diff --git a/src/strategy/triggers/LfgTriggers.h b/src/strategy/triggers/LfgTriggers.h index e72e8fa8..c1f7d0e4 100644 --- a/src/strategy/triggers/LfgTriggers.h +++ b/src/strategy/triggers/LfgTriggers.h @@ -12,7 +12,7 @@ class PlayerbotAI; class LfgProposalActiveTrigger : public Trigger { public: - LfgProposalActiveTrigger(PlayerbotAI* botAI) : Trigger(botAI, "lfg proposal active", 20) { } + LfgProposalActiveTrigger(PlayerbotAI* botAI) : Trigger(botAI, "lfg proposal active", 20 * 2000) { } bool IsActive() override; }; @@ -20,7 +20,7 @@ class LfgProposalActiveTrigger : public Trigger class UnknownDungeonTrigger : public Trigger { public: - UnknownDungeonTrigger(PlayerbotAI* botAI) : Trigger(botAI, "unknown dungeon", 20) { } + UnknownDungeonTrigger(PlayerbotAI* botAI) : Trigger(botAI, "unknown dungeon", 20 * 2000) { } bool IsActive() override; }; diff --git a/src/strategy/values/AttackersValue.h b/src/strategy/values/AttackersValue.h index ea1e745b..b475e92b 100644 --- a/src/strategy/values/AttackersValue.h +++ b/src/strategy/values/AttackersValue.h @@ -16,7 +16,7 @@ class Unit; class AttackersValue : public ObjectGuidListCalculatedValue { public: - AttackersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "attackers", 2) { } + AttackersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "attackers", 2 * 1000) { } GuidVector Calculate(); static bool IsPossibleTarget(Unit* attacker, Player* bot, float range = sPlayerbotAIConfig->sightDistance); diff --git a/src/strategy/values/EnemyPlayerValue.h b/src/strategy/values/EnemyPlayerValue.h index 20a0e026..2dfcb9f3 100644 --- a/src/strategy/values/EnemyPlayerValue.h +++ b/src/strategy/values/EnemyPlayerValue.h @@ -24,7 +24,7 @@ class NearestEnemyPlayersValue : public PossibleTargetsValue class EnemyPlayerValue : public UnitCalculatedValue { public: - EnemyPlayerValue(PlayerbotAI* botAI, std::string const name = "enemy player") : UnitCalculatedValue(botAI, name, 2) { } + EnemyPlayerValue(PlayerbotAI* botAI, std::string const name = "enemy player") : UnitCalculatedValue(botAI, name, 2 * 1000) { } Unit* Calculate() override; diff --git a/src/strategy/values/GroupValues.h b/src/strategy/values/GroupValues.h index 0df83eef..49ab3fb5 100644 --- a/src/strategy/values/GroupValues.h +++ b/src/strategy/values/GroupValues.h @@ -10,7 +10,7 @@ class PlayerbotAI; class GroupMembersValue : public ObjectGuidListCalculatedValue { public: - GroupMembersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "group members", 2) { } + GroupMembersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "group members", 2 * 1000) { } GuidVector Calculate() override; }; @@ -66,7 +66,7 @@ class GroupBoolORValue : public BoolCalculatedValue, public Qualified class GroupReadyValue : public BoolCalculatedValue, public Qualified { public: - GroupReadyValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "group ready", 2) { } + GroupReadyValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "group ready", 2 * 2000) { } bool Calculate()override; }; diff --git a/src/strategy/values/ItemForSpellValue.h b/src/strategy/values/ItemForSpellValue.h index da6e1942..b43aad49 100644 --- a/src/strategy/values/ItemForSpellValue.h +++ b/src/strategy/values/ItemForSpellValue.h @@ -15,7 +15,7 @@ class SpellInfo; class ItemForSpellValue : public CalculatedValue, public Qualified { public: - ItemForSpellValue(PlayerbotAI* botAI, std::string const name = "item for spell") : CalculatedValue(botAI, name) { } + ItemForSpellValue(PlayerbotAI* botAI, std::string const name = "item for spell") : CalculatedValue(botAI, name, 20 * 1000) { } Item* Calculate() override; diff --git a/src/strategy/values/LootValues.h b/src/strategy/values/LootValues.h index 5a6f5341..a1215f8a 100644 --- a/src/strategy/values/LootValues.h +++ b/src/strategy/values/LootValues.h @@ -59,7 +59,7 @@ typedef std::unordered_map> itemUsageMap; class EntryLootUsageValue : public CalculatedValue, public Qualified { public: - EntryLootUsageValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "entry loot usage", 2) { } + EntryLootUsageValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "entry loot usage", 2 * 1000) { } itemUsageMap Calculate() override; }; @@ -67,7 +67,7 @@ class EntryLootUsageValue : public CalculatedValue, public Qualifi class HasUpgradeValue : public BoolCalculatedValue, public Qualified { public: - HasUpgradeValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "has upgrade", 2) { } + HasUpgradeValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "has upgrade", 2 * 1000) { } bool Calculate() override; }; diff --git a/src/strategy/values/MaintenanceValues.h b/src/strategy/values/MaintenanceValues.h index 97c26dbe..57913a7e 100644 --- a/src/strategy/values/MaintenanceValues.h +++ b/src/strategy/values/MaintenanceValues.h @@ -12,7 +12,7 @@ class PlayerbotAI; class CanMoveAroundValue : public BoolCalculatedValue { public: - CanMoveAroundValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can move around", 2) { } + CanMoveAroundValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can move around", 2 * 2000) { } bool Calculate() override; }; @@ -20,7 +20,7 @@ class CanMoveAroundValue : public BoolCalculatedValue class ShouldHomeBindValue : public BoolCalculatedValue { public: - ShouldHomeBindValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "should home bind", 2) { } + ShouldHomeBindValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "should home bind", 2 * 2000) { } bool Calculate() override; }; @@ -28,7 +28,7 @@ class ShouldHomeBindValue : public BoolCalculatedValue class ShouldRepairValue : public BoolCalculatedValue { public: - ShouldRepairValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI,"should repair",2) { } + ShouldRepairValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI,"should repair",2 * 2000) { } bool Calculate() override; }; @@ -36,7 +36,7 @@ class ShouldRepairValue : public BoolCalculatedValue class CanRepairValue : public BoolCalculatedValue { public: - CanRepairValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can repair",2) { } + CanRepairValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can repair",2 * 2000) { } bool Calculate() override; }; @@ -44,7 +44,7 @@ class CanRepairValue : public BoolCalculatedValue class ShouldSellValue : public BoolCalculatedValue { public: - ShouldSellValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "should sell",2) { } + ShouldSellValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "should sell",2 * 2000) { } bool Calculate() override; }; @@ -52,7 +52,7 @@ class ShouldSellValue : public BoolCalculatedValue class CanSellValue : public BoolCalculatedValue { public: - CanSellValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can sell",2) { } + CanSellValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can sell",2 * 2000) { } bool Calculate() override; }; @@ -60,7 +60,7 @@ class CanSellValue : public BoolCalculatedValue class CanFightEqualValue: public BoolCalculatedValue { public: - CanFightEqualValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can fight equal",2) { } + CanFightEqualValue(PlayerbotAI* botAI) : BoolCalculatedValue(botAI, "can fight equal",2 * 2000) { } bool Calculate() override; }; diff --git a/src/strategy/values/NearestGameObjects.h b/src/strategy/values/NearestGameObjects.h index 6b7c197c..73fec151 100644 --- a/src/strategy/values/NearestGameObjects.h +++ b/src/strategy/values/NearestGameObjects.h @@ -14,7 +14,7 @@ class NearestGameObjects : public ObjectGuidListCalculatedValue { public: NearestGameObjects(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance, bool ignoreLos = false, std::string const name = "nearest game objects") : - ObjectGuidListCalculatedValue(botAI, name), range(range) , ignoreLos(ignoreLos) { } + ObjectGuidListCalculatedValue(botAI, name, 2 * 1000), range(range) , ignoreLos(ignoreLos) { } protected: GuidVector Calculate() override; diff --git a/src/strategy/values/NearestUnitsValue.h b/src/strategy/values/NearestUnitsValue.h index 484faba8..7eeca734 100644 --- a/src/strategy/values/NearestUnitsValue.h +++ b/src/strategy/values/NearestUnitsValue.h @@ -15,7 +15,7 @@ class NearestUnitsValue : public ObjectGuidListCalculatedValue { public: NearestUnitsValue(PlayerbotAI* botAI, std::string const name = "nearest units", float range = sPlayerbotAIConfig->sightDistance, bool ignoreLos = false) : - ObjectGuidListCalculatedValue(botAI, name, 2), range(range), ignoreLos(ignoreLos) { } + ObjectGuidListCalculatedValue(botAI, name, 2 * 1000), range(range), ignoreLos(ignoreLos) { } GuidVector Calculate() override; diff --git a/src/strategy/values/PartyMemberToDispel.h b/src/strategy/values/PartyMemberToDispel.h index a145fa4f..36197ea9 100644 --- a/src/strategy/values/PartyMemberToDispel.h +++ b/src/strategy/values/PartyMemberToDispel.h @@ -14,7 +14,7 @@ class Unit; class PartyMemberToDispel : public PartyMemberValue, public Qualified { public: - PartyMemberToDispel(PlayerbotAI* botAI, std::string const name = "party member to dispel") : PartyMemberValue(botAI, name, 2), Qualified() { } + PartyMemberToDispel(PlayerbotAI* botAI, std::string const name = "party member to dispel") : PartyMemberValue(botAI, name, 2 * 1000), Qualified() { } protected: Unit* Calculate() override; diff --git a/src/strategy/values/PartyMemberValue.h b/src/strategy/values/PartyMemberValue.h index e3508b3d..ab9c97ef 100644 --- a/src/strategy/values/PartyMemberValue.h +++ b/src/strategy/values/PartyMemberValue.h @@ -38,7 +38,7 @@ class PartyMemberValue : public UnitCalculatedValue class PartyMemberMainTankValue : public PartyMemberValue { public: - PartyMemberMainTankValue(PlayerbotAI* botAI) : PartyMemberValue(botAI, "main tank member", 2) {} + PartyMemberMainTankValue(PlayerbotAI* botAI) : PartyMemberValue(botAI, "main tank member", 2 * 1000) {} virtual Unit* Calculate(); }; diff --git a/src/strategy/values/SpellIdValue.cpp b/src/strategy/values/SpellIdValue.cpp index f6cb6f81..0e7eef38 100644 --- a/src/strategy/values/SpellIdValue.cpp +++ b/src/strategy/values/SpellIdValue.cpp @@ -7,7 +7,7 @@ #include "Playerbots.h" #include "Vehicle.h" -SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "spell id") +SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "spell id", 20 * 1000) { } diff --git a/src/strategy/values/TargetValue.h b/src/strategy/values/TargetValue.h index 0182354e..b2cab18f 100644 --- a/src/strategy/values/TargetValue.h +++ b/src/strategy/values/TargetValue.h @@ -64,7 +64,7 @@ class TravelTargetValue : public ManualSetValue class LastLongMoveValue : public CalculatedValue { public: - LastLongMoveValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "last long move", 30) { } + LastLongMoveValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "last long move", 30 * 1000) { } WorldPosition Calculate() override; }; @@ -72,7 +72,7 @@ class LastLongMoveValue : public CalculatedValue class HomeBindValue : public CalculatedValue { public: - HomeBindValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "home bind", 30) { } + HomeBindValue(PlayerbotAI* botAI) : CalculatedValue(botAI, "home bind", 30 * 1000) { } WorldPosition Calculate() override; }; @@ -101,7 +101,7 @@ class PullTargetValue : public ManualSetValue class FindTargetValue : public UnitCalculatedValue, public Qualified { public: - FindTargetValue(PlayerbotAI* ai) : UnitCalculatedValue(ai, "find target", 2) {} + FindTargetValue(PlayerbotAI* ai) : UnitCalculatedValue(ai, "find target", 2 * 1000) {} public: Unit* Calculate(); @@ -117,7 +117,7 @@ class FindBossTargetStrategy : public FindTargetStrategy class BossTargetValue : public TargetValue, public Qualified { public: - BossTargetValue(PlayerbotAI* ai) : TargetValue(ai, "boss target", 1) {} + BossTargetValue(PlayerbotAI* ai) : TargetValue(ai, "boss target", 2 * 1000) {} public: Unit* Calculate();