mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 13:17:45 +00:00
renamed mob stuff to battlenpc
- stubbed spawn/die/despawn functions
This commit is contained in:
parent
cc1929a9fb
commit
d895357182
10 changed files with 63 additions and 124 deletions
|
@ -88,7 +88,8 @@
|
|||
<Compile Include="actors\chara\ai\ActionQueue.cs" />
|
||||
<Compile Include="actors\chara\ai\AIContainer.cs" />
|
||||
<Compile Include="actors\chara\ai\controllers\Controller.cs" />
|
||||
<Compile Include="actors\chara\ai\controllers\MobController.cs" />
|
||||
<Compile Include="actors\chara\ai\controllers\BattleNpcController.cs" />
|
||||
<Compile Include="actors\chara\ai\controllers\PetController.cs" />
|
||||
<Compile Include="actors\chara\ai\controllers\PlayerController.cs" />
|
||||
<Compile Include="actors\chara\ai\HateContainer.cs" />
|
||||
<Compile Include="actors\chara\ai\PathFind.cs" />
|
||||
|
@ -98,9 +99,10 @@
|
|||
<Compile Include="actors\chara\ai\TargetFind.cs" />
|
||||
<Compile Include="actors\chara\ai\utils\AttackUtils.cs" />
|
||||
<Compile Include="actors\chara\npc\ActorClass.cs" />
|
||||
<Compile Include="actors\chara\npc\Mob.cs" />
|
||||
<Compile Include="actors\chara\npc\BattleNpc.cs" />
|
||||
<Compile Include="actors\chara\npc\NpcWork.cs" />
|
||||
<Compile Include="actors\chara\AetheryteWork.cs" />
|
||||
<Compile Include="actors\chara\npc\Pet.cs" />
|
||||
<Compile Include="actors\chara\player\Equipment.cs" />
|
||||
<Compile Include="actors\chara\player\Inventory.cs" />
|
||||
<Compile Include="actors\chara\Work.cs" />
|
||||
|
|
|
@ -643,9 +643,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
return currentSubState == SetActorStatePacket.SUB_STATE_PLAYER && this is Player ? ((Player)this) : null;
|
||||
}
|
||||
|
||||
public Mob GetAsMob()
|
||||
public BattleNpc GetAsMob()
|
||||
{
|
||||
return currentSubState == SetActorStatePacket.SUB_STATE_MONSTER && this is Mob ? ((Mob)this) : null;
|
||||
return currentSubState == SetActorStatePacket.SUB_STATE_MONSTER && this is BattleNpc ? ((BattleNpc)this) : null;
|
||||
}
|
||||
|
||||
public Npc GetAsNpc()
|
||||
|
|
|
@ -427,7 +427,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
Npc npc;
|
||||
|
||||
if(isMob)
|
||||
npc = new Mob(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
||||
npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
||||
else
|
||||
npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
||||
|
||||
|
|
|
@ -203,11 +203,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
// time elapsed since last ai update
|
||||
|
||||
if (aiContainer != null)
|
||||
{
|
||||
this.aiContainer.Update(tick);
|
||||
}
|
||||
|
||||
this.aiContainer?.Update(tick);
|
||||
|
||||
/*
|
||||
var diffTime = (tick - lastAiUpdate);
|
||||
|
||||
|
@ -369,7 +366,21 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public virtual void Spawn(DateTime tick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Die(DateTime tick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void Despawn(DateTime tick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -248,5 +248,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public void InternalDie(DateTime tick, uint timeToFadeout)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void InternalRaise(Character target)
|
||||
{
|
||||
// todo: place at target
|
||||
// ForceChangeState(new RaiseState(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
using System;
|
||||
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 MobController : Controller
|
||||
{
|
||||
public MobController(Character owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
this.lastUpdate = DateTime.Now;
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
// todo: handle aggro/deaggro and other shit here
|
||||
((Mob)this.owner).statusEffects.Update(tick);
|
||||
}
|
||||
|
||||
public override bool Engage(Character target)
|
||||
{
|
||||
// todo: check distance, last swing time, status effects
|
||||
this.owner.aiContainer.InternalEngage(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryEngage(Character target)
|
||||
{
|
||||
// todo:
|
||||
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 override void MobSkill(Character target, uint mobSkillId)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,7 +48,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
|
||||
public override void OnComplete()
|
||||
{
|
||||
var damage = FFXIVClassic_Map_Server.actors.chara.ai.utils.AttackUtils.CalculateDamage(owner, target);
|
||||
var damage = utils.AttackUtils.CalculateDamage(owner, target);
|
||||
|
||||
lua.LuaEngine.GetInstance().CallLuaFunction(owner, target, "onAttack", false, damage);
|
||||
|
||||
|
@ -73,29 +73,29 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
// todo: actually check proc rate/random chance of whatever effect
|
||||
effectId = list[0].GetEffectId();
|
||||
}
|
||||
this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, 0, 0, 0);
|
||||
owner.zone.BroadcastPacketAroundActor(owner, errorPacket);
|
||||
errorPacket = null;
|
||||
// todo: which is actually the swing packet
|
||||
//this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, 0, 0);
|
||||
//owner.zone.BroadcastPacketAroundActor(owner, errorPacket);
|
||||
//errorPacket = null;
|
||||
interrupt = true;
|
||||
return;
|
||||
}
|
||||
else if (target.zone != owner.zone)
|
||||
{
|
||||
interrupt = true;
|
||||
return;
|
||||
}
|
||||
else if (owner.aiContainer.IsDead())
|
||||
{
|
||||
// todo: this really shouldnt ever hit since we'd be clearing states on death
|
||||
interrupt = true;
|
||||
return;
|
||||
}
|
||||
interrupt = CanAttack();
|
||||
|
||||
interrupt = !CanAttack();
|
||||
}
|
||||
|
||||
private bool CanAttack()
|
||||
{
|
||||
if (target.aiContainer.IsDead())
|
||||
// todo: shouldnt need to check if owner is dead since all states would be cleared
|
||||
if (owner.aiContainer.IsDead() || target.aiContainer.IsDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (target.zone != owner.zone)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (target is Player && ((Player)target).playerSession.isUpdatesLocked)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
using FFXIVClassic_Map_Server.actors;
|
||||
using FFXIVClassic_Map_Server.actors.chara;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
class Mob : Npc
|
||||
{
|
||||
public HateContainer hateContainer;
|
||||
|
||||
public Mob(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot,
|
||||
ushort actorState, uint animationId, string customDisplayName)
|
||||
: base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)
|
||||
{
|
||||
this.aiContainer = new AIContainer(this, new MobController(this), new PathFind(this), new TargetFind(this));
|
||||
this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
||||
this.hateContainer = new HateContainer(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -536,11 +536,12 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
LuaParam.Insert(1, i - (playerNull ? 2 : 0));
|
||||
|
||||
// run the script
|
||||
//script.Call(script.Globals["onTrigger"], LuaParam.ToArray());
|
||||
script.Call(script.Globals["onTrigger"], LuaParam.ToArray());
|
||||
|
||||
Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine;
|
||||
DynValue value = coroutine.Resume(LuaParam.ToArray());
|
||||
GetInstance().ResolveResume(player, coroutine, value);
|
||||
// gm commands dont need to be coroutines?
|
||||
//Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine;
|
||||
//DynValue value = coroutine.Resume(LuaParam.ToArray());
|
||||
//ResolveResume(player, coroutine, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ using FFXIVClassic.Common;
|
|||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
||||
{
|
||||
// see xtx_command
|
||||
enum BattleActionX01PacketCommand : ushort
|
||||
{
|
||||
Disengage = 12002,
|
||||
Attack = 22104,
|
||||
}
|
||||
class BattleActionX01Packet
|
||||
{
|
||||
public const ushort OPCODE = 0x0139;
|
||||
|
|
Loading…
Add table
Reference in a new issue