1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-24 13:47:46 +00:00

Target flag and bug fixes

Add new flags for MainTarget's party, which allows for Protect to buff
other parties.

Fixed incorrect script function calls
Fixed bug causing World server to get stuck in a loop
This commit is contained in:
Yogurt 2019-05-29 22:59:24 -07:00
parent 6127ad44cc
commit 4f80023156
7 changed files with 65 additions and 32 deletions

View file

@ -2413,8 +2413,8 @@ namespace FFXIVClassic_Map_Server
battleCommand.job = reader.GetByte("classJob");
battleCommand.level = reader.GetByte("lvl");
battleCommand.requirements = (BattleCommandRequirements)reader.GetUInt16("requirements");
battleCommand.mainTarget = (ValidTarget)reader.GetByte("mainTarget");
battleCommand.validTarget = (ValidTarget)reader.GetByte("validTarget");
battleCommand.mainTarget = (ValidTarget)reader.GetUInt16("mainTarget");
battleCommand.validTarget = (ValidTarget)reader.GetUInt16("validTarget");
battleCommand.aoeType = (TargetFindAOEType)reader.GetByte("aoeType");
battleCommand.basePotency = reader.GetUInt16("basePotency");
battleCommand.numHits = reader.GetByte("numHits");
@ -2454,7 +2454,26 @@ namespace FFXIVClassic_Map_Server
battleCommand.actionType = (ActionType)reader.GetInt16("actionType");
battleCommand.accuracyModifier = reader.GetFloat("accuracyMod");
battleCommand.worldMasterTextId = reader.GetUInt16("worldMasterTextId");
lua.LuaEngine.LoadBattleCommandScript(battleCommand, "weaponskill");
string folderName = "";
switch (battleCommand.commandType)
{
case CommandType.AutoAttack:
folderName = "autoattack";
break;
case CommandType.WeaponSkill:
folderName = "weaponskill";
break;
case CommandType.Ability:
folderName = "ability";
break;
case CommandType.Spell:
folderName = "magic";
break;
}
lua.LuaEngine.LoadBattleCommandScript(battleCommand, folderName);
battleCommandDict.Add(id, battleCommand);
Tuple<byte, short> tuple = Tuple.Create<byte, short>(battleCommand.job, battleCommand.level);

View file

