mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-14 09:29:09 +00:00
Merge pull request #1425 from liyunfan1223/rpg_gear_incremental
Added config to make rndbots only get gear from looting/quests
This commit is contained in:
@@ -163,7 +163,8 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
factory.InitEquipment(true);
|
||||
if (sPlayerbotAIConfig->incrementalGearInit)
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
return;
|
||||
|
||||
@@ -187,7 +187,8 @@ void EquipAction::EquipItem(Item* item)
|
||||
// Priority 1: Replace main hand if the new weapon is strictly better
|
||||
// and if conditions allow (e.g. no conflicting 2H logic)
|
||||
bool betterThanMH = (newItemScore > mainHandScore);
|
||||
bool mhConditionOK = ((invType != INVTYPE_2HWEAPON && !have2HWeaponEquipped) ||
|
||||
// If a one-handed weapon is better, we can still use it instead of a two-handed weapon
|
||||
bool mhConditionOK = (invType != INVTYPE_2HWEAPON ||
|
||||
(isTwoHander && !canTitanGrip) ||
|
||||
(canTitanGrip && isValidTGWeapon));
|
||||
|
||||
|
||||
@@ -1801,7 +1801,6 @@ const Movement::PointsArray MovementAction::SearchForBestPath(float x, float y,
|
||||
|
||||
bool FleeAction::Execute(Event event)
|
||||
{
|
||||
// return Flee(AI_VALUE(Unit*, "current target"));
|
||||
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig->fleeDistance, true);
|
||||
}
|
||||
|
||||
@@ -1811,6 +1810,10 @@ bool FleeAction::isUseful()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ ArcaneMageStrategy::ArcaneMageStrategy(PlayerbotAI* botAI) : GenericMageStrategy
|
||||
NextAction** ArcaneMageStrategy::getDefaultActions()
|
||||
{
|
||||
return NextAction::array(0, new NextAction("arcane blast", ACTION_DEFAULT + 0.3f),
|
||||
// new NextAction("arcane barrage", ACTION_DEFAULT + 0.2f), // cast during movement
|
||||
new NextAction("frostbolt", ACTION_DEFAULT + 0.2f), // arcane immune target
|
||||
new NextAction("fire blast", ACTION_DEFAULT + 0.1f), // cast during movement
|
||||
new NextAction("shoot", ACTION_DEFAULT), nullptr);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
NextAction** FireMageStrategy::getDefaultActions()
|
||||
{
|
||||
return NextAction::array(0, new NextAction("fireball", ACTION_DEFAULT + 0.2f),
|
||||
return NextAction::array(0, new NextAction("fireball", ACTION_DEFAULT + 0.3f),
|
||||
new NextAction("frostbolt", ACTION_DEFAULT + 0.2f), // fire immune target
|
||||
new NextAction("fire blast", ACTION_DEFAULT + 0.1f), // cast during movement
|
||||
new NextAction("shoot", ACTION_DEFAULT), NULL);
|
||||
}
|
||||
|
||||
@@ -37,13 +37,6 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
|
||||
botAI->rpgInfo.SetMoveFarTo(dest);
|
||||
}
|
||||
|
||||
float dis = bot->GetExactDist(dest);
|
||||
if (dis < pathFinderDis)
|
||||
{
|
||||
return MoveTo(dest.getMapId(), dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false, false,
|
||||
false, true);
|
||||
}
|
||||
|
||||
// performance optimization
|
||||
if (IsWaitingForLastMove(MovementPriority::MOVEMENT_NORMAL))
|
||||
{
|
||||
@@ -70,6 +63,13 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
|
||||
dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.getMapId(), bot->GetZoneId(), zone_name);
|
||||
return bot->TeleportTo(dest);
|
||||
}
|
||||
|
||||
float dis = bot->GetExactDist(dest);
|
||||
if (dis < pathFinderDis)
|
||||
{
|
||||
return MoveTo(dest.getMapId(), dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false, false,
|
||||
false, true);
|
||||
}
|
||||
|
||||
float minDelta = M_PI;
|
||||
const float x = bot->GetPositionX();
|
||||
@@ -852,10 +852,18 @@ WorldPosition NewRpgBaseAction::SelectRandomGrindPos(Player* bot)
|
||||
float loRange = 2500.0f;
|
||||
if (bot->GetLevel() < 5)
|
||||
{
|
||||
hiRange /= 10;
|
||||
loRange /= 10;
|
||||
hiRange /= 3;
|
||||
loRange /= 3;
|
||||
}
|
||||
std::vector<WorldLocation> lo_prepared_locs, hi_prepared_locs;
|
||||
|
||||
bool inCity = false;
|
||||
if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(bot->GetZoneId()))
|
||||
{
|
||||
if (zone->flags & AREA_FLAG_CAPITAL)
|
||||
inCity = true;
|
||||
}
|
||||
|
||||
for (auto& loc : locs)
|
||||
{
|
||||
if (bot->GetMapId() != loc.GetMapId())
|
||||
@@ -863,17 +871,17 @@ WorldPosition NewRpgBaseAction::SelectRandomGrindPos(Player* bot)
|
||||
|
||||
if (bot->GetExactDist(loc) > 2500.0f)
|
||||
continue;
|
||||
|
||||
if (bot->GetMap()->GetZoneId(bot->GetPhaseMask(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ()) !=
|
||||
|
||||
if (!inCity && bot->GetMap()->GetZoneId(bot->GetPhaseMask(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ()) !=
|
||||
bot->GetZoneId())
|
||||
continue;
|
||||
|
||||
if (bot->GetExactDist(loc) < 500.0f)
|
||||
if (bot->GetExactDist(loc) < hiRange)
|
||||
{
|
||||
hi_prepared_locs.push_back(loc);
|
||||
}
|
||||
|
||||
if (bot->GetExactDist(loc) < 2500.0f)
|
||||
if (bot->GetExactDist(loc) < loRange)
|
||||
{
|
||||
lo_prepared_locs.push_back(loc);
|
||||
}
|
||||
@@ -900,6 +908,15 @@ WorldPosition NewRpgBaseAction::SelectRandomInnKeeperPos(Player* bot)
|
||||
const std::vector<WorldLocation>& locs = IsAlliance(bot->getRace())
|
||||
? sRandomPlayerbotMgr->allianceStarterPerLevelCache[bot->GetLevel()]
|
||||
: sRandomPlayerbotMgr->hordeStarterPerLevelCache[bot->GetLevel()];
|
||||
|
||||
bool inCity = false;
|
||||
|
||||
if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(bot->GetZoneId()))
|
||||
{
|
||||
if (zone->flags & AREA_FLAG_CAPITAL)
|
||||
inCity = true;
|
||||
}
|
||||
|
||||
std::vector<WorldLocation> prepared_locs;
|
||||
for (auto& loc : locs)
|
||||
{
|
||||
@@ -910,7 +927,7 @@ WorldPosition NewRpgBaseAction::SelectRandomInnKeeperPos(Player* bot)
|
||||
if (bot->GetExactDist(loc) > range)
|
||||
continue;
|
||||
|
||||
if (bot->GetMap()->GetZoneId(bot->GetPhaseMask(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ()) !=
|
||||
if (!inCity && bot->GetMap()->GetZoneId(bot->GetPhaseMask(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ()) !=
|
||||
bot->GetZoneId())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -116,12 +116,11 @@ Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount)
|
||||
botAI->rpgInfo.status == RPG_GO_INNKEEPER ||
|
||||
botAI->rpgInfo.status == RPG_DO_QUEST;
|
||||
|
||||
bool notHostile = !bot->IsHostileTo(unit); /*|| (unit->ToCreature() && unit->ToCreature()->IsCivilian());*/
|
||||
float aggroRange = 30.0f;
|
||||
if (unit->ToCreature())
|
||||
aggroRange = std::min(30.0f, unit->ToCreature()->GetAggroRange(bot) + 10.0f);
|
||||
bool outOfAggro = unit->ToCreature() && bot->GetDistance(unit) > aggroRange;
|
||||
if (inactiveGrindStatus && (outOfAggro || notHostile))
|
||||
if (inactiveGrindStatus && outOfAggro)
|
||||
{
|
||||
if (needForQuestMap.find(unit->GetEntry()) == needForQuestMap.end())
|
||||
needForQuestMap[unit->GetEntry()] = needForQuest(unit);
|
||||
|
||||
Reference in New Issue
Block a user