mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Improve rpg movement and grind
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
|
#include "NewRpgStrategy.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PossibleRpgTargetsValue.h"
|
#include "PossibleRpgTargetsValue.h"
|
||||||
#include "PvpTriggers.h"
|
#include "PvpTriggers.h"
|
||||||
@@ -36,18 +37,23 @@ bool AttackAnythingAction::isUseful()
|
|||||||
if (!AI_VALUE(bool, "can move around"))
|
if (!AI_VALUE(bool, "can move around"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
|
||||||
ChooseRpgTargetAction::isFollowValid(
|
// if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
||||||
bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
|
// ChooseRpgTargetAction::isFollowValid(
|
||||||
return false;
|
// bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
|
||||||
// if (bot->IsInCombat()) {
|
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool rpgGoStatus = botAI->rpgInfo.status == NewRpgStatus::GO_GRIND ||
|
||||||
|
botAI->rpgInfo.status == NewRpgStatus::GO_INNKEEPER;
|
||||||
|
|
||||||
|
if (rpgGoStatus && bot->GetDistance(target) > 25.0f)
|
||||||
|
return false;
|
||||||
|
|
||||||
std::string const name = std::string(target->GetName());
|
std::string const name = std::string(target->GetName());
|
||||||
// Check for invalid targets: Dummy, Charge Target, Melee Target, Ranged Target
|
// Check for invalid targets: Dummy, Charge Target, Melee Target, Ranged Target
|
||||||
if (!name.empty() &&
|
if (!name.empty() &&
|
||||||
@@ -59,10 +65,6 @@ bool AttackAnythingAction::isUseful()
|
|||||||
return false; // Target is one of the disallowed types
|
return false; // Target is one of the disallowed types
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far
|
|
||||||
// away from master.
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ bool NewRpgStatusUpdateAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// IDLE -> GO_INNKEEPER
|
// IDLE -> GO_INNKEEPER
|
||||||
else if (bot->GetLevel() >= 6 && roll <= 45)
|
else if (roll <= 45)
|
||||||
{
|
{
|
||||||
WorldPosition pos = SelectRandomInnKeeperPos();
|
WorldPosition pos = SelectRandomInnKeeperPos();
|
||||||
if (pos != WorldPosition() && bot->GetExactDist(pos) > 50.0f)
|
if (pos != WorldPosition() && bot->GetExactDist(pos) > 50.0f)
|
||||||
@@ -245,7 +245,7 @@ bool NewRpgGoFarAwayPosAction::MoveFarTo(WorldPosition dest)
|
|||||||
while (--attempt)
|
while (--attempt)
|
||||||
{
|
{
|
||||||
float angle = bot->GetAngle(&dest);
|
float angle = bot->GetAngle(&dest);
|
||||||
float delta = (rand_norm() - 0.5) * M_PI * 2;
|
float delta = urand(1, 100) <= 75 ? (rand_norm() - 0.5) * M_PI * 0.5 : (rand_norm() - 0.5) * M_PI * 2;
|
||||||
angle += delta;
|
angle += delta;
|
||||||
float dis = rand_norm() * pathFinderDis;
|
float dis = rand_norm() * pathFinderDis;
|
||||||
float dx = x + cos(angle) * dis;
|
float dx = x + cos(angle) * dis;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// const int32 setGrindInterval = 5 * 60 * 1000;
|
// const int32 setGrindInterval = 5 * 60 * 1000;
|
||||||
// const int32 setNpcInterval = 1 * 60 * 1000;
|
// const int32 setNpcInterval = 1 * 60 * 1000;
|
||||||
const int32 statusNearNpcDuration = 2 * 60 * 1000;
|
const int32 statusNearNpcDuration = 5 * 60 * 1000;
|
||||||
const int32 statusNearRandomDuration = 2 * 60 * 1000;
|
const int32 statusNearRandomDuration = 2 * 60 * 1000;
|
||||||
const int32 statusRestDuration = 30 * 1000;
|
const int32 statusRestDuration = 30 * 1000;
|
||||||
WorldPosition SelectRandomGrindPos();
|
WorldPosition SelectRandomGrindPos();
|
||||||
|
|||||||
Reference in New Issue
Block a user