mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 21:27:46 +00:00
added modifier class
- added auto attack animation (<3 showmoltti) - added thing to send battle packet from lua
This commit is contained in:
parent
cbbfa4ed95
commit
9bb298b2f3
5 changed files with 45 additions and 9 deletions
|
@ -103,6 +103,7 @@
|
|||
<Compile Include="actors\chara\ai\TargetFind.cs" />
|
||||
<Compile Include="actors\chara\ai\utils\AttackUtils.cs" />
|
||||
<Compile Include="actors\chara\ai\utils\BattleUtils.cs" />
|
||||
<Compile Include="actors\chara\Modifier.cs" />
|
||||
<Compile Include="actors\chara\npc\ActorClass.cs" />
|
||||
<Compile Include="actors\chara\npc\BattleNpc.cs" />
|
||||
<Compile Include="actors\chara\npc\NpcWork.cs" />
|
||||
|
|
|
@ -8,6 +8,8 @@ using FFXIVClassic_Map_Server.utils;
|
|||
using FFXIVClassic_Map_Server.actors.chara.ai;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FFXIVClassic_Map_Server.actors.chara;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor.battle;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
|
@ -82,6 +84,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public Pet pet;
|
||||
|
||||
public Dictionary<Modifier, Int64> modifiers = new Dictionary<Modifier, long>();
|
||||
|
||||
public Character(uint actorID) : base(actorID)
|
||||
{
|
||||
//Init timer array to "notimer"
|
||||
|
@ -185,6 +189,21 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
}
|
||||
|
||||
public Int64 GetMod(uint modifier)
|
||||
{
|
||||
Int64 res;
|
||||
modifiers.TryGetValue((Modifier)modifier, out res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public void SetMod(uint modifier, Int64 val)
|
||||
{
|
||||
if (modifiers.ContainsKey((Modifier)modifier))
|
||||
modifiers[(Modifier)modifier] = val;
|
||||
else
|
||||
modifiers.Add((Modifier)modifier, val);
|
||||
}
|
||||
|
||||
public virtual void OnPath(Vector3 point)
|
||||
{
|
||||
lua.LuaEngine.CallLuaBattleAction(this, "onPath", this, point);
|
||||
|
@ -325,6 +344,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
// todo: should this include stats too?
|
||||
public virtual void RecalculateHpMpTp()
|
||||
{
|
||||
// legit fuck c#
|
||||
// todo: other shit too..
|
||||
meleeRange = GetMod((uint)Modifier.AttackRange);
|
||||
// todo: recalculate stats and crap
|
||||
updateFlags |= ActorUpdateFlags.HpTpMp;
|
||||
}
|
||||
|
|
|
@ -326,10 +326,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
return false;
|
||||
|
||||
bool targetingPlayer = target is Player;
|
||||
|
||||
|
||||
// todo: why is player always zoning?
|
||||
// cant target if zoning
|
||||
if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone || targetingPlayer && ((Player)target).playerSession.isUpdatesLocked)
|
||||
if (targetingPlayer && ((Player)target).playerSession.isUpdatesLocked)
|
||||
{
|
||||
owner.Disengage();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone)
|
||||
return false;
|
||||
|
||||
if (validTarget == ValidTarget.Self && aoeType != TargetFindAOEType.None && owner != target)
|
||||
|
|
|
@ -48,6 +48,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (owner.target.actorId != owner.currentLockedTarget)
|
||||
owner.aiContainer.ChangeTarget(Server.GetWorldManager().GetActorInWorld(owner.currentLockedTarget) as Character);
|
||||
|
||||
if (IsAttackReady())
|
||||
{
|
||||
if (CanAttack())
|
||||
|
@ -89,14 +93,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
{
|
||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||
{
|
||||
/*var packet = BattleActionX01Packet.BuildPacket(player.actorId, owner.actorId, owner.actorId, 0, 537094006, 0, 27260, (ushort)damage, 0);
|
||||
var packet = BattleActionX01Packet.BuildPacket(player.actorId, owner.actorId, target.actorId, (uint)0x19001000, (uint)0x8000604, (ushort)0x765D, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, (byte)0x1);
|
||||
player.QueuePacket(packet);
|
||||
Program.Log.Error("asudyaisydaisydaioysdaisydaiosdyaiosuydaisydiaosydioasydaiusdyaisduy");
|
||||
packet.DebugPrintSubPacket();
|
||||
*/
|
||||
}
|
||||
//if (target is Player)
|
||||
// ((Player)target).SendPacket("139_attack");
|
||||
}
|
||||
//target.DelHP((short)damage);
|
||||
attackTime = attackTime.AddMilliseconds(owner.GetAttackDelayMs());
|
||||
|
@ -147,7 +146,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else if (Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ) >= 7.5f)
|
||||
// todo: use a mod for melee range
|
||||
else if (Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ) > owner.meleeRange)
|
||||
{
|
||||
//owner.aiContainer.GetpathFind?.PreparePath(target.positionX, target.positionY, target.positionZ, 2.5f, 4);
|
||||
return false;
|
||||
|
|
|
@ -20,6 +20,7 @@ using FFXIVClassic_Map_Server.packets.send.group;
|
|||
using FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai;
|
||||
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor.battle;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
|
@ -1943,5 +1944,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
return firstSlot;
|
||||
}
|
||||
|
||||
public void SendBattleActionX01Packet(uint anim, uint effect, uint text = 0x756D, uint command = 27260, uint param = 0x01, uint idek = 0x01)
|
||||
{
|
||||
var packet = BattleActionX01Packet.BuildPacket(actorId, actorId, actorId, (uint)anim, (uint)effect, (ushort)text, (ushort)command, (ushort)param, (byte)idek);
|
||||
QueuePacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue