test: ms_time

This commit is contained in:
Yunfan Li
2023-08-02 03:46:15 +08:00
parent b35b8ad997
commit fca4d17c97
26 changed files with 91 additions and 82 deletions

View File

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

View File

@@ -33,7 +33,7 @@ class Trigger : public AiNamedObject
protected:
int32 checkInterval;
time_t lastCheckTime;
uint32 lastCheckTime;
};
class TriggerNode

View File

@@ -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<Unit*>(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<CreatureData const*>(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<std::vector<CreatureData const*>>(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<ObjectGuid>(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<GuidVector>(botAI, name, checkInterval)
{
lastCheckTime = time(nullptr) - checkInterval / 2;
}
std::string const ObjectGuidListCalculatedValue::Format()

View File

@@ -8,6 +8,7 @@
#include "AiObject.h"
#include "ObjectGuid.h"
#include "PerformanceMonitor.h"
#include "Timer.h"
#include <time.h>
@@ -45,23 +46,28 @@ class CalculatedValue : public UntypedValue, public Value<T>
{
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<T>
virtual T Calculate() = 0;
uint32 checkInterval;
time_t lastCheckTime;
uint32 lastCheckTime;
T value;
};

View File

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

View File

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

View File

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

View File

@@ -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

View File

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

View File

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

View File

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

View File

@@ -8,6 +8,7 @@
#include "Playerbots.h"
#include "SharedDefines.h"
#include "TemporarySummon.h"
#include "Timer.h"
#include <string>
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;

View File

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

View File

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

View File

@@ -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);

View File

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

View File

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

View File

@@ -15,7 +15,7 @@ class SpellInfo;
class ItemForSpellValue : public CalculatedValue<Item*>, public Qualified
{
public:
ItemForSpellValue(PlayerbotAI* botAI, std::string const name = "item for spell") : CalculatedValue<Item*>(botAI, name) { }
ItemForSpellValue(PlayerbotAI* botAI, std::string const name = "item for spell") : CalculatedValue<Item*>(botAI, name, 20 * 1000) { }
Item* Calculate() override;

View File

@@ -59,7 +59,7 @@ typedef std::unordered_map<ItemUsage, std::vector<uint32>> itemUsageMap;
class EntryLootUsageValue : public CalculatedValue<itemUsageMap>, 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<itemUsageMap>, 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;
};

View File

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

View File

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

View File

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

View File

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

View File

@@ -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();
};

View File

@@ -7,7 +7,7 @@
#include "Playerbots.h"
#include "Vehicle.h"
SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "spell id")
SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "spell id", 20 * 1000)
{
}

View File

@@ -64,7 +64,7 @@ class TravelTargetValue : public ManualSetValue<TravelTarget*>
class LastLongMoveValue : public CalculatedValue<WorldPosition>
{
public:
LastLongMoveValue(PlayerbotAI* botAI) : CalculatedValue<WorldPosition>(botAI, "last long move", 30) { }
LastLongMoveValue(PlayerbotAI* botAI) : CalculatedValue<WorldPosition>(botAI, "last long move", 30 * 1000) { }
WorldPosition Calculate() override;
};
@@ -72,7 +72,7 @@ class LastLongMoveValue : public CalculatedValue<WorldPosition>
class HomeBindValue : public CalculatedValue<WorldPosition>
{
public:
HomeBindValue(PlayerbotAI* botAI) : CalculatedValue<WorldPosition>(botAI, "home bind", 30) { }
HomeBindValue(PlayerbotAI* botAI) : CalculatedValue<WorldPosition>(botAI, "home bind", 30 * 1000) { }
WorldPosition Calculate() override;
};
@@ -101,7 +101,7 @@ class PullTargetValue : public ManualSetValue<ObjectGuid>
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();