mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Update substate and implemented it into Character. Cleaned up more code mix.
This commit is contained in:
parent
c55145d715
commit
7c7742fb35
@ -140,6 +140,7 @@
|
|||||||
<Compile Include="actors\chara\npc\Pet.cs" />
|
<Compile Include="actors\chara\npc\Pet.cs" />
|
||||||
<Compile Include="actors\chara\player\Equipment.cs" />
|
<Compile Include="actors\chara\player\Equipment.cs" />
|
||||||
<Compile Include="actors\chara\player\Inventory.cs" />
|
<Compile Include="actors\chara\player\Inventory.cs" />
|
||||||
|
<Compile Include="actors\chara\SubState.cs" />
|
||||||
<Compile Include="actors\chara\Work.cs" />
|
<Compile Include="actors\chara\Work.cs" />
|
||||||
<Compile Include="actors\debug\Debug.cs" />
|
<Compile Include="actors\debug\Debug.cs" />
|
||||||
<Compile Include="actors\director\Director.cs" />
|
<Compile Include="actors\director\Director.cs" />
|
||||||
@ -256,7 +257,7 @@
|
|||||||
<Compile Include="packets\send\actor\inventory\EquipmentListX08Packet.cs" />
|
<Compile Include="packets\send\actor\inventory\EquipmentListX08Packet.cs" />
|
||||||
<Compile Include="packets\send\actor\RemoveActorPacket.cs" />
|
<Compile Include="packets\send\actor\RemoveActorPacket.cs" />
|
||||||
<Compile Include="packets\send\actor\SetActorIconPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorIconPacket.cs" />
|
||||||
<Compile Include="packets\send\actor\SetActorSubStatPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorSubStatePacket.cs" />
|
||||||
<Compile Include="packets\send\actor\SetActorStatusPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorStatusPacket.cs" />
|
||||||
<Compile Include="packets\send\actor\SetActorBGPropertiesPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorBGPropertiesPacket.cs" />
|
||||||
<Compile Include="packets\send\actor\_0xFPacket.cs" />
|
<Compile Include="packets\send\actor\_0xFPacket.cs" />
|
||||||
|
@ -185,7 +185,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public SubPacket CreateStatePacket()
|
public SubPacket CreateStatePacket()
|
||||||
{
|
{
|
||||||
return SetActorStatePacket.BuildPacket(actorId, currentMainState, currentSubState);
|
return SetActorStatePacket.BuildPacket(actorId, currentMainState, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> GetEventConditionPackets()
|
public List<SubPacket> GetEventConditionPackets()
|
||||||
|
@ -167,9 +167,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return SetActorIconPacket.BuildPacket(actorId, currentActorIcon);
|
return SetActorIconPacket.BuildPacket(actorId, currentActorIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket CreateIdleAnimationPacket()
|
public SubPacket CreateSubStatePacket()
|
||||||
{
|
{
|
||||||
return SetActorSubStatePacket.BuildPacket(actorId, 0, 0, 0, 0, 0, 0, animationId);
|
return SetActorSubStatePacket.BuildPacket(actorId, currentSubState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetQuestGraphic(Player player, int graphicNum)
|
public void SetQuestGraphic(Player player, int graphicNum)
|
||||||
@ -219,12 +219,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendChant(int left, int right)
|
|
||||||
{
|
|
||||||
SetActorSubStatePacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0).DebugPrintSubPacket();
|
|
||||||
zone.BroadcastPacketAroundActor(this, SetActorSubStatePacket.BuildPacket(actorId, 0, left, right, 0, 0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoBattleAction(ushort commandId, uint animationId)
|
public void DoBattleAction(ushort commandId, uint animationId)
|
||||||
{
|
{
|
||||||
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, animationId, commandId));
|
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, animationId, commandId));
|
||||||
|
@ -57,7 +57,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
// todo: modify spellSpeed based on modifiers and stuff
|
// todo: modify spellSpeed based on modifiers and stuff
|
||||||
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
|
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
|
||||||
}
|
}
|
||||||
owner.SendChant(0xf, 0x0);
|
owner.GetSubState().chantId = 0xf0;
|
||||||
|
owner.SubstateModified();
|
||||||
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
||||||
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
|
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
|
||||||
}
|
}
|
||||||
@ -144,7 +145,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
|
|
||||||
public override void Cleanup()
|
public override void Cleanup()
|
||||||
{
|
{
|
||||||
owner.SendChant(0, 0);
|
owner.GetSubState().chantId = 0x0;
|
||||||
|
owner.SubstateModified();
|
||||||
owner.aiContainer.UpdateLastActionTime(skill.animationDurationSeconds);
|
owner.aiContainer.UpdateLastActionTime(skill.animationDurationSeconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
|
|
||||||
//There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy
|
//There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy
|
||||||
//If owner is a player and the spell being used is part of the current combo
|
//If owner is a player and the spell being used is part of the current combo
|
||||||
if (owner is Player p && p.GetClass() == spell.job)
|
if (owner is Player && ((Player)owner).GetClass() == spell.job)
|
||||||
{
|
{
|
||||||
|
Player p = (Player)owner;
|
||||||
if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id)))
|
if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id)))
|
||||||
{
|
{
|
||||||
lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell);
|
lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell);
|
||||||
@ -84,7 +85,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
// todo: modify spellSpeed based on modifiers and stuff
|
// todo: modify spellSpeed based on modifiers and stuff
|
||||||
((Player)owner).SendStartCastbar(spell.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(spellSpeed)));
|
((Player)owner).SendStartCastbar(spell.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(spellSpeed)));
|
||||||
}
|
}
|
||||||
owner.SendChant(0xf, 0x0);
|
owner.GetSubState().chantId = 0xf0;
|
||||||
|
owner.SubstateModified();
|
||||||
owner.DoBattleAction(spell.id, (uint) 0x6F000000 | spell.castType, new BattleAction(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
owner.DoBattleAction(spell.id, (uint) 0x6F000000 | spell.castType, new BattleAction(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +122,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
// todo: send paralyzed/sleep message etc.
|
// todo: send paralyzed/sleep message etc.
|
||||||
if (errorResult != null)
|
if (errorResult != null)
|
||||||
{
|
{
|
||||||
owner.SendChant(0, 0);
|
owner.GetSubState().chantId = 0x0;
|
||||||
|
owner.SubstateModified();
|
||||||
owner.DoBattleAction(spell.id, errorResult.animation, errorResult);
|
owner.DoBattleAction(spell.id, errorResult.animation, errorResult);
|
||||||
errorResult = null;
|
errorResult = null;
|
||||||
}
|
}
|
||||||
@ -181,7 +184,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
|
|
||||||
public override void Cleanup()
|
public override void Cleanup()
|
||||||
{
|
{
|
||||||
owner.SendChant(0, 0);
|
owner.GetSubState().chantId = 0x0;
|
||||||
|
owner.SubstateModified();
|
||||||
|
|
||||||
if (owner is Player)
|
if (owner is Player)
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
skill.CallLuaFunction(owner, "onPositional", owner, target, skill);
|
skill.CallLuaFunction(owner, "onPositional", owner, target, skill);
|
||||||
|
|
||||||
//Combo stuff
|
//Combo stuff
|
||||||
if (owner is Player p)
|
if (owner is Player)
|
||||||
{
|
{
|
||||||
|
Player p = (Player)owner;
|
||||||
//If skill is part of owner's class/job, it can be used in a combo
|
//If skill is part of owner's class/job, it can be used in a combo
|
||||||
if (skill.job == p.GetClass() || skill.job == p.GetCurrentClassOrJob())
|
if (skill.job == p.GetClass() || skill.job == p.GetCurrentClassOrJob())
|
||||||
{
|
{
|
||||||
@ -86,7 +87,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
// todo: modify spellSpeed based on modifiers and stuff
|
// todo: modify spellSpeed based on modifiers and stuff
|
||||||
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
|
((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime)));
|
||||||
}
|
}
|
||||||
owner.SendChant(0xf, 0x0);
|
owner.GetSubState().chantId = 0xf0;
|
||||||
|
owner.SubstateModified();
|
||||||
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
|
||||||
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
|
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this));
|
this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this));
|
||||||
|
|
||||||
this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
//this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
||||||
//this.currentMainState = SetActorStatePacket.MAIN_STATE_ACTIVE;
|
//this.currentMainState = SetActorStatePacket.MAIN_STATE_ACTIVE;
|
||||||
|
|
||||||
//charaWork.property[2] = 1;
|
//charaWork.property[2] = 1;
|
||||||
@ -108,7 +108,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
subpackets.Add(CreateNamePacket());
|
subpackets.Add(CreateNamePacket());
|
||||||
subpackets.Add(CreateStatePacket());
|
subpackets.Add(CreateStatePacket());
|
||||||
subpackets.Add(CreateIdleAnimationPacket());
|
subpackets.Add(CreateSubStatePacket());
|
||||||
subpackets.Add(CreateInitStatusPacket());
|
subpackets.Add(CreateInitStatusPacket());
|
||||||
subpackets.Add(CreateSetActorIconPacket());
|
subpackets.Add(CreateSetActorIconPacket());
|
||||||
subpackets.Add(CreateIsZoneingPacket());
|
subpackets.Add(CreateIsZoneingPacket());
|
||||||
@ -276,7 +276,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
if (IsAlive())
|
if (IsAlive())
|
||||||
{
|
{
|
||||||
// todo: does retail
|
// todo: does retail
|
||||||
if (lastAttacker is Pet && lastAttacker.aiContainer.GetController<PetController>()?.GetPetMaster() is Player)
|
if (lastAttacker is Pet && lastAttacker.aiContainer.GetController<PetController>() != null && lastAttacker.aiContainer.GetController<PetController>().GetPetMaster() is Player)
|
||||||
{
|
{
|
||||||
lastAttacker = lastAttacker.aiContainer.GetController<PetController>().GetPetMaster();
|
lastAttacker = lastAttacker.aiContainer.GetController<PetController>().GetPetMaster();
|
||||||
}
|
}
|
||||||
@ -285,7 +285,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
//I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack
|
//I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack
|
||||||
// <actor> defeat/defeats <target>
|
// <actor> defeat/defeats <target>
|
||||||
actionContainer?.AddEXPAction(new BattleAction(actorId, 30108, 0));
|
if (actionContainer != null)
|
||||||
|
actionContainer.AddEXPAction(new BattleAction(actorId, 30108, 0));
|
||||||
if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party)
|
if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party)
|
||||||
{
|
{
|
||||||
foreach (var memberId in ((Party)lastAttacker.currentParty).members)
|
foreach (var memberId in ((Party)lastAttacker.currentParty).members)
|
||||||
@ -295,8 +296,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker);
|
lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker);
|
||||||
|
|
||||||
// todo: add actual experience calculation and exp bonus values.
|
// todo: add actual experience calculation and exp bonus values.
|
||||||
if (partyMember is Player player)
|
if (partyMember is Player)
|
||||||
BattleUtils.AddBattleBonusEXP(player, this, actionContainer);
|
BattleUtils.AddBattleBonusEXP((Player)partyMember, this, actionContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -306,7 +307,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
//((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0)));
|
//((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
positionUpdates?.Clear();
|
|
||||||
|
if (positionUpdates != null)
|
||||||
|
positionUpdates.Clear();
|
||||||
aiContainer.InternalDie(tick, despawnTime);
|
aiContainer.InternalDie(tick, despawnTime);
|
||||||
//this.ResetMoveSpeeds();
|
//this.ResetMoveSpeeds();
|
||||||
// todo: reset cooldowns
|
// todo: reset cooldowns
|
||||||
@ -315,7 +318,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var err = $"[{actorId}][{GetUniqueId()}] {positionX} {positionY} {positionZ} {GetZone().GetName()} tried to die ded";
|
var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, GetZone().GetName());
|
||||||
Program.Log.Error(err);
|
Program.Log.Error(err);
|
||||||
//throw new Exception(err);
|
//throw new Exception(err);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
this.actorClassId = actorClass.actorClassId;
|
this.actorClassId = actorClass.actorClassId;
|
||||||
|
|
||||||
|
this.currentSubState.motionPack = (ushort) animationId;
|
||||||
|
|
||||||
LoadNpcAppearance(actorClass.actorClassId);
|
LoadNpcAppearance(actorClass.actorClassId);
|
||||||
|
|
||||||
className = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1);
|
className = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1);
|
||||||
@ -201,7 +203,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
subpackets.Add(CreateNamePacket());
|
subpackets.Add(CreateNamePacket());
|
||||||
subpackets.Add(CreateStatePacket());
|
subpackets.Add(CreateStatePacket());
|
||||||
subpackets.Add(CreateIdleAnimationPacket());
|
subpackets.Add(CreateSubStatePacket());
|
||||||
subpackets.Add(CreateInitStatusPacket());
|
subpackets.Add(CreateInitStatusPacket());
|
||||||
subpackets.Add(CreateSetActorIconPacket());
|
subpackets.Add(CreateSetActorIconPacket());
|
||||||
subpackets.Add(CreateIsZoneingPacket());
|
subpackets.Add(CreateIsZoneingPacket());
|
||||||
|
@ -18,7 +18,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
: base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)
|
: base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)
|
||||||
{
|
{
|
||||||
this.aiContainer = new AIContainer(this, new PetController(this), new PathFind(this), new TargetFind(this));
|
this.aiContainer = new AIContainer(this, new PetController(this), new PathFind(this), new TargetFind(this));
|
||||||
this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
|
|
||||||
this.hateContainer = new HateContainer(this);
|
this.hateContainer = new HateContainer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
playerSession = cp;
|
playerSession = cp;
|
||||||
actorName = String.Format("_pc{0:00000000}", actorID);
|
actorName = String.Format("_pc{0:00000000}", actorID);
|
||||||
className = "Player";
|
className = "Player";
|
||||||
currentSubState = SetActorStatePacket.SUB_STATE_PLAYER;
|
|
||||||
|
|
||||||
moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP;
|
moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP;
|
||||||
moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK;
|
moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK;
|
||||||
@ -288,7 +287,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
subpackets.Add(CreateNamePacket());
|
subpackets.Add(CreateNamePacket());
|
||||||
subpackets.Add(_0xFPacket.BuildPacket(actorId));
|
subpackets.Add(_0xFPacket.BuildPacket(actorId));
|
||||||
subpackets.Add(CreateStatePacket());
|
subpackets.Add(CreateStatePacket());
|
||||||
subpackets.Add(CreateIdleAnimationPacket());
|
subpackets.Add(CreateSubStatePacket());
|
||||||
subpackets.Add(CreateInitStatusPacket());
|
subpackets.Add(CreateInitStatusPacket());
|
||||||
subpackets.Add(CreateSetActorIconPacket());
|
subpackets.Add(CreateSetActorIconPacket());
|
||||||
subpackets.Add(CreateIsZoneingPacket());
|
subpackets.Add(CreateIsZoneingPacket());
|
||||||
|
Loading…
Reference in New Issue
Block a user