Skip to content

Commit

Permalink
Hearstone: Groupmembers of a botgroup now try to set their hearthston…
Browse files Browse the repository at this point in the history
…e to the same location as the group leader.
  • Loading branch information
mostlikely4r committed Mar 6, 2025
1 parent 985ca6e commit 9af8ed5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
25 changes: 23 additions & 2 deletions playerbot/strategy/triggers/RpgTriggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,31 @@ bool RpgHomeBindTrigger::IsActive()
if (guidP.IsHostileTo(bot))
return false;

if (AI_VALUE(WorldPosition, "home bind").distance(bot) < 500.0f)
//Do not update for realplayers/always online when at max level.
if ((ai->IsRealPlayer() || sPlayerbotAIConfig.IsFreeAltBot(bot)) && bot->GetLevel() == DEFAULT_MAX_LEVEL)
return false;

if ((ai->IsRealPlayer() || sPlayerbotAIConfig.IsFreeAltBot(bot)) && bot->GetLevel() == DEFAULT_MAX_LEVEL)
WorldPosition currentBind = AI_VALUE(WorldPosition, "home bind");
WorldPosition newBind = (guidP.sqDistance2d(bot) > INTERACTION_DISTANCE * INTERACTION_DISTANCE) ? guidP : bot;

//Do not update if there's almost not change.
if (newBind.fDist(currentBind) < INTERACTION_DISTANCE * 2)
return false;

//Update if the new bind is closer to the group leaders bind than the old one.
if (bot->GetGroup() && !ai->IsGroupLeader() && ai->GetGroupMaster()->GetPlayerbotAI())
{
Player* player = ai->GetGroupMaster();
WorldPosition leaderBind = PAI_VALUE(WorldPosition, "home bind");

float newBindDistanceToMasterBind = newBind.fDist(leaderBind);
float oldBindDistanceToMasterBind = currentBind.fDist(leaderBind);

return newBindDistanceToMasterBind < oldBindDistanceToMasterBind;
}

//Do not update if the new bind is pretty close already.
if (currentBind.fDist(bot) < 500.0f)
return false;

return true;
Expand Down
17 changes: 17 additions & 0 deletions playerbot/strategy/values/LastMovementValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,21 @@ namespace ai
public:
StayTimeValue(PlayerbotAI* ai) : ManualSetValue<time_t>(ai, 0) {}
};

class LastLongMoveValue : public CalculatedValue<WorldPosition>
{
public:
LastLongMoveValue(PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, "last long move", 30) {}

WorldPosition Calculate();
};


class HomeBindValue : public CalculatedValue<WorldPosition>
{
public:
HomeBindValue(PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, "home bind", 30) {}

WorldPosition Calculate();
};
}
16 changes: 0 additions & 16 deletions playerbot/strategy/values/TargetValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,6 @@ namespace ai
virtual ~TravelTargetValue() { delete value; }
};

class LastLongMoveValue : public CalculatedValue<WorldPosition>
{
public:
LastLongMoveValue(PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, "last long move", 30) {}

WorldPosition Calculate();
};

class HomeBindValue : public CalculatedValue<WorldPosition>
{
public:
HomeBindValue(PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, "home bind", 30) {}

WorldPosition Calculate();
};

class IgnoreRpgTargetValue : public ManualSetValue<std::set<ObjectGuid>& >
{
public:
Expand Down

0 comments on commit 9af8ed5

Please sign in to comment.