2019-06-18 22:55:32 -04:00
|
|
|
|
/*
|
|
|
|
|
===========================================================================
|
|
|
|
|
Copyright (C) 2015-2019 Project Meteor Dev Team
|
|
|
|
|
|
|
|
|
|
This file is part of Project Meteor Server.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|
|
|
|
===========================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
2019-06-19 01:10:15 -04:00
|
|
|
|
using Meteor.Map.Actors;
|
2017-06-12 03:50:02 +01:00
|
|
|
|
|
2019-06-19 01:10:15 -04:00
|
|
|
|
namespace Meteor.Map.actors.chara.ai.controllers
|
2017-06-12 03:50:02 +01:00
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
2018-04-18 16:06:41 -05:00
|
|
|
|
/*
|
2017-08-31 05:56:43 +01:00
|
|
|
|
if (owner.newMainState != owner.currentMainState)
|
|
|
|
|
{
|
|
|
|
|
if (owner.newMainState == SetActorStatePacket.MAIN_STATE_ACTIVE)
|
|
|
|
|
{
|
|
|
|
|
owner.Engage();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
owner.Disengage();
|
|
|
|
|
}
|
|
|
|
|
owner.currentMainState = (ushort)owner.newMainState;
|
2018-04-18 16:06:41 -05:00
|
|
|
|
}*/
|
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)
|
|
|
|
|
{
|
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-09-05 05:05:25 +01:00
|
|
|
|
|
|
|
|
|
public override void UseItem(Character target, uint slot, uint itemId)
|
|
|
|
|
{
|
|
|
|
|
owner.aiContainer.InternalUseItem(target, slot, itemId);
|
|
|
|
|
}
|
2017-06-12 03:50:02 +01:00
|
|
|
|
}
|
|
|
|
|
}
|