Enforce reloadable AdventureBot area and travel access policies
This commit is contained in:
1 parent
0173a434f4
commit
321a28640c
31 files changed
+4869
-21
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#include "AdventureAreaMgr.h"
|
||||
#include "ClientlessFlightMgr.h"
|
||||
#include <cstring>
|
||||
#include "ClientlessLuaEngine.h"
|
||||
@@ -115,6 +116,7 @@ bool ClientlessFlightMgr::Enabled(Player const * player) const
|
||||
|
||||
bool ClientlessFlightMgr::Preferred(Player const * player, uint32 map, Position const & position) const
|
||||
{
|
||||
if (sAdventureAreaMgr->PreferredFlight(player,map,position)) return true;
|
||||
if(_planningPlayer==player)return _planningPreferredZones.count(AreaZone(player,map,position).second)!=0;
|
||||
std::istringstream list(sConfigMgr->GetStringDefault("Clientless.Flight.PreferredZones", "210 4197"));
|
||||
uint32 zone = AreaZone(player, map, position).second, candidate;
|
||||
@@ -143,6 +145,7 @@ float ClientlessFlightMgr::Estimate(Player const * player, uint32 map, Position
|
||||
// distance threshold or zone preference. Start still validates the flight.
|
||||
float minimum = recovery ? 0.0f : preferred ? 60.0f : std::max(100.0f, planning?_planningMinDistance:sConfigMgr->GetFloatDefault("Clientless.Flight.MinDistance", 600));
|
||||
if (! std::isfinite(distance) || distance < minimum || (!recovery && distance > 20000)) return Infinity();
|
||||
if (!sAdventureAreaMgr->AllowsSegment(player,map,from,to)) return Infinity();
|
||||
return recovery ? distance : preferred ? 40 + distance * 0.4f : 180 + distance * 1.5f;
|
||||
}
|
||||
|
||||
@@ -185,6 +188,8 @@ bool ClientlessFlightMgr::Start(Player* player,Position const& target,std::strin
|
||||
{return Begin(player,target,error,false);}
|
||||
bool ClientlessFlightMgr::Follow(Player* player,Position const& target,std::string& error)
|
||||
{
|
||||
if (!player || !sAdventureAreaMgr->AllowsPosition(player,player->GetMapId(),target))
|
||||
{error="group flight target denied by area catalog";return false;}
|
||||
auto found=_records.find(player->GetGUID().GetCounter());
|
||||
if(found!=_records.end() && (found->second.Status.State==ClientlessFlightState::Mounting || found->second.Status.State==ClientlessFlightState::Flying))
|
||||
{
|
||||
@@ -229,6 +234,8 @@ bool ClientlessFlightMgr::AdvanceFollowing(Player* player,Record& record)
|
||||
auto point=Mix(current,goal,std::min(1.0f,length/std::max(0.1f,Distance(current,goal))));
|
||||
if(turn!=0){float horizontal=Horizontal(current,point);point.X=current.X+std::cos(heading+turn)*horizontal;point.Y=current.Y+std::sin(heading+turn)*horizontal;}
|
||||
point.Z+=climb;
|
||||
Position candidatePos;candidatePos.Relocate(point.X,point.Y,point.Z);
|
||||
if(!sAdventureAreaMgr->AllowsSegment(player,player->GetMapId(),*player,candidatePos))continue;
|
||||
if(!Corridor(current,point,goal,settings,sample,ray,true))continue;
|
||||
float candidate=Distance(point,goal)+std::fabs(turn)*4+climb;
|
||||
if(candidate<score){score=candidate;best=point;}
|
||||
@@ -255,6 +262,8 @@ bool ClientlessFlightMgr::Begin(Player * player, Position const & target, std::s
|
||||
error = "free flight unavailable in current player/location state";
|
||||
return false;
|
||||
}
|
||||
if (!sAdventureAreaMgr->AllowsSegment(player,player->GetMapId(),*player,target))
|
||||
{error="flight corridor denied by area catalog";return false;}
|
||||
auto * vmaps = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
if (! vmaps->isLineOfSightCalcEnabled() || ! vmaps->isHeightCalcEnabled())
|
||||
{
|
||||
@@ -463,6 +472,9 @@ bool ClientlessFlightMgr::Advance(Player * player, Record & record, bool handoff
|
||||
Fail(player, record, "no safe bounded flight corridor; holding position mounted");
|
||||
return false;
|
||||
}
|
||||
Position catalogNext;catalogNext.Relocate(next.Next.X,next.Next.Y,next.Next.Z);
|
||||
if(!record.Returning && !sAdventureAreaMgr->AllowsSegment(player,player->GetMapId(),*player,catalogNext))
|
||||
{Fail(player,record,"flight segment denied by area catalog");return false;}
|
||||
if (! record.Returning) record.Breadcrumbs.push_back(* player);
|
||||
record.Segment.Relocate(next.Next.X, next.Next.Y, next.Next.Z, player->GetOrientation());
|
||||
player->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||
|
||||
Reference in new issue
Block a user