Skip to content

Commit

Permalink
Travel: Fixed travel strategy properly triggering or preventing quest…
Browse files Browse the repository at this point in the history
… and low money targets
  • Loading branch information
mostlikely4r committed Jan 27, 2025
1 parent 20b0d12 commit 29580ea
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
10 changes: 5 additions & 5 deletions playerbot/strategy/generic/TravelStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void TravelStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
{"",TravelDestinationPurpose::Vendor, 6.95f}, //See PassTrough 90%
{"",TravelDestinationPurpose::AH, 6.94f}, // 90%
{"",TravelDestinationPurpose::Repair, 6.93f}, // 90%
{"val:and{no travel target,should get money,can get mail}", TravelDestinationPurpose::Mail, 6.79f}, //100%
{"val:and{no travel target,should get money}", TravelDestinationPurpose::Grind, 6.77f}, // 90%
{"val:and{not::travel target active,should get money,can get mail}", TravelDestinationPurpose::Mail, 6.79f}, //100%
{"val:and{not::travel target active,should get money}", TravelDestinationPurpose::Grind, 6.77f}, // 90%
{"",TravelDestinationPurpose::Mail, 6.6f}, // 70%
{"",TravelDestinationPurpose::GatherMining, 6.5f}, // 90%/40% in group
{"",TravelDestinationPurpose::GatherSkinning, 6.5f}, // 90%/40% in group
Expand All @@ -52,11 +52,11 @@ void TravelStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
{
{"no travel target","choose group travel target", 6.99f}, //See PassTrough 100%
{"val::should travel named::city","choose async named travel target::city", 6.85f}, // 10%
{"val:and{no travel target,has focus travel target}","choose async quest travel target", 6.84f}, //100%
{"val:and{has strategy::rpg quest,not::travel target active,has focus travel target}","choose async quest travel target", 6.84f}, //100%
//{"val::should travel named::pvp","choose async named travel target::pvp", 6.83f}, // 25%
{"val:and{no travel target,should get money}", "choose async quest travel target", 6.78f}, // 90%
{"val:and{has strategy::rpg quest,not::travel target active,should get money}", "choose async quest travel target", 6.78f}, // 90%
{"no travel target","refresh travel target", 6.7f}, // 90%
{"no travel target", "choose async quest travel target", 6.3f} // 95%
{"val:and{has strategy::rpg quest,not::travel target active}", "choose async quest travel target", 6.3f} // 95%
};

for (auto& [trigger, action, relevance] : StringActions)
Expand Down
5 changes: 5 additions & 0 deletions playerbot/strategy/values/TravelValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ bool ShouldTravelNamedValue::Calculate()
return false;
}

bool TravelTargetActiveValue::Calculate()
{
return AI_VALUE(TravelTarget*, "travel target")->IsActive();
};

bool QuestStageActiveValue::Calculate()
{
uint32 questId = getMultiQualifierInt(getQualifier(), 0, ",");
Expand Down
14 changes: 12 additions & 2 deletions playerbot/strategy/values/TravelValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace ai

//TravelPoint[point, destination, distance]
using TravelPoint = std::tuple<TravelDestination*, WorldPosition*, float>;
using TravelPointList = std::list<TravelPoint>;
using TravelPointList = std::vector<TravelPoint>;
using PartitionedTravelList = std::map<uint32, TravelPointList>;

typedef std::set<uint32> focusQuestTravelList;
Expand All @@ -119,6 +119,16 @@ namespace ai
TravelDestinationsValue(PlayerbotAI* ai, std::string name = "travel destinations") : ManualSetValue<PartitionedTravelList>(ai, {}, name), Qualified() {}
};

//Starting to travel

class TravelTargetActiveValue : public BoolCalculatedValue, public Qualified
{
public:
TravelTargetActiveValue(PlayerbotAI* ai, std::string name = "travel target active", int checkInterval = 5) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {};

virtual bool Calculate();
};

class NeedTravelPurposeValue : public BoolCalculatedValue, public Qualified
{
public:
Expand All @@ -143,7 +153,7 @@ namespace ai
virtual bool Calculate() override {return WorldPosition(bot).isOverworld();}
};

//Travel conditions
//Keep using this target

class QuestStageActiveValue : public BoolCalculatedValue, public Qualified
{
Expand Down
2 changes: 2 additions & 0 deletions playerbot/strategy/values/ValueContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ namespace ai
//Travel
creators["focus travel target"] = [](PlayerbotAI* ai) { return new FocusTravelTargetValue(ai); };
creators["has focus travel target"] = [](PlayerbotAI* ai) { return new HasFocusTravelTargetValue(ai); };

creators["travel target active"] = [](PlayerbotAI* ai) { return new TravelTargetActiveValue(ai); };

creators["travel target"] = [](PlayerbotAI* ai) { return new TravelTargetValue(ai); };
creators["travel destinations"] = [](PlayerbotAI* ai) { return new TravelDestinationsValue(ai); };
Expand Down

0 comments on commit 29580ea

Please sign in to comment.