mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	fixed mobs not pathing
- fixed roaming (todo: should probably move to attackstate too or something)
This commit is contained in:
		| @@ -41,7 +41,7 @@ namespace FFXIVClassic_Map_Server | |||||||
|  |  | ||||||
|         private Server mServer; |         private Server mServer; | ||||||
|  |  | ||||||
|         private const int MILIS_LOOPTIME = 333; |         private const int MILIS_LOOPTIME = 250; | ||||||
|         private Timer mZoneTimer; |         private Timer mZoneTimer; | ||||||
|  |  | ||||||
|         //Content Groups |         //Content Groups | ||||||
| @@ -1156,10 +1156,10 @@ namespace FFXIVClassic_Map_Server | |||||||
|             abilityList = Database.LoadGlobalAbilityList(); |             abilityList = Database.LoadGlobalAbilityList(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public Ability GetAbility(ushort id) |         public Ability GetAbility(uint id) | ||||||
|         { |         { | ||||||
|             Ability ability; |             Ability ability; | ||||||
|             return abilityList.TryGetValue(id, out ability) ? ability.Clone() : null; |             return abilityList.TryGetValue((ushort)id, out ability) ? ability.Clone() : null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -310,6 +310,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|  |  | ||||||
|         public void InternalDie(DateTime tick, uint timeToFadeout) |         public void InternalDie(DateTime tick, uint timeToFadeout) | ||||||
|         { |         { | ||||||
|  |             if (true) return; | ||||||
|             ClearStates(); |             ClearStates(); | ||||||
|             Disengage(); |             Disengage(); | ||||||
|             ForceChangeState(new DeathState(owner, tick, timeToFadeout)); |             ForceChangeState(new DeathState(owner, tick, timeToFadeout)); | ||||||
|   | |||||||
| @@ -131,8 +131,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public bool AtPoint(Vector3 point) |         public bool AtPoint(Vector3 point = null) | ||||||
|         { |         { | ||||||
|  |             if (point == null && path != null && path.Count > 0) | ||||||
|  |             { | ||||||
|  |                 point = path[path.Count - 1]; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             if (distanceFromPoint == 0) |             if (distanceFromPoint == 0) | ||||||
|                 return owner.positionX == point.X && owner.positionZ == point.Z; |                 return owner.positionX == point.X && owner.positionZ == point.Z; | ||||||
|             else |             else | ||||||
|   | |||||||
| @@ -97,7 +97,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|                 { |                 { | ||||||
|                     // todo: send packet to client with effect added message |                     // todo: send packet to client with effect added message | ||||||
|                     foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) |                     foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) | ||||||
|                         player.QueuePacket(packets.send.actor.battle.BattleActionX01Packet.BuildPacket(player.actorId, newEffect.GetSource().actorId, owner.actorId, 0, newEffect.GetStatusEffectId(), 0, newEffect.GetStatusId(), 0, 0)); |                         player.QueuePacket(packets.send.actor.battle.BattleActionX01Packet.BuildPacket(player.actorId, owner.actorId, owner.actorId, 0, newEffect.GetStatusEffectId(), 0, newEffect.GetStatusId(), 0, 0)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 // wont send a message about losing effect here |                 // wont send a message about losing effect here | ||||||
|   | |||||||
| @@ -157,7 +157,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers | |||||||
|                 { |                 { | ||||||
|                     if (tick >= lastActionTime) |                     if (tick >= lastActionTime) | ||||||
|                     { |                     { | ||||||
|  |                         var battlenpc = owner as BattleNpc; | ||||||
|  |                         owner.aiContainer.pathFind.PathInRange(battlenpc.spawnX, battlenpc.spawnY, battlenpc.spawnZ, 1.5f, 15.0f); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 // todo: |                 // todo: | ||||||
| @@ -208,7 +209,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers | |||||||
|                     if (!owner.aiContainer.pathFind.IsFollowingPath() && distance > 3) |                     if (!owner.aiContainer.pathFind.IsFollowingPath() && distance > 3) | ||||||
|                     { |                     { | ||||||
|                         // pathfind if too far otherwise jump to target |                         // pathfind if too far otherwise jump to target | ||||||
|                         owner.aiContainer.pathFind.SetPathFlags(distance > 5 ? PathFindFlags.None : PathFindFlags.IgnoreNav ); |                         owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None); | ||||||
|                         owner.aiContainer.pathFind.PreparePath(targetPos, 1.5f, 5); |                         owner.aiContainer.pathFind.PreparePath(targetPos, 1.5f, 5); | ||||||
|                     } |                     } | ||||||
|                     owner.aiContainer.pathFind.FollowPath(); |                     owner.aiContainer.pathFind.FollowPath(); | ||||||
| @@ -221,8 +222,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers | |||||||
|                                 if (battlenpc == owner) |                                 if (battlenpc == owner) | ||||||
|                                     continue; |                                     continue; | ||||||
|                                 float mobDistance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, battlenpc.positionX, battlenpc.positionY, battlenpc.positionZ); |                                 float mobDistance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, battlenpc.positionX, battlenpc.positionY, battlenpc.positionZ); | ||||||
|                                 if (mobDistance < 0.3f && (battlenpc.updateFlags & ActorUpdateFlags.Position) == 0) |                                 if (mobDistance < 0.25f && (battlenpc.updateFlags & ActorUpdateFlags.Position) == 0) | ||||||
|                                     battlenpc.aiContainer.pathFind.PathInRange(targetPos, 1.5f, 1.5f); |                                     battlenpc.aiContainer.pathFind.PathInRange(targetPos, 1.3f, 1.8f); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
| @@ -278,6 +279,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers | |||||||
|  |  | ||||||
|         public bool CanDetectTarget(Character target, bool forceSight = false) |         public bool CanDetectTarget(Character target, bool forceSight = false) | ||||||
|         { |         { | ||||||
|  |             // todo: this should probably be changed to only allow detection at end of path? | ||||||
|  |             if (owner.aiContainer.pathFind.IsFollowingScriptedPath() || owner.aiContainer.pathFind.IsFollowingPath() && !owner.aiContainer.pathFind.AtPoint()) | ||||||
|  |             { | ||||||
|  |                 return false; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             // todo: handle sight/scent/hp etc |             // todo: handle sight/scent/hp etc | ||||||
|             if (target.IsDead() || target.currentMainState == SetActorStatePacket.MAIN_STATE_MOUNTED) |             if (target.IsDead() || target.currentMainState == SetActorStatePacket.MAIN_STATE_MOUNTED) | ||||||
|                 return false; |                 return false; | ||||||
|   | |||||||
| @@ -89,15 +89,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state | |||||||
|             { |             { | ||||||
|                 foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) |                 foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) | ||||||
|                 { |                 { | ||||||
|                     var packet = BattleActionX01Packet.BuildPacket(player.actorId, owner.actorId, target.actorId, 0, 537094006, 0, 27260, (ushort)damage, 0); |                     /*var packet = BattleActionX01Packet.BuildPacket(player.actorId, owner.actorId, owner.actorId, 0, 537094006, 0, 27260, (ushort)damage, 0); | ||||||
|                     player.QueuePacket(packet); |                     player.QueuePacket(packet); | ||||||
|                     Program.Log.Error("asudyaisydaisydaioysdaisydaiosdyaiosuydaisydiaosydioasydaiusdyaisduy"); |                     Program.Log.Error("asudyaisydaisydaioysdaisydaiosdyaiosuydaisydiaosydioasydaiusdyaisduy"); | ||||||
|                     packet.DebugPrintSubPacket(); |                     packet.DebugPrintSubPacket(); | ||||||
|  |                     */ | ||||||
|                 } |                 } | ||||||
|                 if (target is Player) |                 //if (target is Player) | ||||||
|                     ((Player)target).SendPacket("139_attack"); |                 //    ((Player)target).SendPacket("139_attack"); | ||||||
|             } |             } | ||||||
|             target.DelHP((short)damage); |             //target.DelHP((short)damage); | ||||||
|             attackTime = attackTime.AddMilliseconds(owner.GetAttackDelayMs()); |             attackTime = attackTime.AddMilliseconds(owner.GetAttackDelayMs()); | ||||||
|             owner.LookAt(target); |             owner.LookAt(target); | ||||||
|            //this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0); |            //this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0); | ||||||
|   | |||||||
| @@ -27,8 +27,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state | |||||||
|             { |             { | ||||||
|                 if (owner.currentSubState == SetActorStatePacket.SUB_STATE_PLAYER) |                 if (owner.currentSubState == SetActorStatePacket.SUB_STATE_PLAYER) | ||||||
|                 { |                 { | ||||||
|  |                     // todo: mark for zoning and remove after main loop | ||||||
|                     owner.ChangeState(SetActorStatePacket.MAIN_STATE_PASSIVE); |                     owner.ChangeState(SetActorStatePacket.MAIN_STATE_PASSIVE); | ||||||
|                     Server.GetWorldManager().DoZoneChange(((Player)owner), 244, null, 0, 15, -160.048f, 0, -165.737f, 0.0f); |                     //Server.GetWorldManager().DoZoneChange(((Player)owner), 244, null, 0, 15, -160.048f, 0, -165.737f, 0.0f); | ||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                 { |                 { | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|         private uint despawnTime; |         private uint despawnTime; | ||||||
|         private uint spawnDistance; |         private uint spawnDistance; | ||||||
|  |  | ||||||
|         private float spawnX, spawnY, spawnZ; |         public float spawnX, spawnY, spawnZ; | ||||||
|         public BattleNpc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, |         public BattleNpc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, | ||||||
|             ushort actorState, uint animationId, string customDisplayName) |             ushort actorState, uint animationId, string customDisplayName) | ||||||
|             : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)   |             : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)   | ||||||
| @@ -85,6 +85,7 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|                 propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]"); |                 propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]"); | ||||||
|                 packets.AddRange(propPacketUtil.Done()); |                 packets.AddRange(propPacketUtil.Done()); | ||||||
|             } |             } | ||||||
|  |             base.PostUpdate(tick); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public override bool CanAttack() |         public override bool CanAttack() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user