mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Reduce near npc range distance
This commit is contained in:
@@ -33,36 +33,39 @@ bool NewRpgStatusUpdateAction::Execute(Event event)
|
|||||||
uint32 roll = urand(1, 100);
|
uint32 roll = urand(1, 100);
|
||||||
// IDLE -> NEAR_NPC
|
// IDLE -> NEAR_NPC
|
||||||
// if ((!info.lastNearNpc || info.lastNearNpc + setNpcInterval < getMSTime()) && roll <= 30)
|
// if ((!info.lastNearNpc || info.lastNearNpc + setNpcInterval < getMSTime()) && roll <= 30)
|
||||||
if (roll <= 20)
|
if (roll <= 40)
|
||||||
{
|
{
|
||||||
info.lastNearNpc = getMSTime();
|
info.lastNearNpc = getMSTime();
|
||||||
GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets");
|
GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets");
|
||||||
if (possibleTargets.empty())
|
if (!possibleTargets.empty())
|
||||||
break;
|
{
|
||||||
info.status = NewRpgStatus::NEAR_NPC;
|
info.status = NewRpgStatus::NEAR_NPC;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// IDLE -> GO_INNKEEPER
|
// IDLE -> GO_INNKEEPER
|
||||||
if (bot->GetLevel() >= 6 && roll <= 30)
|
if (bot->GetLevel() >= 6 && roll <= 55)
|
||||||
{
|
{
|
||||||
WorldPosition pos = SelectRandomInnKeeperPos();
|
WorldPosition pos = SelectRandomInnKeeperPos();
|
||||||
if (pos == WorldPosition() || bot->GetExactDist(pos) < 50.0f)
|
if (pos != WorldPosition() && bot->GetExactDist(pos) > 50.0f)
|
||||||
break;
|
{
|
||||||
info.lastGoInnKeeper = getMSTime();
|
info.lastGoInnKeeper = getMSTime();
|
||||||
info.status = NewRpgStatus::GO_INNKEEPER;
|
info.status = NewRpgStatus::GO_INNKEEPER;
|
||||||
info.innKeeperPos = pos;
|
info.innKeeperPos = pos;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// IDLE -> GO_GRIND
|
// IDLE -> GO_GRIND
|
||||||
if (roll <= 90)
|
if (roll <= 90)
|
||||||
{
|
{
|
||||||
WorldPosition pos = SelectRandomGrindPos();
|
WorldPosition pos = SelectRandomGrindPos();
|
||||||
if (pos == WorldPosition())
|
if (pos != WorldPosition())
|
||||||
break;
|
{
|
||||||
info.lastGoGrind = getMSTime();
|
info.lastGoGrind = getMSTime();
|
||||||
info.status = NewRpgStatus::GO_GRIND;
|
info.status = NewRpgStatus::GO_GRIND;
|
||||||
info.grindPos = pos;
|
info.grindPos = pos;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// IDLE -> REST
|
// IDLE -> REST
|
||||||
info.status = NewRpgStatus::REST;
|
info.status = NewRpgStatus::REST;
|
||||||
@@ -164,7 +167,7 @@ WorldPosition NewRpgStatusUpdateAction::SelectRandomGrindPos()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WorldPosition dest;
|
WorldPosition dest;
|
||||||
if (urand(1, 100) <= 50 && !hi_prepared_locs.empty())
|
if (urand(1, 100) <= 75 && !hi_prepared_locs.empty())
|
||||||
{
|
{
|
||||||
uint32 idx = urand(0, hi_prepared_locs.size() - 1);
|
uint32 idx = urand(0, hi_prepared_locs.size() - 1);
|
||||||
dest = hi_prepared_locs[idx];
|
dest = hi_prepared_locs[idx];
|
||||||
@@ -236,7 +239,7 @@ bool NewRpgGoFarAwayPosAction::MoveFarTo(WorldPosition dest)
|
|||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
path.CalculatePath(dx, dy, dz);
|
path.CalculatePath(dx, dy, dz);
|
||||||
// bool canReach = bot->GetMap()->CanReachPositionAndGetValidCoords(bot, x, y, z, dx, dy, dz, false);
|
// bool canReach = bot->GetMap()->CanReachPositionAndGetValidCoords(bot, x, y, z, dx, dy, dz, false);
|
||||||
bool canReach = path.GetPathType() & (PATHFIND_NORMAL | PATHFIND_INCOMPLETE);
|
bool canReach = path.GetPathType() & PATHFIND_NORMAL;
|
||||||
|
|
||||||
if (canReach)
|
if (canReach)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ 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 = 3 * 60 * 1000;
|
const int32 statusNearNpcDuration = 5 * 60 * 1000;
|
||||||
const int32 statusNearRandomDuration = 3 * 60 * 1000;
|
const int32 statusNearRandomDuration = 3 * 60 * 1000;
|
||||||
const int32 statusRestDuration = 1 * 60 * 1000;
|
const int32 statusRestDuration = 2 * 60 * 1000;
|
||||||
WorldPosition SelectRandomGrindPos();
|
WorldPosition SelectRandomGrindPos();
|
||||||
WorldPosition SelectRandomInnKeeperPos();
|
WorldPosition SelectRandomInnKeeperPos();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class PlayerbotAI;
|
|||||||
class PossibleRpgTargetsValue : public NearestUnitsValue
|
class PossibleRpgTargetsValue : public NearestUnitsValue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PossibleRpgTargetsValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->rpgDistance);
|
PossibleRpgTargetsValue(PlayerbotAI* botAI, float range = 70.0f);
|
||||||
|
|
||||||
static std::vector<uint32> allowedNpcFlags;
|
static std::vector<uint32> allowedNpcFlags;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user