@ -25,13 +25,17 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
Ally = 0x10, //Can be used on allies
AllyOnly = 0x20, //Must be used on allies
NPC = 0x40, //Can be used on static NPCs
NPCOnly = 0x60, //Must be used on static NPCs
Enemy = 0x80, //Can be used on enemies
EnemyOnly = 0x100, //Must be used on enemies
Object = 0x200, //Can be used on objects
ObjectOnly = 0x400, //Must be used on objects
Corpse = 0x600, //Can be used on corpses
CorpseOnly = 0x800, //Must be used on corpses
NPCOnly = 0x80, //Must be used on static NPCs
Enemy = 0x100, //Can be used on enemies
EnemyOnly = 0x200, //Must be used on enemies
Object = 0x400, //Can be used on objects
ObjectOnly = 0x800, //Must be used on objects
Corpse = 0x1000, //Can be used on corpses
CorpseOnly = 0x2000, //Must be used on corpses
//These are only used for ValidTarget, not MainTarget
MainTargetParty = 0x4000, //Can be used on main target's party (This will basically always be true.)
MainTargetPartyOnly = 0x8000, //Must be used on main target's party (This is for Protect basically.)
}
/// <summary> Targeting from/to different entity types </summary>
@ -94,7 +98,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
{
Reset();
this.owner = owner;
this.masterTarget = mainTarget == null ? owner : mainTarget;
this.mainTarget = mainTarget == null ? owner : mainTarget;
}
public void Reset()
@ -393,6 +397,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
if (validTarget == ValidTarget.Self && aoeType == TargetFindAOEType.None && owner != target)
return false;
//This skill can't be used on main target's party members and target is a party member of main target
if ((validTarget & ValidTarget.MainTargetParty) == 0 && target.currentParty == mainTarget.currentParty)
return false;
//This skill must be used on main target's party members and target is not a party member of main target
if ((validTarget & ValidTarget.MainTargetPartyOnly) != 0 && target.currentParty != mainTarget.currentParty)
return false;
// this is fuckin retarded, think of a better way l8r
if (!ignoreAOE)
{

View file

@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
{
this.startTime = DateTime.Now;
this.skill = Server.GetWorldManager().GetBattleCommand(skillId);
var returnCode = skill.CallLuaFunction(owner, "ability", "onAbilityPrepare", owner, target, skill);
var returnCode = skill.CallLuaFunction(owner, "onAbilityPrepare", owner, target, skill);
this.target = (skill.mainTarget & ValidTarget.SelfOnly) != 0 ? owner : target;
@ -39,7 +39,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnStart()
{
var returnCode = skill.CallLuaFunction(owner, "ability", "onAbilityStart", owner, target, skill);
var returnCode = skill.CallLuaFunction(owner, "onAbilityStart", owner, target, skill);
if (returnCode != 0)
{

View file

@ -112,8 +112,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
attackCommand.range = 5;
attackCommand.rangeHeight = 10;
attackCommand.worldMasterTextId = 0x765D;
attackCommand.mainTarget = (ValidTarget)384;
attackCommand.validTarget = (ValidTarget)384;
attackCommand.mainTarget = (ValidTarget)768;
attackCommand.validTarget = (ValidTarget)17152;
attackCommand.commandType = CommandType.AutoAttack;
attackCommand.numHits = (byte)owner.GetMod(Modifier.HitCount);
attackCommand.basePotency = 100;

View file

@ -24,7 +24,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
this.startPos = owner.GetPosAsVector3();
this.startTime = DateTime.Now;
this.spell = Server.GetWorldManager().GetBattleCommand(spellId);
var returnCode = spell.CallLuaFunction(owner, "magic", "onMagicPrepare", owner, target, spell);
var returnCode = spell.CallLuaFunction(owner, "onMagicPrepare", owner, target, spell);
//Modify spell based on status effects. Need to do it here because they can modify cast times
List<StatusEffect> effects = owner.statusEffects.GetStatusEffectsByFlag((uint)(StatusEffectFlags.ActivateOnCastStart));
@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnStart()
{
var returnCode = spell.CallLuaFunction(owner, "magic", "onMagicStart", owner, target, spell);
var returnCode = spell.CallLuaFunction(owner, "onMagicStart", owner, target, spell);
if (returnCode != 0)
{
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
Player p = (Player)owner;
if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id)))
{
spell.CallLuaFunction(owner, "magic", "onCombo", owner, target, spell);
spell.CallLuaFunction(owner, "onCombo", owner, target, spell);
spell.isCombo = true;
}
}

View file

@ -22,7 +22,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
this.startTime = DateTime.Now;
this.skill = Server.GetWorldManager().GetBattleCommand(skillId);
var returnCode = skill.CallLuaFunction(owner, "weaponskill", "onSkillPrepare", owner, target, skill);
var returnCode = skill.CallLuaFunction(owner, "onSkillPrepare", owner, target, skill);
this.target = (skill.mainTarget & ValidTarget.SelfOnly) != 0 ? owner : target;
@ -40,7 +40,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnStart()
{
var returnCode = skill.CallLuaFunction(owner, "weaponskill", "onSkillStart", owner, target, skill);
var returnCode = skill.CallLuaFunction(owner, "onSkillStart", owner, target, skill);
if (returnCode != 0)
{
@ -69,7 +69,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
//If owner is a player and the skill being used is part of the current combo
if (p.playerWork.comboNextCommandId[0] == skill.id || p.playerWork.comboNextCommandId[1] == skill.id)
{
skill.CallLuaFunction(owner, "weaponskill", "onCombo", owner, target, skill);
skill.CallLuaFunction(owner, "onCombo", owner, target, skill);
skill.isCombo = true;
}
//or if this just the start of a combo

View file

@ -127,13 +127,14 @@ namespace FFXIVClassic_Map_Server.actors.group
while (true)
{
if (GetMemberCount() - currentIndex >= 64)
int memberCount = Math.Min(GetMemberCount(), members.Count);
if (memberCount - currentIndex >= 64)
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
else if (GetMemberCount() - currentIndex >= 32)
else if (memberCount - currentIndex >= 32)
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
else if (GetMemberCount() - currentIndex >= 16)
else if (memberCount - currentIndex >= 16)
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
else if (GetMemberCount() - currentIndex > 0)
else if (memberCount - currentIndex > 0)
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
else
break;