mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Merge branch 'ai-open' of https://bitbucket.org/takhlaq/ffxiv-classic-server into ai-open
This commit is contained in:
commit
9fc99faa5c
@ -148,15 +148,13 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
||||||
session.GetActor().currentTarget = setTarget.actorID;
|
session.GetActor().currentTarget = setTarget.actorID;
|
||||||
|
session.GetActor().isAutoAttackEnabled = setTarget.attackTarget != 0xE0000000;
|
||||||
session.GetActor().BroadcastPacket(SetActorTargetAnimatedPacket.BuildPacket(session.id, setTarget.actorID), true);
|
session.GetActor().BroadcastPacket(SetActorTargetAnimatedPacket.BuildPacket(session.id, setTarget.actorID), true);
|
||||||
break;
|
break;
|
||||||
//Lock Target
|
//Lock Target
|
||||||
case 0x00CC:
|
case 0x00CC:
|
||||||
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
||||||
session.GetActor().currentLockedTarget = lockTarget.actorID;
|
session.GetActor().currentLockedTarget = lockTarget.actorID;
|
||||||
// todo: this really needs figuring out..
|
|
||||||
session.GetActor().isAutoAttackEnabled = lockTarget.otherVal == 0x00000040;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Start Event
|
//Start Event
|
||||||
case 0x012D:
|
case 0x012D:
|
||||||
|
@ -547,8 +547,9 @@ namespace FFXIVClassic_Map_Server
|
|||||||
z.SpawnAllActors(true);
|
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
|
// 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)))
|
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)))
|
||||||
{
|
{
|
||||||
@ -582,7 +583,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
area = area ?? Server.GetWorldManager().GetZone(reader.GetUInt16("zoneId"));
|
area = area ?? Server.GetWorldManager().GetZone(reader.GetUInt16("zoneId"));
|
||||||
int actorId = area.GetActorCount() + 1;
|
int actorId = area.GetActorCount() + 1;
|
||||||
var bnpc = area.GetBattleNpcById(id);
|
bnpc = area.GetBattleNpcById(id);
|
||||||
|
|
||||||
if (bnpc != null)
|
if (bnpc != null)
|
||||||
{
|
{
|
||||||
@ -644,7 +645,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
battleNpc.CalculateBaseStats();
|
battleNpc.CalculateBaseStats();
|
||||||
battleNpc.RecalculateStats();
|
battleNpc.RecalculateStats();
|
||||||
//battleNpc.SetMod((uint)Modifier.ResistFire, )
|
//battleNpc.SetMod((uint)Modifier.ResistFire, )
|
||||||
|
bnpc = battleNpc;
|
||||||
area.AddActorToZone(battleNpc);
|
area.AddActorToZone(battleNpc);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -660,6 +661,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return bnpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadBattleNpcModifiers(string tableName, string primaryKey, Dictionary<uint, ModifierList> list)
|
public void LoadBattleNpcModifiers(string tableName, string primaryKey, Dictionary<uint, ModifierList> list)
|
||||||
|
@ -33,6 +33,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
class Actor
|
class Actor
|
||||||
{
|
{
|
||||||
|
public static uint INVALID_ACTORID = 0xC0000000;
|
||||||
public uint actorId;
|
public uint actorId;
|
||||||
public string actorName;
|
public string actorName;
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public uint animationId = 0;
|
public uint animationId = 0;
|
||||||
|
|
||||||
public uint currentTarget = 0xC0000000;
|
public uint currentTarget = Actor.INVALID_ACTORID;
|
||||||
public uint currentLockedTarget = 0xC0000000;
|
public uint currentLockedTarget = Actor.INVALID_ACTORID;
|
||||||
|
|
||||||
public uint currentActorIcon = 0;
|
public uint currentActorIcon = 0;
|
||||||
|
|
||||||
@ -391,9 +391,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
if (targid == 0)
|
if (targid == 0)
|
||||||
{
|
{
|
||||||
if (currentTarget != 0xC0000000)
|
if (currentTarget != Actor.INVALID_ACTORID)
|
||||||
targid = currentTarget;
|
targid = currentTarget;
|
||||||
else if (currentLockedTarget != 0xC0000000)
|
else if (currentLockedTarget != Actor.INVALID_ACTORID)
|
||||||
targid = currentLockedTarget;
|
targid = currentLockedTarget;
|
||||||
}
|
}
|
||||||
//if (targid != 0)
|
//if (targid != 0)
|
||||||
@ -416,7 +416,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
this.newMainState = newMainState;
|
this.newMainState = newMainState;
|
||||||
}
|
}
|
||||||
else
|
else if (IsEngaged())
|
||||||
{
|
{
|
||||||
aiContainer.Disengage();
|
aiContainer.Disengage();
|
||||||
return true;
|
return true;
|
||||||
|
@ -153,11 +153,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||||||
waitTime = tick.AddSeconds(10);
|
waitTime = tick.AddSeconds(10);
|
||||||
owner.OnRoam(tick);
|
owner.OnRoam(tick);
|
||||||
|
|
||||||
if (!owner.aiContainer.pathFind.IsFollowingPath() && CanMoveForward(0.0f))
|
if (CanMoveForward(0.0f) && !owner.aiContainer.pathFind.IsFollowingPath())
|
||||||
{
|
{
|
||||||
// will move on next tick
|
// will move on next tick
|
||||||
owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None);
|
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)
|
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))
|
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)
|
public override void ChangeTarget(Character target)
|
||||||
{
|
{
|
||||||
owner.target = target;
|
owner.target = target;
|
||||||
owner.currentLockedTarget = target?.actorId ?? 0xC0000000;
|
owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||||
owner.currentTarget = target?.actorId ?? 0xC0000000;
|
owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||||
|
|
||||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||||
player.QueuePacket(owner.GetHateTypePacket(player));
|
player.QueuePacket(owner.GetHateTypePacket(player));
|
||||||
|
@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.receive
|
|||||||
{
|
{
|
||||||
public bool invalidPacket = false;
|
public bool invalidPacket = false;
|
||||||
public uint actorID;
|
public uint actorID;
|
||||||
public uint otherVal; //Usually 0xE0000000
|
public uint attackTarget; //Usually 0xE0000000
|
||||||
|
|
||||||
public SetTargetPacket(byte[] data)
|
public SetTargetPacket(byte[] data)
|
||||||
{
|
{
|
||||||
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.packets.receive
|
|||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
actorID = binReader.ReadUInt32();
|
actorID = binReader.ReadUInt32();
|
||||||
otherVal = binReader.ReadUInt32();
|
attackTarget = binReader.ReadUInt32();
|
||||||
}
|
}
|
||||||
catch (Exception){
|
catch (Exception){
|
||||||
invalidPacket = true;
|
invalidPacket = true;
|
||||||
|
@ -4,35 +4,35 @@ require ("weaponskill")
|
|||||||
|
|
||||||
allyGlobal =
|
allyGlobal =
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
function allyGlobal.onSpawn(ally, target)
|
function allyGlobal.onSpawn(ally, target)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onEngage(ally, target)
|
function allyGlobal.onEngage(ally, target)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onAttack(ally, target, damage)
|
function allyGlobal.onAttack(ally, target, damage)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onDamageTaken(ally, attacker, damage)
|
function allyGlobal.onDamageTaken(ally, attacker, damage)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas)
|
function allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas)
|
||||||
allyGlobal.HelpPlayers(ally, contentGroupCharas);
|
allyGlobal.HelpPlayers(ally, contentGroupCharas)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onDeath(ally, player, lastAttacker)
|
function allyGlobal.onDeath(ally, player, lastAttacker)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.onDespawn(ally)
|
function allyGlobal.onDespawn(ally)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
|
function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
|
||||||
if contentGroupCharas then
|
if contentGroupCharas then
|
||||||
@ -44,35 +44,37 @@ function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget)
|
|||||||
-- do stuff
|
-- do stuff
|
||||||
if not ally.IsEngaged() then
|
if not ally.IsEngaged() then
|
||||||
if chara.IsEngaged() then
|
if chara.IsEngaged() then
|
||||||
allyGlobal.EngageTarget(ally, target, nil);
|
allyGlobal.EngageTarget(ally, chara.target, nil)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
elseif chara.IsMonster() and chara.IsEngaged() then
|
elseif chara.IsMonster() and chara.IsEngaged() then
|
||||||
|
if not ally.IsEngaged() then
|
||||||
end;
|
allyGlobal.EngageTarget(ally, chara.target, nil)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function allyGlobal.HealPlayer(ally, player)
|
function allyGlobal.HealPlayer(ally, player)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.SupportAction(ally, player)
|
function allyGlobal.SupportAction(ally, player)
|
||||||
|
|
||||||
end;
|
end
|
||||||
|
|
||||||
function allyGlobal.EngageTarget(ally, target, contentGroupCharas)
|
function allyGlobal.EngageTarget(ally, target, contentGroupCharas)
|
||||||
if contentGroupCharas then
|
if contentGroupCharas then
|
||||||
for _, chara in pairs(contentGroupCharas) do
|
for _, chara in pairs(contentGroupCharas) do
|
||||||
if chara.IsMonster() then
|
if chara.IsMonster() then
|
||||||
if chara.allegiance ~= ally.allegiance then
|
if chara.allegiance ~= ally.allegiance then
|
||||||
ally.Engage(chara);
|
ally.Engage(chara)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
elseif target then
|
elseif target then
|
||||||
ally.Engage(target);
|
ally.Engage(target)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
@ -14,29 +14,30 @@ function onCreateContentArea(players, director, contentArea, contentGroup)
|
|||||||
|
|
||||||
local worldManager = GetWorldManager();
|
local worldManager = GetWorldManager();
|
||||||
|
|
||||||
yshtola = GetWorldManager():SpawnBattleNpcById(6, contentArea);
|
yshtola = GetWorldManager().SpawnBattleNpcById(6, contentArea);
|
||||||
stahlmann = GetWorldManager():SpawnBattleNpcById(7, contentArea);
|
stahlmann = GetWorldManager().SpawnBattleNpcById(7, contentArea);
|
||||||
|
|
||||||
mob1 = GetWorldManager():SpawnBattleNpcById(3, contentArea);
|
mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea);
|
||||||
mob2 = GetWorldManager():SpawnBattleNpcById(4, contentArea);
|
mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea);
|
||||||
mob3 = GetWorldManager():SpawnBattleNpcById(5, contentArea);
|
mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea);
|
||||||
|
|
||||||
local added = false;
|
local added = false;
|
||||||
for i = 0, players.Count do
|
for i = 0, players.Count do
|
||||||
local player = players[i];
|
local player = players[i];
|
||||||
|
print("asses "..players.Count)
|
||||||
if player.currentParty and not added then
|
if player.currentParty and not added then
|
||||||
player.currentParty.members.Add(6);
|
print("shitness")
|
||||||
|
player.currentParty.members:Add(yshtola.actorId);
|
||||||
print("cunt")
|
print("cunt")
|
||||||
player.currentParty.members.Add(7);
|
player.currentParty.members:Add(stahlmann.actorId);
|
||||||
print("dickbag")
|
print("dickbag")
|
||||||
added = true;
|
added = true;
|
||||||
end;
|
end;
|
||||||
-- dont let player die
|
-- dont let player die
|
||||||
player.SetMod(modifiersGlobal.MinimumHpLock, 1);
|
player:SetMod(modifiersGlobal.MinimumHpLock, 1);
|
||||||
|
contentGroup:AddMember(player)
|
||||||
print("shittttt")
|
print("shittttt")
|
||||||
contentGroup:AddMember(player);
|
break
|
||||||
player:EndEvent();
|
|
||||||
i = i + 1;
|
|
||||||
end;
|
end;
|
||||||
print("shit")
|
print("shit")
|
||||||
contentGroup:AddMember(director);
|
contentGroup:AddMember(director);
|
||||||
|
@ -3,9 +3,9 @@ require ("global")
|
|||||||
require ("ally")
|
require ("ally")
|
||||||
|
|
||||||
function onSpawn(ally)
|
function onSpawn(ally)
|
||||||
ally.isAutoAttackEnabled = false;
|
ally.isAutoAttackEnabled = false
|
||||||
end;
|
end
|
||||||
|
|
||||||
function onCombatTick(ally, target, tick, contentGroupCharas)
|
function onCombatTick(ally, target, tick, contentGroupCharas)
|
||||||
allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas);
|
allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas)
|
||||||
end;
|
end
|
Loading…
Reference in New Issue
Block a user