mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
Refactored how zones work. Cleaned out a lot of duplciations and smoothed out how Zones/PrivateAreas work.
This commit is contained in:
@@ -335,7 +335,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.zone != user.zone)
|
||||
if (target.CurrentArea != user.CurrentArea)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@@ -45,7 +45,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
contentGroupCharas = new List<Character>(owner.currentContentGroup.GetMemberCount());
|
||||
foreach (var charaId in owner.currentContentGroup.GetMembers())
|
||||
{
|
||||
var chara = owner.zone.FindActorInArea<Character>(charaId);
|
||||
var chara = owner.CurrentArea.FindActorInArea<Character>(charaId);
|
||||
|
||||
if (chara != null)
|
||||
contentGroupCharas.Add(chara);
|
||||
|
@@ -98,7 +98,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
{
|
||||
if (!owner.neutral && owner.IsAlive())
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 50))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 50))
|
||||
{
|
||||
if (chara.allegiance == owner.allegiance)
|
||||
continue;
|
||||
@@ -276,7 +276,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
{
|
||||
if (owner.target is Player)
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 1))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 1))
|
||||
{
|
||||
if (chara == owner)
|
||||
continue;
|
||||
@@ -404,7 +404,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
|
||||
public virtual bool CanSeePoint(float x, float y, float z)
|
||||
{
|
||||
return NavmeshUtils.CanSee((Zone)owner.zone, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
return NavmeshUtils.CanSee((Zone)owner.CurrentArea, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
}
|
||||
|
||||
protected virtual void HandleHate()
|
||||
@@ -420,7 +420,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
||||
owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
|
||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||
foreach (var player in owner.CurrentArea.GetActorsAroundActor<Player>(owner, 50))
|
||||
player.QueuePacket(owner.GetHateTypePacket(player));
|
||||
|
||||
base.ChangeTarget(target);
|
||||
|
@@ -55,17 +55,17 @@ namespace Meteor.Map.actors.chara.ai
|
||||
{
|
||||
PreparePath(dest.X, dest.Y, dest.Z, stepSize, maxPath, polyRadius);
|
||||
}
|
||||
|
||||
//TODO: Verify pathfind with new area setup
|
||||
public void PreparePath(float x, float y, float z, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f)
|
||||
{
|
||||
var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ);
|
||||
var dest = new Vector3(x, y, z);
|
||||
|
||||
Zone zone;
|
||||
if (owner.GetZone() is PrivateArea || owner.GetZone() is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.GetZone()).GetParentZone();
|
||||
if (owner.CurrentArea is PrivateArea || owner.CurrentArea is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.CurrentArea).GetParentZone();
|
||||
else
|
||||
zone = (Zone)owner.GetZone();
|
||||
zone = (Zone)owner.CurrentArea;
|
||||
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
|
@@ -285,7 +285,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
{
|
||||
foreach (var actorId in party.members)
|
||||
{
|
||||
AddTarget(owner.zone.FindActorInArea<Character>(actorId), withPet);
|
||||
AddTarget(owner.CurrentArea.FindActorInArea<Character>(actorId), withPet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +299,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
private void AddAllBattleNpcs(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
|
||||
foreach (BattleNpc actor in actors)
|
||||
{
|
||||
@@ -309,7 +309,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
|
||||
private void AddAllInZone(Character target, bool withPet)
|
||||
{
|
||||
var actors = owner.zone.GetAllActors<Character>();
|
||||
var actors = owner.CurrentArea.GetAllActors<Character>();
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
AddTarget(actor, withPet);
|
||||
@@ -319,7 +319,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
private void AddAllInRange(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<Character>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<Character>(target, dist);
|
||||
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
@@ -408,7 +408,7 @@ namespace Meteor.Map.actors.chara.ai
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone)
|
||||
if (/*target.isZoning || owner.isZoning || */target.CurrentArea != owner.CurrentArea)
|
||||
return false;
|
||||
|
||||
if (validTarget == ValidTarget.Self && aoeType == TargetFindAOEType.None && owner != target)
|
||||
|
@@ -50,7 +50,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
||||
public override bool Update(DateTime tick)
|
||||
{
|
||||
if ((target == null || owner.target != target || owner.target?.actorId != owner.currentLockedTarget) && owner.isAutoAttackEnabled)
|
||||
owner.aiContainer.ChangeTarget(target = owner.zone.FindActorInArea<Character>(owner.currentTarget));
|
||||
owner.aiContainer.ChangeTarget(target = owner.CurrentArea.FindActorInArea<Character>(owner.currentTarget));
|
||||
|
||||
if (target == null || target.IsDead())
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
||||
// todo: send paralyzed/sleep message etc.
|
||||
if (errorResult != null)
|
||||
{
|
||||
owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
owner.CurrentArea.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
errorResult = null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user