mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-08-02 15:51:53 +02:00
moved battlenpc loading to db (still doesnt load for some reason)
This commit is contained in:
parent
68a2d5f0b9
commit
2bfaf376ef
18 changed files with 107 additions and 73 deletions
|
@ -395,6 +395,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
}
|
||||
|
||||
public int GetActorCount()
|
||||
{
|
||||
lock (mActorList)
|
||||
{
|
||||
return mActorList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual List<Actor> GetAllActors()
|
||||
{
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public Pet pet;
|
||||
|
||||
public Dictionary<Modifier, Int64> modifiers = new Dictionary<Modifier, long>();
|
||||
private Dictionary<Modifier, Int64> modifiers = new Dictionary<Modifier, long>();
|
||||
|
||||
protected ushort hpBase, hpMaxBase, mpBase, mpMaxBase, tpBase;
|
||||
protected BattleTemp baseStats = new BattleTemp();
|
||||
|
|
|
@ -11,8 +11,6 @@ using FFXIVClassic_Map_Server.packets.send.actor;
|
|||
// port of ai code in dsp by kjLotus (https://github.com/DarkstarProject/darkstar/blob/master/src/map/ai)
|
||||
namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
{
|
||||
// todo: actually implement stuff
|
||||
// todo: use spell/ability/ws/mobskill objects instead of looking up ids
|
||||
class AIContainer
|
||||
{
|
||||
private Character owner;
|
||||
|
|
|
@ -158,7 +158,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
|
||||
if (BattleUtils.CalculateSpellCost(user, target, this) > user.GetMP())
|
||||
{
|
||||
// todo: error message
|
||||
if (user is Player)
|
||||
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32545, 0x20, (uint)id);
|
||||
return false;
|
||||
|
|
|
@ -14,7 +14,7 @@ using FFXIVClassic_Map_Server.packets.send.actor;
|
|||
|
||||
namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
{
|
||||
// todo: path flags, check for obstacles etc
|
||||
// todo: check for obstacles, los, etc
|
||||
public enum PathFindFlags
|
||||
{
|
||||
None,
|
||||
|
@ -40,7 +40,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
PreparePath(dest.X, dest.Y, dest.Z, stepSize, maxPath, polyRadius);
|
||||
}
|
||||
|
||||
// todo: is this class even needed?
|
||||
public void PreparePath(float x, float y, float z, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f)
|
||||
{
|
||||
var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ);
|
||||
|
|
|
@ -75,10 +75,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||
if (owner.GetState() != SetActorStatePacket.MAIN_STATE_ACTIVE)
|
||||
owner.ChangeState(SetActorStatePacket.MAIN_STATE_ACTIVE);
|
||||
|
||||
|
||||
// todo: check speed/is able to move
|
||||
// todo: too far, path to player if mob, message if player
|
||||
// owner.ResetMoveSpeeds();
|
||||
owner.moveState = 2;
|
||||
lastActionTime = DateTime.Now;
|
||||
battleStartTime = lastActionTime;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
// todo: handle player stuff on tick
|
||||
// todo: handle pet stuff on tick
|
||||
}
|
||||
|
||||
public override void ChangeTarget(Character target)
|
||||
|
|
|
@ -21,10 +21,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||
|
||||
public override void Update(DateTime tick)
|
||||
{
|
||||
// todo: handle player stuff on tick
|
||||
if (owner.newMainState != owner.currentMainState)
|
||||
{
|
||||
//owner.updateFlags = ActorUpdateFlags.Combat;
|
||||
if (owner.newMainState == SetActorStatePacket.MAIN_STATE_ACTIVE)
|
||||
{
|
||||
owner.Engage();
|
||||
|
@ -48,8 +46,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||
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
|
||||
if (owner.statusEffects.HasStatusEffect(StatusEffectId.Sleep))
|
||||
{
|
||||
// That command cannot be performed.
|
||||
|
|
|
@ -23,12 +23,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
ChangeTarget(target);
|
||||
attackTime = startTime;
|
||||
owner.aiContainer.pathFind?.Clear();
|
||||
// todo: should handle everything here instead of on next tick..
|
||||
}
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
// todo: check within attack range
|
||||
|
||||
}
|
||||
|
||||
public override bool Update(DateTime tick)
|
||||
|
@ -150,6 +149,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
// todo: shouldnt need to check if owner is dead since all states would be cleared
|
||||
if (owner.aiContainer.IsDead() || target.aiContainer.IsDead())
|
||||
{
|
||||
if (owner is BattleNpc)
|
||||
((BattleNpc)owner).hateContainer.ClearHate(target);
|
||||
|
||||
owner.aiContainer.ChangeTarget(null);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,14 +23,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
{
|
||||
this.startPos = owner.GetPosAsVector3();
|
||||
this.startTime = DateTime.Now;
|
||||
// todo: lookup spell from global table
|
||||
this.spell = Server.GetWorldManager().GetBattleCommand(spellId);
|
||||
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicPrepare", owner, target, spell);
|
||||
|
||||
// todo: check recast
|
||||
if (returnCode == 0 && owner.CanCast(target, spell))
|
||||
{
|
||||
// todo: Azia can fix, check the recast time and send error
|
||||
OnStart();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -20,14 +20,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
base(owner, target)
|
||||
{
|
||||
this.startTime = DateTime.Now;
|
||||
// todo: lookup skill from global table
|
||||
this.skill = Server.GetWorldManager().GetBattleCommand(skillId);
|
||||
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillPrepare", owner, target, skill);
|
||||
|
||||
// todo: check recast
|
||||
if (returnCode == 0 && owner.CanWeaponSkill(target, skill))
|
||||
{
|
||||
// todo: Azia can fix, check the recast time and send error
|
||||
OnStart();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public Character lastAttacker;
|
||||
|
||||
public uint spellListId, skillListId, dropListId;
|
||||
public Dictionary<uint, BattleCommand> skillList = new Dictionary<uint, BattleCommand>();
|
||||
public Dictionary<uint, BattleCommand> spellList = new Dictionary<uint, BattleCommand>();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue