2017-06-12 03:50:02 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-06-12 20:13:26 +01:00
|
|
|
|
using FFXIVClassic_Map_Server.Actors;
|
2017-08-02 23:06:11 +01:00
|
|
|
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
|
|
|
|
using FFXIVClassic.Common;
|
2017-06-12 03:50:02 +01:00
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|
|
|
|
{
|
|
|
|
|
class PlayerController : Controller
|
|
|
|
|
{
|
2017-08-31 05:56:43 +01:00
|
|
|
|
private new Player owner;
|
|
|
|
|
public PlayerController(Player owner) :
|
2017-08-02 23:06:11 +01:00
|
|
|
|
base(owner)
|
2017-06-12 20:13:26 +01:00
|
|
|
|
{
|
2017-08-31 05:56:43 +01:00
|
|
|
|
this.owner = owner;
|
2017-06-12 20:13:26 +01:00
|
|
|
|
this.lastUpdate = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Update(DateTime tick)
|
|
|
|
|
{
|
2017-06-15 21:00:51 +01:00
|
|
|
|
// todo: handle player stuff on tick
|
2017-08-31 05:56:43 +01:00
|
|
|
|
if (owner.newMainState != owner.currentMainState)
|
|
|
|
|
{
|
|
|
|
|
//owner.updateFlags = ActorUpdateFlags.Combat;
|
|
|
|
|
if (owner.newMainState == SetActorStatePacket.MAIN_STATE_ACTIVE)
|
|
|
|
|
{
|
|
|
|
|
owner.Engage();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
owner.Disengage();
|
|
|
|
|
}
|
|
|
|
|
owner.currentMainState = (ushort)owner.newMainState;
|
|
|
|
|
}
|
2017-06-12 20:13:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ChangeTarget(Character target)
|
|
|
|
|
{
|
2017-08-31 05:56:43 +01:00
|
|
|
|
owner.target = target;
|
2017-06-12 20:13:26 +01:00
|
|
|
|
base.ChangeTarget(target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Engage(Character target)
|
|
|
|
|
{
|
2017-08-02 23:06:11 +01:00
|
|
|
|
var canEngage = this.owner.aiContainer.InternalEngage(target);
|
|
|
|
|
if (canEngage)
|
|
|
|
|
{
|
|
|
|
|
// todo: check speed/is able to move
|
|
|
|
|
// todo: too far, path to player if mob, message if player
|
2017-08-31 05:56:43 +01:00
|
|
|
|
if (owner.statusEffects.HasStatusEffect(StatusEffectId.Sleep))
|
2017-08-02 23:06:11 +01:00
|
|
|
|
{
|
2017-08-31 05:56:43 +01:00
|
|
|
|
// That command cannot be performed.
|
|
|
|
|
owner.SendGameMessage(Server.GetWorldManager().GetActor(), 32553, 0x20);
|
2017-08-02 23:06:11 +01:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// todo: adjust cooldowns with modifiers
|
|
|
|
|
}
|
|
|
|
|
return canEngage;
|
2017-06-12 20:13:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-02 23:06:11 +01:00
|
|
|
|
public override void Disengage()
|
2017-06-12 20:13:26 +01:00
|
|
|
|
{
|
|
|
|
|
// todo:
|
2017-08-24 16:36:56 +01:00
|
|
|
|
base.Disengage();
|
2017-08-02 23:06:11 +01:00
|
|
|
|
return;
|
2017-06-12 20:13:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Cast(Character target, uint spellId)
|
|
|
|
|
{
|
2017-08-25 03:52:43 +01:00
|
|
|
|
owner.aiContainer.InternalCast(target, spellId);
|
2017-06-12 20:13:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-08-28 04:45:20 +01:00
|
|
|
|
public override void WeaponSkill(Character target, uint weaponSkillId)
|
|
|
|
|
{
|
|
|
|
|
owner.aiContainer.InternalWeaponSkill(target, weaponSkillId);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 20:13:26 +01:00
|
|
|
|
public override void Ability(Character target, uint abilityId)
|
|
|
|
|
{
|
2017-08-26 17:39:28 +01:00
|
|
|
|
owner.aiContainer.InternalAbility(target, abilityId);
|
2017-06-12 20:13:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void RangedAttack(Character target)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2017-06-12 03:50:02 +01:00
|
|
|
|
}
|
|
|
|
|
}
|