1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-22 20:57:47 +00:00

fixed auto attack (<3 showmo)

This commit is contained in:
Tahir Akhlaq 2017-10-03 07:32:32 +01:00
parent 56491266cc
commit bab81a809c
6 changed files with 19 additions and 18 deletions

View file

@ -148,15 +148,13 @@ namespace FFXIVClassic_Map_Server
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
session.GetActor().currentTarget = setTarget.actorID;
session.GetActor().isAutoAttackEnabled = setTarget.attackTarget != 0xE0000000;
session.GetActor().BroadcastPacket(SetActorTargetAnimatedPacket.BuildPacket(session.id, setTarget.actorID), true);
break;
//Lock Target
case 0x00CC:
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
session.GetActor().currentLockedTarget = lockTarget.actorID;
// todo: this really needs figuring out..
session.GetActor().isAutoAttackEnabled = lockTarget.otherVal == 0x00000040;
break;
//Start Event
case 0x012D:

View file

@ -546,8 +546,9 @@ namespace FFXIVClassic_Map_Server
z.SpawnAllActors(true);
}
public void SpawnBattleNpcById(uint id, Area area = null)
public BattleNpc SpawnBattleNpcById(uint id, Area area = null)
{
BattleNpc bnpc = null;
// todo: this is stupid duplicate code and really needs to die, think of a better way later
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
{
@ -581,7 +582,7 @@ namespace FFXIVClassic_Map_Server
{
area = area ?? Server.GetWorldManager().GetZone(reader.GetUInt16("zoneId"));
int actorId = area.GetActorCount() + 1;
var bnpc = area.GetBattleNpcById(id);
bnpc = area.GetBattleNpcById(id);
if (bnpc != null)
{
@ -643,7 +644,7 @@ namespace FFXIVClassic_Map_Server
battleNpc.CalculateBaseStats();
battleNpc.RecalculateStats();
//battleNpc.SetMod((uint)Modifier.ResistFire, )
bnpc = battleNpc;
area.AddActorToZone(battleNpc);
count++;
}
@ -659,6 +660,7 @@ namespace FFXIVClassic_Map_Server
conn.Dispose();
}
}
return bnpc;
}
public void LoadBattleNpcModifiers(string tableName, string primaryKey, Dictionary<uint, ModifierList> list)

View file

@ -33,6 +33,7 @@ namespace FFXIVClassic_Map_Server.Actors
class Actor
{
public static uint INVALID_ACTORID = 0xC0000000;
public uint actorId;
public string actorName;

View file

@ -84,8 +84,8 @@ namespace FFXIVClassic_Map_Server.Actors
public uint animationId = 0;
public uint currentTarget = 0xC0000000;
public uint currentLockedTarget = 0xC0000000;
public uint currentTarget = Actor.INVALID_ACTORID;
public uint currentLockedTarget = Actor.INVALID_ACTORID;
public uint currentActorIcon = 0;
@ -391,9 +391,9 @@ namespace FFXIVClassic_Map_Server.Actors
{
if (targid == 0)
{
if (currentTarget != 0xC0000000)
if (currentTarget != Actor.INVALID_ACTORID)
targid = currentTarget;
else if (currentLockedTarget != 0xC0000000)
else if (currentLockedTarget != Actor.INVALID_ACTORID)
targid = currentLockedTarget;
}
//if (targid != 0)
@ -416,7 +416,7 @@ namespace FFXIVClassic_Map_Server.Actors
{
this.newMainState = newMainState;
}
else
else if (IsEngaged())
{
aiContainer.Disengage();
return true;

View file

@ -153,11 +153,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
waitTime = tick.AddSeconds(10);
owner.OnRoam(tick);
if (!owner.aiContainer.pathFind.IsFollowingPath() && CanMoveForward(0.0f))
if (CanMoveForward(0.0f) && !owner.aiContainer.pathFind.IsFollowingPath())
{
// will move on next tick
owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None);
owner.aiContainer.pathFind.PathInRange(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 20.0f);
owner.aiContainer.pathFind.PathInRange(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 50.0f);
}
}
@ -173,7 +173,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
if (!owner.isMovingToSpawn && owner.aiContainer.pathFind.AtPoint() && owner.detectionType != DetectionType.None)
{
uint levelDifference = (uint)Math.Abs(owner.charaWork.parameterSave.state_mainSkillLevel - chara.charaWork.parameterSave.state_mainSkillLevel);
uint levelDifference = (uint)Math.Abs(owner.GetLevel() - chara.GetLevel());
if (levelDifference <= 10 || (owner.detectionType & DetectionType.IgnoreLevelDifference) != 0 && CanAggroTarget(chara))
{
@ -375,8 +375,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
public override void ChangeTarget(Character target)
{
owner.target = target;
owner.currentLockedTarget = target?.actorId ?? 0xC0000000;
owner.currentTarget = target?.actorId ?? 0xC0000000;
owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID;
owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID;
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
player.QueuePacket(owner.GetHateTypePacket(player));

View file

@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.receive
{
public bool invalidPacket = false;
public uint actorID;
public uint otherVal; //Usually 0xE0000000
public uint attackTarget; //Usually 0xE0000000
public SetTargetPacket(byte[] data)
{
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.packets.receive
{
try{
actorID = binReader.ReadUInt32();
otherVal = binReader.ReadUInt32();
attackTarget = binReader.ReadUInt32();
}
catch (Exception){
invalidPacket = true;