mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-24 05:37:46 +00:00
Merge branch 'ai-open' of https://bitbucket.org/takhlaq/ffxiv-classic-server into ai-open
This commit is contained in:
commit
b2e86d282a
12 changed files with 351 additions and 154 deletions
|
@ -151,37 +151,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
return spawnPacket;
|
||||
}
|
||||
|
||||
public SubPacket CreatePositionUpdatePacket(bool forceUpdate = false)
|
||||
public SubPacket CreatePositionUpdatePacket(uint playerActorId)
|
||||
{
|
||||
int updateMs = 300;
|
||||
var diffTime = (DateTime.Now - lastMoveUpdate);
|
||||
|
||||
if (this.target != null)
|
||||
{
|
||||
updateMs = 150;
|
||||
}
|
||||
|
||||
if (forceUpdate || (hasMoved && ((this is Player ) || diffTime.Milliseconds >= updateMs)))
|
||||
{
|
||||
hasMoved = (this.positionUpdates != null && this.positionUpdates.Count > 0);
|
||||
if (hasMoved)
|
||||
{
|
||||
var pos = positionUpdates[0];
|
||||
|
||||
if (this is Character)
|
||||
((Character)this).OnPath(pos);
|
||||
|
||||
positionX = pos.X;
|
||||
positionY = pos.Y;
|
||||
positionZ = pos.Z;
|
||||
//Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates)
|
||||
|
||||
positionUpdates.RemoveAt(0);
|
||||
}
|
||||
lastMoveUpdate = DateTime.Now;
|
||||
return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
|
||||
}
|
||||
return null;
|
||||
return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
|
||||
}
|
||||
|
||||
public SubPacket CreateStatePacket()
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
return subpackets;
|
||||
}
|
||||
|
||||
// todo: handle instance areas in derived class? (see virtuals)
|
||||
#region Actor Management
|
||||
|
||||
public void AddActorToZone(Actor actor)
|
||||
|
@ -204,12 +205,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundPoint(float x, float y, int checkDistance)
|
||||
public virtual List<T> GetActorsAroundPoint<T>(float x, float y, int checkDistance) where T : Actor
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
int gridX = (int)x/boundingGridSize;
|
||||
int gridY = (int)y/boundingGridSize;
|
||||
int gridX = (int)x / boundingGridSize;
|
||||
int gridY = (int)y / boundingGridSize;
|
||||
|
||||
gridX += halfWidth;
|
||||
gridY += halfHeight;
|
||||
|
@ -224,7 +225,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
if (gridY >= numYBlocks)
|
||||
gridY = numYBlocks - 1;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
List<T> result = new List<T>();
|
||||
|
||||
lock (mActorBlock)
|
||||
{
|
||||
|
@ -232,7 +233,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
{
|
||||
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
result.AddRange(mActorBlock[gx, gy].OfType<T>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,11 +247,20 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
result.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundActor(Actor actor, int checkDistance)
|
||||
public virtual List<Actor> GetActorsAroundPoint(float x, float y, int checkDistance)
|
||||
{
|
||||
return GetActorsAroundPoint<Actor>(x, y, checkDistance);
|
||||
}
|
||||
|
||||
public virtual List<Actor> GetActorsAroundActor(Actor actor, int checkDistance)
|
||||
{
|
||||
return GetActorsAroundActor<Actor>(actor, checkDistance);
|
||||
}
|
||||
|
||||
public virtual List<T> GetActorsAroundActor<T>(Actor actor, int checkDistance) where T : Actor
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
|
@ -270,7 +280,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
if (gridY >= numYBlocks)
|
||||
gridY = numYBlocks - 1;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
var result = new List<T>();
|
||||
|
||||
lock (mActorBlock)
|
||||
{
|
||||
|
@ -278,10 +288,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
{
|
||||
for (int gx = ((gridX - checkDistance) < 0 ? 0 : (gridX - checkDistance)); gx <= ((gridX + checkDistance) >= numXBlocks ? numXBlocks - 1 : (gridX + checkDistance)); gx++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
result.AddRange(mActorBlock[gx, gy].OfType<T>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Remove players if isolation zone
|
||||
if (isIsolated)
|
||||
{
|
||||
|
@ -327,13 +338,10 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
{
|
||||
lock (mActorList)
|
||||
{
|
||||
foreach (Actor a in mActorList.Values)
|
||||
foreach (Player player in mActorList.Values.OfType<Player>())
|
||||
{
|
||||
if (a is Player)
|
||||
{
|
||||
if (((Player)a).customDisplayName.ToLower().Equals(name.ToLower()))
|
||||
return (Player)a;
|
||||
}
|
||||
if (player.customDisplayName.ToLower().Equals(name.ToLower()))
|
||||
return player;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -369,6 +377,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
|
||||
// todo: for zones override this to seach contentareas (assuming flag is passed)
|
||||
<<<<<<< HEAD
|
||||
public virtual List<Actor> GetAllActors()
|
||||
{
|
||||
lock (mActorList)
|
||||
|
@ -378,10 +387,27 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
{
|
||||
actorList.Add(actor);
|
||||
}
|
||||
=======
|
||||
public virtual List<T> GetAllActors<T>() where T : Actor
|
||||
{
|
||||
lock (mActorList)
|
||||
{
|
||||
List<T> actorList = new List<T>(mActorList.Count);
|
||||
actorList.AddRange(mActorList.Values.OfType<T>());
|
||||
>>>>>>> 84d5eee1fcc284d252b7953a70aebed60b195ee8
|
||||
return actorList;
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
public virtual List<Actor> GetAllActors()
|
||||
{
|
||||
return GetAllActors<Actor>();
|
||||
}
|
||||
|
||||
>>>>>>> 84d5eee1fcc284d252b7953a70aebed60b195ee8
|
||||
public void BroadcastPacketsAroundActor(Actor actor, List<SubPacket> packets)
|
||||
{
|
||||
foreach (SubPacket packet in packets)
|
||||
|
|
|
@ -10,7 +10,16 @@ using System;
|
|||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
class Character:Actor
|
||||
/// <summary> Which Character types am I friendly with </summary>
|
||||
enum CharacterTargetingAllegiance
|
||||
{
|
||||
/// <summary> Friendly to Players </summary>
|
||||
Player,
|
||||
/// <summary> Friendly to BattleNpcs </summary>
|
||||
BattleNpcs
|
||||
}
|
||||
|
||||
class Character : Actor
|
||||
{
|
||||
public const int SIZE = 0;
|
||||
public const int COLORINFO = 1;
|
||||
|
@ -66,6 +75,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public AIContainer aiContainer;
|
||||
public StatusEffects statusEffects;
|
||||
|
||||
public CharacterTargetingAllegiance allegiance;
|
||||
|
||||
public Character(uint actorID) : base(actorID)
|
||||
{
|
||||
//Init timer array to "notimer"
|
||||
|
|
|
@ -88,6 +88,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
this.controller = controller;
|
||||
}
|
||||
|
||||
public Controller GetController()
|
||||
{
|
||||
return controller;
|
||||
}
|
||||
|
||||
public bool CanChangeState()
|
||||
{
|
||||
return states.Count == 0 || states.Peek().CanInterrupt();
|
||||
|
|
|
@ -5,6 +5,8 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
||||
|
||||
// port of dsp's ai code https://github.com/DarkstarProject/darkstar/blob/master/src/map/ai/
|
||||
|
||||
|
@ -16,7 +18,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
{
|
||||
None,
|
||||
/// <summary> Able to target <see cref="Player"/>s even if not in target's party </summary>
|
||||
All,
|
||||
HitAll,
|
||||
/// <summary> Able to target all <see cref="Player"/>s in target's party/alliance </summary>
|
||||
Alliance,
|
||||
/// <summary> Able to target any <see cref="Pet"/> in target's party/alliance </summary>
|
||||
|
@ -67,6 +69,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
{
|
||||
private Character owner;
|
||||
private Character target;
|
||||
private Character masterTarget; // if target is a pet, this is the owner
|
||||
private TargetFindCharacterType findType;
|
||||
private TargetFindFlags findFlags;
|
||||
private TargetFindAOEType aoeType;
|
||||
|
@ -95,6 +98,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
this.targets = new List<Character>();
|
||||
}
|
||||
|
||||
public List<T> GetTargets<T>() where T : Character
|
||||
{
|
||||
return new List<T>(targets.OfType<T>());
|
||||
}
|
||||
|
||||
public List<Character> GetTargets()
|
||||
{
|
||||
return targets;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this before <see cref="FindWithinArea"/> <para/>
|
||||
/// </summary>
|
||||
|
@ -128,84 +141,103 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
/// <para> Call SetAOEType before calling this </para>
|
||||
/// Find targets within area set by <see cref="SetAOEType"/>
|
||||
/// </summary>
|
||||
/// <param name="withPet">Include pets?</param>
|
||||
|
||||
public void FindWithinArea(Character target, TargetFindFlags flags, bool withPet)
|
||||
public void FindWithinArea(Character target, TargetFindFlags flags)
|
||||
{
|
||||
findFlags = flags;
|
||||
// todo: maybe we should keep a snapshot which is only updated on each tick for consistency
|
||||
|
||||
// are we creating aoe circles around target or self
|
||||
if ((aoeType & TargetFindAOEType.Circle) != 0 && radiusType != TargetFindAOERadiusType.Self)
|
||||
this.targetPosition = owner.GetPosAsVector3();
|
||||
else
|
||||
this.targetPosition = new Vector3(target.positionX, target.positionY, target.positionZ);
|
||||
this.targetPosition = target.GetPosAsVector3();
|
||||
|
||||
this.findFlags = flags;
|
||||
if (aoeType == TargetFindAOEType.Box)
|
||||
masterTarget = TryGetMasterTarget(target) ?? target;
|
||||
|
||||
// todo: should i set this yet or wait til checked if valid target
|
||||
this.target = target;
|
||||
|
||||
// todo: this is stupid
|
||||
bool withPet = (flags & TargetFindFlags.Pets) != 0 || masterTarget.allegiance != owner.allegiance;
|
||||
|
||||
if (IsPlayer(owner))
|
||||
{
|
||||
FindWithinBox(withPet);
|
||||
if (masterTarget is Player)
|
||||
{
|
||||
findType = TargetFindCharacterType.PlayerToPlayer;
|
||||
|
||||
// todo: handle player parties
|
||||
if (masterTarget.currentParty != null)
|
||||
{
|
||||
if ((findFlags & TargetFindFlags.Alliance) != 0)
|
||||
AddAllInAlliance(masterTarget, withPet);
|
||||
else
|
||||
AddAllInParty(masterTarget, withPet);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddTarget(masterTarget, withPet);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
findType = TargetFindCharacterType.PlayerToBattleNpc;
|
||||
AddAllBattleNpcs(masterTarget, false);
|
||||
}
|
||||
}
|
||||
else if (aoeType == TargetFindAOEType.Circle)
|
||||
else
|
||||
{
|
||||
FindWithinCircle(withPet);
|
||||
// todo: this needs checking..
|
||||
if (masterTarget is Player || owner.allegiance == CharacterTargetingAllegiance.Player)
|
||||
findType = TargetFindCharacterType.BattleNpcToPlayer;
|
||||
else
|
||||
findType = TargetFindCharacterType.BattleNpcToBattleNpc;
|
||||
|
||||
// todo: configurable pet aoe buff
|
||||
if (findType == TargetFindCharacterType.BattleNpcToBattleNpc && TryGetMasterTarget(target) != null)
|
||||
withPet = true;
|
||||
|
||||
// todo: does ffxiv have call for help flag?
|
||||
//if ((findFlags & TargetFindFlags.HitAll) != 0)
|
||||
//{
|
||||
// AddAllInZone(masterTarget, withPet);
|
||||
//}
|
||||
|
||||
AddAllInAlliance(target, withPet);
|
||||
|
||||
if (findType == TargetFindCharacterType.BattleNpcToPlayer)
|
||||
{
|
||||
if (owner.allegiance == CharacterTargetingAllegiance.Player)
|
||||
AddAllInZone(masterTarget, withPet);
|
||||
else
|
||||
AddAllInHateList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find targets within a box using owner's coordinates and target's coordinates as length
|
||||
/// with corners being `extents` yalms to either side of self and target
|
||||
/// </summary>
|
||||
private void FindWithinBox(bool withPet)
|
||||
private bool IsWithinBox(Character target, bool withPet)
|
||||
{
|
||||
// todo: loop over party members
|
||||
if ((findFlags & TargetFindFlags.All) != 0)
|
||||
{
|
||||
// if we have flag set to hit all characters in zone, do it
|
||||
var myPos = owner.GetPosAsVector3();
|
||||
var angle = Vector3.GetAngle(myPos, targetPosition);
|
||||
|
||||
// todo: make the distance check modifiable
|
||||
var actors = (findFlags & TargetFindFlags.ZoneWide) != 0 ? owner.zone.GetAllActors() : owner.zone.GetActorsAroundActor(owner, 30);
|
||||
var myPos = owner.GetPosAsVector3();
|
||||
var angle = Vector3.GetAngle(myPos, targetPosition);
|
||||
// todo: actually check this works..
|
||||
var myCorner = myPos.NewHorizontalVector(angle, extents);
|
||||
var myCorner2 = myPos.NewHorizontalVector(angle, -extents);
|
||||
|
||||
// todo: actually check this works..
|
||||
var myCorner = myPos.NewHorizontalVector(angle, extents);
|
||||
var myCorner2 = myPos.NewHorizontalVector(angle, -extents);
|
||||
var targetCorner = targetPosition.NewHorizontalVector(angle, extents);
|
||||
var targetCorner2 = targetPosition.NewHorizontalVector(angle, -extents);
|
||||
|
||||
var targetCorner = targetPosition.NewHorizontalVector(angle, extents);
|
||||
var targetCorner2 = targetPosition.NewHorizontalVector(angle, -extents);
|
||||
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
// dont wanna add static actors
|
||||
if (actor is Player || actor is BattleNpc)
|
||||
{
|
||||
if (actor.GetPosAsVector3().IsWithinBox(myCorner2, targetCorner))
|
||||
{
|
||||
if (CanTarget(actor))
|
||||
AddTarget(actor, withPet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target.GetPosAsVector3().IsWithinBox(targetCorner2, myCorner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find targets within circle area. <para/>
|
||||
/// As the name implies, it only checks horizontal coords, not vertical -
|
||||
/// effectively creating cylinder with infinite height
|
||||
/// </summary>
|
||||
private void FindWithinCircle(bool withPet)
|
||||
private bool IsWithinCone(Character target, bool withPet)
|
||||
{
|
||||
var actors = (findFlags & TargetFindFlags.ZoneWide) != 0 ? owner.zone.GetAllActors() : owner.zone.GetActorsAroundActor(owner, 30);
|
||||
|
||||
foreach (Character target in actors)
|
||||
{
|
||||
if (target is Player || target is BattleNpc)
|
||||
{
|
||||
if (target.GetPosAsVector3().IsWithinCircle(targetPosition, extents))
|
||||
AddTarget(target, withPet);
|
||||
}
|
||||
}
|
||||
// todo:
|
||||
return false;
|
||||
}
|
||||
|
||||
private void AddTarget(Character target, bool withPet)
|
||||
|
@ -220,14 +252,61 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
private void AddAllInParty(Character target, bool withPet)
|
||||
{
|
||||
// todo:
|
||||
/*
|
||||
* foreach (var actor in target.currentParty.GetMembers())
|
||||
* {
|
||||
* AddTarget(actor, withPet);
|
||||
* }
|
||||
*/
|
||||
AddTarget(target, withPet);
|
||||
}
|
||||
|
||||
private void AddAllInAlliance(Character target, bool withPet)
|
||||
{
|
||||
// todo:
|
||||
/*
|
||||
* foreach (var actor in target.currentParty.GetAllianceMembers())
|
||||
* {
|
||||
* AddTarget(actor, withPet);
|
||||
* }
|
||||
*/
|
||||
AddTarget(target, withPet);
|
||||
}
|
||||
|
||||
public bool CanTarget(Character target)
|
||||
private void AddAllBattleNpcs(Character target, bool withPet)
|
||||
{
|
||||
// 70 is client render distance so we'll go with that
|
||||
var actors = (findFlags & TargetFindFlags.ZoneWide) != 0 ? owner.zone.GetAllActors<BattleNpc>() : owner.zone.GetActorsAroundActor<BattleNpc>(owner, 70);
|
||||
|
||||
// todo: should we look for Characters instead in case player is charmed by BattleNpc
|
||||
foreach (BattleNpc actor in actors)
|
||||
{
|
||||
// todo:
|
||||
AddTarget(actor, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAllInZone(Character target, bool withPet)
|
||||
{
|
||||
var actors = owner.zone.GetAllActors<Character>();
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
AddTarget(actor, withPet);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAllInHateList()
|
||||
{
|
||||
if (!(owner is BattleNpc))
|
||||
Program.Log.Error($"TargetFind.AddAllInHateList() owner [{owner.actorId}] {owner.customDisplayName} {owner.actorName} is not a BattleNpc");
|
||||
|
||||
foreach (var hateEntry in ((BattleNpc)owner).hateContainer.GetHateList())
|
||||
{
|
||||
AddTarget(hateEntry.Value.actor, false);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanTarget(Character target, bool withPet = false)
|
||||
{
|
||||
// already targeted, dont target again
|
||||
if (targets.Contains(target))
|
||||
|
@ -237,12 +316,55 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
if ((findFlags & TargetFindFlags.Dead) == 0 && target.IsDead())
|
||||
return false;
|
||||
|
||||
// cant target if player is zoning
|
||||
if (target is Player && ((Player)target).playerSession.isUpdatesLocked)
|
||||
bool targetingPlayer = target is Player;
|
||||
|
||||
// cant target if zoning
|
||||
if (target.isZoning || owner.isZoning || target.zone != owner.zone || targetingPlayer && ((Player)target).playerSession.isUpdatesLocked)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
// hit everything within zone or within aoe region
|
||||
if ((findFlags & TargetFindFlags.ZoneWide) != 0 || aoeType == TargetFindAOEType.Circle && target.GetPosAsVector3().IsWithinCircle(targetPosition, extents))
|
||||
return true;
|
||||
|
||||
if (aoeType == TargetFindAOEType.Cone && IsWithinCone(target, withPet))
|
||||
return true;
|
||||
|
||||
if (aoeType == TargetFindAOEType.Box && IsWithinBox(target, withPet))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsPlayer(Character target)
|
||||
{
|
||||
if (target is Player)
|
||||
return true;
|
||||
|
||||
// treat player owned pets as players too
|
||||
return TryGetMasterTarget(target) is Player;
|
||||
}
|
||||
|
||||
private Character TryGetMasterTarget(Character target)
|
||||
{
|
||||
// if character is a player owned pet, treat as a player
|
||||
if (target.aiContainer != null)
|
||||
{
|
||||
var controller = target.aiContainer.GetController();
|
||||
if (controller != null && controller is PetController)
|
||||
return ((PetController)controller).GetPetMaster();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool IsBattleNpcOwner(Character target)
|
||||
{
|
||||
// i know i copied this from dsp but what even
|
||||
if (!(owner is Player) || target is Player)
|
||||
return true;
|
||||
|
||||
// todo: check hate list
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,70 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||
{
|
||||
class PetController
|
||||
class PetController : Controller
|
||||
{
|
||||
private Character petMaster;
|
||||
|
||||
public PetController(Character owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.lastUpdate = Program.Tick;
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
// todo: handle player stuff on tick
|
||||
}
|
||||
|
||||
public override void ChangeTarget(Character target)
|
||||
{
|
||||
base.ChangeTarget(target);
|
||||
}
|
||||
|
||||
public override bool Engage(Character target)
|
||||
{
|
||||
// todo: check distance, last swing time, status effects
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Disengage()
|
||||
{
|
||||
// todo:
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Cast(Character target, uint spellId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Ability(Character target, uint abilityId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void RangedAttack(Character target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Character GetPetMaster()
|
||||
{
|
||||
return petMaster;
|
||||
}
|
||||
|
||||
public void SetPetMaster(Character master)
|
||||
{
|
||||
petMaster = master;
|
||||
|
||||
if (master is Player)
|
||||
owner.allegiance = CharacterTargetingAllegiance.Player;
|
||||
else
|
||||
owner.allegiance = CharacterTargetingAllegiance.BattleNpcs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this));
|
||||
this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
||||
this.hateContainer = new HateContainer(this);
|
||||
this.allegiance = CharacterTargetingAllegiance.BattleNpcs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,7 +388,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, animationName));
|
||||
}
|
||||
|
||||
|
||||
public void Despawn()
|
||||
{
|
||||
zone.DespawnActor(this);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
ushort actorState, uint animationId, string customDisplayName)
|
||||
: base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)
|
||||
{
|
||||
this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this));
|
||||
this.aiContainer = new AIContainer(this, new PetController(this), new PathFind(this), new TargetFind(this));
|
||||
this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
||||
this.hateContainer = new HateContainer(this);
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
lastPlayTimeUpdate = Utils.UnixTimeStampUTC();
|
||||
|
||||
this.aiContainer = new AIContainer(this, new PlayerController(this), null, new TargetFind(this));
|
||||
allegiance = CharacterTargetingAllegiance.Player;
|
||||
}
|
||||
|
||||
public List<SubPacket> Create0x132Packets()
|
||||
|
@ -285,6 +286,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams).DebugPrintSubPacket();
|
||||
|
||||
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams);
|
||||
}
|
||||
|
||||
|
@ -1427,8 +1429,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
private void SendGuildleveMarkClientUpdate(int slot)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this);
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveDone[{0}]", slot));
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveChecked[{0}]", slot));
|
||||
propPacketUtil.AddProperty(String.Format("work.guildleveId[{0}]", slot));
|
||||
QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||
playerActor.rotation = rot;
|
||||
playerActor.moveState = moveState;
|
||||
|
||||
GetActor().zone.UpdateActorPosition(GetActor());
|
||||
GetActor().GetZone().UpdateActorPosition(GetActor());
|
||||
playerActor.QueuePositionUpdate(new Vector3(x,y,z));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue