Skip to content

Commit

Permalink
Internal: Travelmgr refactor pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Dec 23, 2024
1 parent 3fccb96 commit cfed5b3
Show file tree
Hide file tree
Showing 22 changed files with 331 additions and 1,049 deletions.
2 changes: 1 addition & 1 deletion playerbot/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ void PlayerbotAI::Reset(bool full)
aiObjectContext->GetValue<LastMovement& >("last area trigger")->Get().Set(NULL);
aiObjectContext->GetValue<LastMovement& >("last taxi")->Get().Set(NULL);

aiObjectContext->GetValue<TravelTarget* >("travel target")->Get()->setTarget(sTravelMgr.nullTravelDestination, sTravelMgr.nullWorldPosition, true);
sTravelMgr.SetNullTravelTarget(aiObjectContext->GetValue<TravelTarget* >("travel target")->Get());
aiObjectContext->GetValue<TravelTarget* >("travel target")->Get()->setStatus(TravelStatus::TRAVEL_STATUS_EXPIRED);
aiObjectContext->GetValue<TravelTarget* >("travel target")->Get()->setExpireIn(1000);

Expand Down
2 changes: 1 addition & 1 deletion playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ bool PlayerbotAIConfig::Initialize()
targetPosRecalcDistance = config.GetFloatDefault("AiPlayerbot.TargetPosRecalcDistance", 0.1f),

sLog.outString("Loading area levels.");
sTravelMgr.loadAreaLevels();
sTravelMgr.LoadAreaLevels();
sLog.outString("Loading spellIds.");
ChatHelper::PopulateSpellNameList();
ItemUsageValue::PopulateProfessionReagentIds();
Expand Down
4 changes: 2 additions & 2 deletions playerbot/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>
tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [](const WorldPosition& l) {std::vector<uint32>::iterator i = find(sPlayerbotAIConfig.randomBotMaps.begin(), sPlayerbotAIConfig.randomBotMaps.end(), l.getMapId()); return i == sPlayerbotAIConfig.randomBotMaps.end(); }), tlocs.end());

//Random shuffle based on distance. Closer distances are more likely (but not exclusively) to be at the begin of the list.
tlocs = sTravelMgr.getNextPoint(WorldPosition(bot), tlocs, 0);
tlocs = WorldPosition(bot).GetNextPoint(tlocs, 0);

//5% + 0.1% per level chance node on different map in selection.
//tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [bot](WorldLocation const& l) {return l.mapid != bot->GetMapId() && urand(1, 100) > 0.5 * bot->GetLevel(); }), tlocs.end());
Expand Down Expand Up @@ -3700,7 +3700,7 @@ void RandomPlayerbotMgr::RandomTeleportForRpg(Player* bot, bool activeOnly)
AiObjectContext* context = bot->GetPlayerbotAI()->GetAiObjectContext();
TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target");

travelTarget->setTarget(sTravelMgr.nullTravelDestination, sTravelMgr.nullWorldPosition, true);
sTravelMgr.SetNullTravelTarget(travelTarget);
travelTarget->setStatus(TravelStatus::TRAVEL_STATUS_COOLDOWN);
travelTarget->setExpireIn(10 * MINUTE * IN_MILLISECONDS);
}
Expand Down
Loading

0 comments on commit cfed5b3

Please sign in to comment.