File tree Expand file tree Collapse file tree 3 files changed +40
-18
lines changed Expand file tree Collapse file tree 3 files changed +40
-18
lines changed Original file line number Diff line number Diff line change @@ -421,10 +421,31 @@ bool RpgHomeBindTrigger::IsActive()
421
421
if (guidP.IsHostileTo (bot))
422
422
return false ;
423
423
424
- if (AI_VALUE (WorldPosition, " home bind" ).distance (bot) < 500 .0f )
424
+ // Do not update for realplayers/always online when at max level.
425
+ if ((ai->IsRealPlayer () || sPlayerbotAIConfig .IsFreeAltBot (bot)) && bot->GetLevel () == DEFAULT_MAX_LEVEL)
425
426
return false ;
426
427
427
- if ((ai->IsRealPlayer () || sPlayerbotAIConfig .IsFreeAltBot (bot)) && bot->GetLevel () == DEFAULT_MAX_LEVEL)
428
+ WorldPosition currentBind = AI_VALUE (WorldPosition, " home bind" );
429
+ WorldPosition newBind = (guidP.sqDistance2d (bot) > INTERACTION_DISTANCE * INTERACTION_DISTANCE) ? guidP : bot;
430
+
431
+ // Do not update if there's almost not change.
432
+ if (newBind.fDist (currentBind) < INTERACTION_DISTANCE * 2 )
433
+ return false ;
434
+
435
+ // Update if the new bind is closer to the group leaders bind than the old one.
436
+ if (bot->GetGroup () && !ai->IsGroupLeader () && ai->GetGroupMaster ()->GetPlayerbotAI ())
437
+ {
438
+ Player* player = ai->GetGroupMaster ();
439
+ WorldPosition leaderBind = PAI_VALUE (WorldPosition, " home bind" );
440
+
441
+ float newBindDistanceToMasterBind = newBind.fDist (leaderBind);
442
+ float oldBindDistanceToMasterBind = currentBind.fDist (leaderBind);
443
+
444
+ return newBindDistanceToMasterBind < oldBindDistanceToMasterBind;
445
+ }
446
+
447
+ // Do not update if the new bind is pretty close already.
448
+ if (currentBind.fDist (bot) < 500 .0f )
428
449
return false ;
429
450
430
451
return true ;
Original file line number Diff line number Diff line change @@ -115,4 +115,21 @@ namespace ai
115
115
public:
116
116
StayTimeValue (PlayerbotAI* ai) : ManualSetValue<time_t >(ai, 0 ) {}
117
117
};
118
+
119
+ class LastLongMoveValue : public CalculatedValue <WorldPosition>
120
+ {
121
+ public:
122
+ LastLongMoveValue (PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, " last long move" , 30 ) {}
123
+
124
+ WorldPosition Calculate ();
125
+ };
126
+
127
+
128
+ class HomeBindValue : public CalculatedValue <WorldPosition>
129
+ {
130
+ public:
131
+ HomeBindValue (PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, " home bind" , 30 ) {}
132
+
133
+ WorldPosition Calculate ();
134
+ };
118
135
}
Original file line number Diff line number Diff line change @@ -78,22 +78,6 @@ namespace ai
78
78
virtual ~TravelTargetValue () { delete value; }
79
79
};
80
80
81
- class LastLongMoveValue : public CalculatedValue <WorldPosition>
82
- {
83
- public:
84
- LastLongMoveValue (PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, " last long move" , 30 ) {}
85
-
86
- WorldPosition Calculate ();
87
- };
88
-
89
- class HomeBindValue : public CalculatedValue <WorldPosition>
90
- {
91
- public:
92
- HomeBindValue (PlayerbotAI* ai) : CalculatedValue<WorldPosition>(ai, " home bind" , 30 ) {}
93
-
94
- WorldPosition Calculate ();
95
- };
96
-
97
81
class IgnoreRpgTargetValue : public ManualSetValue <std::set<ObjectGuid>& >
98
82
{
99
83
public:
You can’t perform that action at this time.
0 commit comments