diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index d75077fd..5a1323de 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -75,66 +75,68 @@ namespace FFXIVClassic_Map_Server.Actors } } - public SubPacket CreateAddActorPacket(uint playerActorId, byte val) + public SubPacket CreateAddActorPacket(byte val) { - return AddActorPacket.BuildPacket(actorId, playerActorId, val); + return AddActorPacket.BuildPacket(actorId, val); } - public SubPacket CreateNamePacket(uint playerActorId) + public SubPacket CreateNamePacket() { - return SetActorNamePacket.BuildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : ""); + return SetActorNamePacket.BuildPacket(actorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : ""); } - public SubPacket CreateSpeedPacket(uint playerActorId) + public SubPacket CreateSpeedPacket() { - return SetActorSpeedPacket.BuildPacket(actorId, playerActorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); + return SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); } - public SubPacket CreateSpawnPositonPacket(uint playerActorId, ushort spawnType) + public SubPacket CreateSpawnPositonPacket(ushort spawnType) { + //TODO: FIX THIS IF + uint playerActorId = 0; //Get Rid SubPacket spawnPacket; if (!spawnedFirstTime && playerActorId == actorId) - spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false); + spawnPacket = SetActorPositionPacket.BuildPacket(actorId, 0, positionX, positionY, positionZ, rotation, 0x1, false); else if (playerActorId == actorId) - spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true); + spawnPacket = SetActorPositionPacket.BuildPacket(actorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true); else { if (this is Player) - spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false); + spawnPacket = SetActorPositionPacket.BuildPacket(actorId, 0, positionX, positionY, positionZ, rotation, spawnType, false); else - spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false); + spawnPacket = SetActorPositionPacket.BuildPacket(actorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false); } - //return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); + //return SetActorPositionPacket.BuildPacket(actorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); spawnedFirstTime = true; return spawnPacket; } - public SubPacket CreateSpawnTeleportPacket(uint playerActorId, ushort spawnType) + public SubPacket CreateSpawnTeleportPacket(ushort spawnType) { SubPacket spawnPacket; - spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false); + spawnPacket = SetActorPositionPacket.BuildPacket(actorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false); - //return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); + //return SetActorPositionPacket.BuildPacket(actorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); //spawnPacket.DebugPrintSubPacket(); return spawnPacket; } - public SubPacket CreatePositionUpdatePacket(uint playerActorId) + public SubPacket CreatePositionUpdatePacket() { - return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState); + return MoveActorToPositionPacket.BuildPacket(actorId, positionX, positionY, positionZ, rotation, moveState); } - public SubPacket CreateStatePacket(uint playerActorID) + public SubPacket CreateStatePacket() { - return SetActorStatePacket.BuildPacket(actorId, playerActorID, currentMainState, currentSubState); + return SetActorStatePacket.BuildPacket(actorId, currentMainState, currentSubState); } - public List GetEventConditionPackets(uint playerActorId) + public List GetEventConditionPackets() { List subpackets = new List(); @@ -145,43 +147,43 @@ namespace FFXIVClassic_Map_Server.Actors if (eventConditions.talkEventConditions != null) { foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions) - subpackets.Add(SetTalkEventCondition.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetTalkEventCondition.BuildPacket(actorId, condition)); } if (eventConditions.noticeEventConditions != null) { foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions) - subpackets.Add(SetNoticeEventCondition.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetNoticeEventCondition.BuildPacket(actorId, condition)); } if (eventConditions.emoteEventConditions != null) { foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions) - subpackets.Add(SetEmoteEventCondition.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetEmoteEventCondition.BuildPacket(actorId, condition)); } if (eventConditions.pushWithCircleEventConditions != null) { foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) - subpackets.Add(SetPushEventConditionWithCircle.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetPushEventConditionWithCircle.BuildPacket(actorId, condition)); } if (eventConditions.pushWithFanEventConditions != null) { foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) - subpackets.Add(SetPushEventConditionWithFan.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetPushEventConditionWithFan.BuildPacket(actorId, condition)); } if (eventConditions.pushWithBoxEventConditions != null) { foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) - subpackets.Add(SetPushEventConditionWithTriggerBox.BuildPacket(playerActorId, actorId, condition)); + subpackets.Add(SetPushEventConditionWithTriggerBox.BuildPacket(actorId, condition)); } return subpackets; } - public BasePacket GetSetEventStatusPackets(uint playerActorId) + public BasePacket GetSetEventStatusPackets() { List subpackets = new List(); @@ -192,79 +194,79 @@ namespace FFXIVClassic_Map_Server.Actors if (eventConditions.talkEventConditions != null) { foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 1, condition.conditionName)); } if (eventConditions.noticeEventConditions != null) { foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 1, condition.conditionName)); } if (eventConditions.emoteEventConditions != null) { foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 3, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 3, condition.conditionName)); } if (eventConditions.pushWithCircleEventConditions != null) { foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 2, condition.conditionName)); } if (eventConditions.pushWithFanEventConditions != null) { foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 2, condition.conditionName)); } if (eventConditions.pushWithBoxEventConditions != null) { foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) - subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName)); + subpackets.Add(SetEventStatus.BuildPacket(actorId, true, 2, condition.conditionName)); } return BasePacket.CreatePacket(subpackets, true, false); } - public SubPacket CreateIsZoneingPacket(uint playerActorId) + public SubPacket CreateIsZoneingPacket() { - return SetActorIsZoningPacket.BuildPacket(actorId, playerActorId, false); + return SetActorIsZoningPacket.BuildPacket(actorId, false); } - public virtual SubPacket CreateScriptBindPacket(uint playerActorId) + public virtual SubPacket CreateScriptBindPacket(Player player) { - return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, classParams); + return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, classParams); } - public virtual BasePacket GetSpawnPackets(uint playerActorId) + public virtual BasePacket GetSpawnPackets() { - return GetSpawnPackets(playerActorId, 0x1); + return GetSpawnPackets(0x1); } - public virtual BasePacket GetSpawnPackets(uint playerActorId, ushort spawnType) + public virtual BasePacket GetSpawnPackets(ushort spawnType) { List subpackets = new List(); - subpackets.Add(CreateAddActorPacket(playerActorId, 8)); - subpackets.AddRange(GetEventConditionPackets(playerActorId)); - subpackets.Add(CreateSpeedPacket(playerActorId)); - subpackets.Add(CreateSpawnPositonPacket(playerActorId, spawnType)); - subpackets.Add(CreateNamePacket(playerActorId)); - subpackets.Add(CreateStatePacket(playerActorId)); - subpackets.Add(CreateIsZoneingPacket(playerActorId)); - subpackets.Add(CreateScriptBindPacket(playerActorId)); + subpackets.Add(CreateAddActorPacket(8)); + subpackets.AddRange(GetEventConditionPackets()); + subpackets.Add(CreateSpeedPacket()); + subpackets.Add(CreateSpawnPositonPacket( spawnType)); + subpackets.Add(CreateNamePacket()); + subpackets.Add(CreateStatePacket()); + subpackets.Add(CreateIsZoneingPacket()); + subpackets.Add(CreateScriptBindPacket()); return BasePacket.CreatePacket(subpackets, true, false); } - public virtual BasePacket GetInitPackets(uint playerActorId) + public virtual BasePacket GetInitPackets() { SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); initProperties.AddByte(0xE14B0CA8, 1); initProperties.AddByte(0x2138FD71, 1); initProperties.AddByte(0xFBFBCFB1, 1); initProperties.AddTarget(); - return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false); + return BasePacket.CreatePacket(initProperties.BuildPacket(actorId), true, false); } public override bool Equals(Object obj) @@ -299,8 +301,8 @@ namespace FFXIVClassic_Map_Server.Actors public void ChangeState(ushort newState) { currentMainState = newState; - SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, actorId, newState, currentSubState); - SubPacket battleActionPacket = BattleAction1Packet.BuildPacket(actorId, actorId); + SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, newState, currentSubState); + SubPacket battleActionPacket = BattleAction1Packet.BuildPacket(actorId); zone.BroadcastPacketAroundActor(this, ChangeStatePacket); zone.BroadcastPacketAroundActor(this, battleActionPacket); } @@ -308,7 +310,7 @@ namespace FFXIVClassic_Map_Server.Actors public void ChangeSpeed(int type, float value) { moveSpeeds[type] = value; - SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); + SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); } @@ -318,7 +320,7 @@ namespace FFXIVClassic_Map_Server.Actors moveSpeeds[1] = speedWalk; moveSpeeds[2] = speedRun; moveSpeeds[3] = speedActive; - SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); + SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); } @@ -426,8 +428,8 @@ namespace FFXIVClassic_Map_Server.Actors SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc); changeProperty.AddProperty(this, name); changeProperty.AddTarget(); - SubPacket subpacket = changeProperty.BuildPacket(player.actorId, player.actorId); - player.playerSession.QueuePacket(subpacket, true, false); + SubPacket subpacket = changeProperty.BuildPacket(player.actorId); + player.playerSession.QueuePacket(subpacket); subpacket.DebugPrintSubPacket(); return true; } @@ -444,8 +446,8 @@ namespace FFXIVClassic_Map_Server.Actors SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc); changeProperty.AddProperty(this, name); changeProperty.AddTarget(); - SubPacket subpacket = changeProperty.BuildPacket(player.actorId, player.actorId); - player.playerSession.QueuePacket(subpacket, true, false); + SubPacket subpacket = changeProperty.BuildPacket(player.actorId); + player.playerSession.QueuePacket(subpacket); subpacket.DebugPrintSubPacket(); return true; } @@ -480,7 +482,7 @@ namespace FFXIVClassic_Map_Server.Actors rotation = rot; // todo: handle zone? - zone.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(this.actorId, this.actorId, x, y, z, rot, moveState)); + zone.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(actorId, x, y, z, rot, moveState)); } public Area GetZone() diff --git a/FFXIVClassic Map Server/actors/chara/Character.cs b/FFXIVClassic Map Server/actors/chara/Character.cs index 8d032b87..56db6ab0 100644 --- a/FFXIVClassic Map Server/actors/chara/Character.cs +++ b/FFXIVClassic Map Server/actors/chara/Character.cs @@ -63,30 +63,30 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.statusShownTime[i] = 0xFFFFFFFF; } - public SubPacket CreateAppearancePacket(uint playerActorId) + public SubPacket CreateAppearancePacket() { SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelId, appearanceIds); - return setappearance.BuildPacket(actorId, playerActorId); + return setappearance.BuildPacket(actorId); } - public SubPacket CreateInitStatusPacket(uint playerActorId) + public SubPacket CreateInitStatusPacket() { - return (SetActorStatusAllPacket.BuildPacket(actorId, playerActorId, charaWork.status)); + return (SetActorStatusAllPacket.BuildPacket(actorId, charaWork.status)); } - public SubPacket CreateSetActorIconPacket(uint playerActorId) + public SubPacket CreateSetActorIconPacket() { - return SetActorIconPacket.BuildPacket(actorId, playerActorId, currentActorIcon); + return SetActorIconPacket.BuildPacket(actorId, currentActorIcon); } - public SubPacket CreateIdleAnimationPacket(uint playerActorId) + public SubPacket CreateIdleAnimationPacket() { - return SetActorSubStatPacket.BuildPacket(actorId, playerActorId, 0, 0, 0, 0, 0, 0, animationId); + return SetActorSubStatPacket.BuildPacket(actorId, 0, 0, 0, 0, 0, 0, animationId); } public void SetQuestGraphic(Player player, int graphicNum) { - player.QueuePacket(SetActorQuestGraphicPacket.BuildPacket(player.actorId, actorId, graphicNum)); + player.QueuePacket(SetActorQuestGraphicPacket.BuildPacket(actorId, graphicNum)); } public void SetCurrentContentGroup(ContentGroup group) @@ -109,10 +109,10 @@ namespace FFXIVClassic_Map_Server.Actors if (onlySelf) { if (this is Player) - ((Player)this).QueuePacket(PlayAnimationOnActorPacket.BuildPacket(actorId, actorId, animId)); + ((Player)this).QueuePacket(PlayAnimationOnActorPacket.BuildPacket(actorId, animId)); } else - zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, actorId, animId)); + zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId)); } } diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index 6650e72b..4dbcca5b 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -126,18 +126,17 @@ namespace FFXIVClassic_Map_Server.Actors GenerateActorName((int)actorNumber); } - public SubPacket CreateAddActorPacket(uint playerActorId) + public SubPacket CreateAddActorPacket() { - return AddActorPacket.BuildPacket(actorId, playerActorId, 8); + return AddActorPacket.BuildPacket(actorId, 8); } int val = 0x0b00; // actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent - public override SubPacket CreateScriptBindPacket(uint playerActorId) + public override SubPacket CreateScriptBindPacket(Player player) { List lParams; - - Player player = Server.GetWorldManager().GetPCInWorld(playerActorId); + lParams = LuaEngine.GetInstance().CallLuaFunctionForReturn(player, this, "init", false); if (uniqueIdentifier.Equals("1")) @@ -161,8 +160,8 @@ namespace FFXIVClassic_Map_Server.Actors string classNameFake = "PopulaceStandard"; lParams = LuaUtils.CreateLuaParamList(classPathFake, false, false, false, false, false, 0xF47F6, false, false, 0, 0); isStatic = true; - //ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams).DebugPrintSubPacket(); - return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams); + //ActorInstantiatePacket.BuildPacket(actorId, actorName, classNameFake, lParams).DebugPrintSubPacket(); + return ActorInstantiatePacket.BuildPacket(actorId, actorName, classNameFake, lParams); } else { @@ -175,37 +174,37 @@ namespace FFXIVClassic_Map_Server.Actors lParams.Insert(6, new LuaParam(0, (int)actorClassId)); } - //ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket(); - return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams); + //ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams).DebugPrintSubPacket(); + return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams); } - public override BasePacket GetSpawnPackets(uint playerActorId, ushort spawnType) + public override BasePacket GetSpawnPackets(ushort spawnType) { List subpackets = new List(); - subpackets.Add(CreateAddActorPacket(playerActorId)); - subpackets.AddRange(GetEventConditionPackets(playerActorId)); - subpackets.Add(CreateSpeedPacket(playerActorId)); - subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x0)); + subpackets.Add(CreateAddActorPacket()); + subpackets.AddRange(GetEventConditionPackets()); + subpackets.Add(CreateSpeedPacket()); + subpackets.Add(CreateSpawnPositonPacket(0x0)); if (isMapObj) - subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, instance, layout)); + subpackets.Add(_0xD8Packet.BuildPacket(actorId, instance, layout)); else - subpackets.Add(CreateAppearancePacket(playerActorId)); + subpackets.Add(CreateAppearancePacket()); - subpackets.Add(CreateNamePacket(playerActorId)); - subpackets.Add(CreateStatePacket(playerActorId)); - subpackets.Add(CreateIdleAnimationPacket(playerActorId)); - subpackets.Add(CreateInitStatusPacket(playerActorId)); - subpackets.Add(CreateSetActorIconPacket(playerActorId)); - subpackets.Add(CreateIsZoneingPacket(playerActorId)); - subpackets.Add(CreateScriptBindPacket(playerActorId)); + subpackets.Add(CreateNamePacket()); + subpackets.Add(CreateStatePacket()); + subpackets.Add(CreateIdleAnimationPacket()); + subpackets.Add(CreateInitStatusPacket()); + subpackets.Add(CreateSetActorIconPacket()); + subpackets.Add(CreateIsZoneingPacket()); + subpackets.Add(CreateScriptBindPacket()); return BasePacket.CreatePacket(subpackets, true, false); } - public override BasePacket GetInitPackets(uint playerActorId) + public override BasePacket GetInitPackets() { - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this); //Potential propPacketUtil.AddProperty("charaWork.battleSave.potencial"); @@ -275,7 +274,7 @@ namespace FFXIVClassic_Map_Server.Actors public void ChangeNpcAppearance(uint id) { LoadNpcAppearance(id); - zone.BroadcastPacketAroundActor(this, CreateAppearancePacket(actorId)); + zone.BroadcastPacketAroundActor(this, CreateAppearancePacket()); } public void LoadNpcAppearance(uint id) @@ -393,7 +392,7 @@ namespace FFXIVClassic_Map_Server.Actors public void PlayMapObjAnimation(Player player, string animationName) { - player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, player.actorId, animationName)); + player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, animationName)); } public void Despawn() diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 213acf4e..2b960251 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -249,17 +249,17 @@ namespace FFXIVClassic_Map_Server.Actors lastPlayTimeUpdate = Utils.UnixTimeStampUTC(); } - public List Create0x132Packets(uint playerActorId) + public List Create0x132Packets() { List packets = new List(); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0xB, "commandForced")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0xA, "commandDefault")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x6, "commandWeak")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x4, "commandContent")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x6, "commandJudgeMode")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "commandRequest")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "widgetCreate")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "macroRequest")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0xB, "commandForced")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0xA, "commandDefault")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x6, "commandWeak")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x4, "commandContent")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x6, "commandJudgeMode")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x100, "commandRequest")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x100, "widgetCreate")); + packets.Add(_0x132Packet.BuildPacket(actorId, 0x100, "macroRequest")); return packets; } @@ -274,10 +274,10 @@ namespace FFXIVClassic_Map_Server.Actors * Timer Array - 20 Number */ - public override SubPacket CreateScriptBindPacket(uint playerActorId) + public override SubPacket CreateScriptBindPacket(Player player) { List lParams; - if (IsMyPlayer(playerActorId)) + if (IsMyPlayer(player.actorId)) { if (loginInitDirector != null) lParams = LuaUtils.CreateLuaParamList("/Chara/Player/Player_work", false, false, true, loginInitDirector, true, 0, false, timers, true); @@ -287,59 +287,59 @@ namespace FFXIVClassic_Map_Server.Actors else lParams = LuaUtils.CreateLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true); - ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket(); + ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams).DebugPrintSubPacket(); - return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams); + return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams); } - public override BasePacket GetSpawnPackets(uint playerActorId, ushort spawnType) + public override BasePacket GetSpawnPackets(Player player, ushort spawnType) { List subpackets = new List(); - subpackets.Add(CreateAddActorPacket(playerActorId, 8)); - if (IsMyPlayer(playerActorId)) - subpackets.AddRange(Create0x132Packets(playerActorId)); - subpackets.Add(CreateSpeedPacket(playerActorId)); - subpackets.Add(CreateSpawnPositonPacket(playerActorId, spawnType)); - subpackets.Add(CreateAppearancePacket(playerActorId)); - subpackets.Add(CreateNamePacket(playerActorId)); - subpackets.Add(_0xFPacket.BuildPacket(playerActorId, playerActorId)); - subpackets.Add(CreateStatePacket(playerActorId)); - subpackets.Add(CreateIdleAnimationPacket(playerActorId)); - subpackets.Add(CreateInitStatusPacket(playerActorId)); - subpackets.Add(CreateSetActorIconPacket(playerActorId)); - subpackets.Add(CreateIsZoneingPacket(playerActorId)); - subpackets.AddRange(CreatePlayerRelatedPackets(playerActorId)); - subpackets.Add(CreateScriptBindPacket(playerActorId)); + subpackets.Add(CreateAddActorPacket( 8)); + if (IsMyPlayer(player.actorId)) + subpackets.AddRange(Create0x132Packets()); + subpackets.Add(CreateSpeedPacket()); + subpackets.Add(CreateSpawnPositonPacket(spawnType)); + subpackets.Add(CreateAppearancePacket()); + subpackets.Add(CreateNamePacket()); + subpackets.Add(_0xFPacket.BuildPacket(actorId)); + subpackets.Add(CreateStatePacket()); + subpackets.Add(CreateIdleAnimationPacket()); + subpackets.Add(CreateInitStatusPacket()); + subpackets.Add(CreateSetActorIconPacket()); + subpackets.Add(CreateIsZoneingPacket()); + subpackets.AddRange(CreatePlayerRelatedPackets(player)); + subpackets.Add(CreateScriptBindPacket(player)); return BasePacket.CreatePacket(subpackets, true, false); } - public List CreatePlayerRelatedPackets(uint playerActorId) + public List CreatePlayerRelatedPackets(Player player) { List subpackets = new List(); if (gcCurrent != 0) - subpackets.Add(SetGrandCompanyPacket.BuildPacket(actorId, playerActorId, gcCurrent, gcRankLimsa, gcRankGridania, gcRankUldah)); + subpackets.Add(SetGrandCompanyPacket.BuildPacket(actorId, gcCurrent, gcRankLimsa, gcRankGridania, gcRankUldah)); if (currentTitle != 0) - subpackets.Add(SetPlayerTitlePacket.BuildPacket(actorId, playerActorId, currentTitle)); + subpackets.Add(SetPlayerTitlePacket.BuildPacket(actorId, currentTitle)); if (currentJob != 0) - subpackets.Add(SetCurrentJobPacket.BuildPacket(actorId, playerActorId, currentJob)); + subpackets.Add(SetCurrentJobPacket.BuildPacket(actorId, currentJob)); - if (IsMyPlayer(playerActorId)) + if (IsMyPlayer(player.actorId)) { - subpackets.Add(SetSpecialEventWorkPacket.BuildPacket(playerActorId, playerActorId)); + subpackets.Add(SetSpecialEventWorkPacket.BuildPacket(actorId)); if (hasChocobo && chocoboName != null && !chocoboName.Equals("")) { - subpackets.Add(SetChocoboNamePacket.BuildPacket(actorId, playerActorId, chocoboName)); - subpackets.Add(SetHasChocoboPacket.BuildPacket(playerActorId, hasChocobo)); + subpackets.Add(SetChocoboNamePacket.BuildPacket(actorId, chocoboName)); + subpackets.Add(SetHasChocoboPacket.BuildPacket(actorId, hasChocobo)); } if (hasGoobbue) - subpackets.Add(SetHasGoobbuePacket.BuildPacket(playerActorId, hasGoobbue)); + subpackets.Add(SetHasGoobbuePacket.BuildPacket(actorId, hasGoobbue)); - subpackets.Add(SetAchievementPointsPacket.BuildPacket(playerActorId, achievementPoints)); + subpackets.Add(SetAchievementPointsPacket.BuildPacket(actorId, achievementPoints)); subpackets.Add(Database.GetLatestAchievements(this)); subpackets.Add(Database.GetAchievementsPacket(this)); } @@ -347,9 +347,9 @@ namespace FFXIVClassic_Map_Server.Actors return subpackets; } - public override BasePacket GetInitPackets(uint playerActorId) + public override BasePacket GetInitPackets() { - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this); propPacketUtil.AddProperty("charaWork.eventSave.bazaarTax"); propPacketUtil.AddProperty("charaWork.battleSave.potencial"); @@ -505,14 +505,14 @@ namespace FFXIVClassic_Map_Server.Actors public void SendZoneInPackets(WorldManager world, ushort spawnType) { - QueuePacket(SetActorIsZoningPacket.BuildPacket(actorId, actorId, false)); + QueuePacket(SetActorIsZoningPacket.BuildPacket(actorId, false)); QueuePacket(_0x10Packet.BuildPacket(actorId, 0xFF)); QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, 0x01)); QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1)); QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId)); - QueuePacket(GetSpawnPackets(actorId, spawnType)); + QueuePacket(GetSpawnPackets(player, spawnType)); //GetSpawnPackets(actorId, spawnType).DebugPrintPacket(); #region Inventory & Equipment @@ -524,10 +524,10 @@ namespace FFXIVClassic_Map_Server.Actors inventories[Inventory.MELDREQUEST].SendFullInventory(); inventories[Inventory.LOOT].SendFullInventory(); equipment.SendFullEquipment(false); - playerSession.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId), true, false); + playerSession.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId)); #endregion - playerSession.QueuePacket(GetInitPackets(actorId)); + playerSession.QueuePacket(GetInitPackets()); BasePacket areaMasterSpawn = zone.GetSpawnPackets(actorId); BasePacket debugSpawn = world.GetDebugActor().GetSpawnPackets(actorId); @@ -603,13 +603,13 @@ namespace FFXIVClassic_Map_Server.Actors public void QueuePacket(SubPacket packet) { - playerSession.QueuePacket(packet, true, false); + playerSession.QueuePacket(packet); } public void QueuePackets(List packets) { foreach (SubPacket subpacket in packets) - playerSession.QueuePacket(subpacket, true, false); + playerSession.QueuePacket(subpacket); } public void SendPacket(string path) @@ -655,14 +655,14 @@ namespace FFXIVClassic_Map_Server.Actors { if (flag) { - BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, actorId, SetActorIconPacket.DISCONNECTING), true); + BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, SetActorIconPacket.DISCONNECTING), true); } else { if (isGM) - BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, actorId, SetActorIconPacket.ISGM), true); + BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, SetActorIconPacket.ISGM), true); else - BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, actorId, 0), true); + BroadcastPacket(SetActorIconPacket.BuildPacket(actorId, 0), true); } } @@ -715,7 +715,7 @@ namespace FFXIVClassic_Map_Server.Actors public void SendMessage(uint logType, string sender, string message) { - QueuePacket(SendMessagePacket.BuildPacket(actorId, actorId, logType, sender, message)); + QueuePacket(SendMessagePacket.BuildPacket(actorId, logType, sender, message)); } public void Logout() @@ -774,41 +774,41 @@ namespace FFXIVClassic_Map_Server.Actors public void DoEmote(uint targettedActor, uint animId, uint descId) { - BroadcastPacket(ActorDoEmotePacket.BuildPacket(actorId, actorId, targettedActor, animId, descId), true); + BroadcastPacket(ActorDoEmotePacket.BuildPacket(actorId, targettedActor, animId, descId), true); } public void SendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams) { if (msgParams == null || msgParams.Length == 0) { - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log)); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, sourceActor.actorId, textIdOwner.actorId, textId, log)); } else - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams))); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams))); } public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams) { if (msgParams == null || msgParams.Length == 0) - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log)); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, log)); else - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams))); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams))); } public void SendGameMessageCustomSender(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] msgParams) { if (msgParams == null || msgParams.Length == 0) - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log)); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, customSender, log)); else - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams))); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams))); } public void SendGameMessageDisplayIDSender(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams) { if (msgParams == null || msgParams.Length == 0) - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log)); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, displayId, log)); else - QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams))); + QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams))); } public void BroadcastWorldMessage(ushort worldMasterId, params object[] msgParams) @@ -843,7 +843,7 @@ namespace FFXIVClassic_Map_Server.Actors public void SendAppearance() { - BroadcastPacket(CreateAppearancePacket(actorId), true); + BroadcastPacket(CreateAppearancePacket(), true); } public void SendCharaExpInfo() @@ -875,7 +875,7 @@ namespace FFXIVClassic_Map_Server.Actors charaInfo1.AddTarget(); - QueuePacket(charaInfo1.BuildPacket(actorId, actorId)); + QueuePacket(charaInfo1.BuildPacket(actorId)); } else if (lastStep == 1) { @@ -906,7 +906,7 @@ namespace FFXIVClassic_Map_Server.Actors charaInfo1.AddTarget(); - QueuePacket(charaInfo1.BuildPacket(actorId, actorId)); + QueuePacket(charaInfo1.BuildPacket(actorId)); } } @@ -963,7 +963,7 @@ namespace FFXIVClassic_Map_Server.Actors playerWork.restBonusExpRate = 0.0f; - ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this, actorId); + ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this); propertyBuilder.AddProperty("charaWork.parameterSave.state_mainSkill[0]"); propertyBuilder.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); @@ -1007,7 +1007,7 @@ namespace FFXIVClassic_Map_Server.Actors Database.SavePlayerAppearance(this); - BroadcastPacket(CreateAppearancePacket(actorId), true); + BroadcastPacket(CreateAppearancePacket(), true); } public Inventory GetInventory(ushort type) @@ -1404,7 +1404,7 @@ namespace FFXIVClassic_Map_Server.Actors Database.SaveNpcLS(this, npcLSId, isCalling, isExtra); - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/npcLinkshellChat", this, actorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/npcLinkshellChat", this); propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatExtra[{0}]", npcLSId)); propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatCalling[{0}]", npcLSId)); QueuePackets(propPacketUtil.Done()); @@ -1412,21 +1412,21 @@ namespace FFXIVClassic_Map_Server.Actors private void SendQuestClientUpdate(int slot) { - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this, actorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this); propPacketUtil.AddProperty(String.Format("playerWork.questScenario[{0}]", slot)); QueuePackets(propPacketUtil.Done()); } private void SendGuildleveClientUpdate(int slot) { - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this, actorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this); propPacketUtil.AddProperty(String.Format("work.guildleveId[{0}]", slot)); QueuePackets(propPacketUtil.Done()); } private void SendGuildleveMarkClientUpdate(int slot) { - ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this, actorId); + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this); propPacketUtil.AddProperty(String.Format("work.guildleveDone[{0}]", slot)); propPacketUtil.AddProperty(String.Format("work.guildleveChecked[{0}]", slot)); QueuePackets(propPacketUtil.Done()); @@ -1449,8 +1449,8 @@ namespace FFXIVClassic_Map_Server.Actors public void SendDirectorPackets(Director director) { - director.GetSpawnPackets(actorId).DebugPrintPacket(); - QueuePacket(director.GetSpawnPackets(actorId)); + director.GetSpawnPackets().DebugPrintPacket(); + QueuePacket(director.GetSpawnPackets()); QueuePacket(director.GetInitPackets(actorId)); } @@ -1458,7 +1458,7 @@ namespace FFXIVClassic_Map_Server.Actors { if (ownedDirectors.Contains(director)) { - QueuePacket(RemoveActorPacket.BuildPacket(actorId, director.actorId)); + QueuePacket(RemoveActorPacket.BuildPacket(director.actorId)); ownedDirectors.Remove(director); director.RemoveMember(this); } @@ -1505,15 +1505,15 @@ namespace FFXIVClassic_Map_Server.Actors else return; - QueuePacket(InventoryBeginChangePacket.BuildPacket(toBeExamined.actorId, actorId)); + QueuePacket(InventoryBeginChangePacket.BuildPacket(toBeExamined.actorId)); toBeExamined.GetEquipment().SendCheckEquipmentToPlayer(this); - QueuePacket(InventoryEndChangePacket.BuildPacket(toBeExamined.actorId, actorId)); + QueuePacket(InventoryEndChangePacket.BuildPacket(toBeExamined.actorId)); } public void SendDataPacket(params object[] parameters) { List lParams = LuaUtils.CreateLuaParamList(parameters); - SubPacket spacket = InfoRequestResponsePacket.BuildPacket(actorId, actorId, lParams); + SubPacket spacket = InfoRequestResponsePacket.BuildPacket(actorId, lParams); spacket.DebugPrintSubPacket(); QueuePacket(spacket); } @@ -1541,7 +1541,7 @@ namespace FFXIVClassic_Map_Server.Actors public void SetEventStatus(Actor actor, string conditionName, bool enabled, byte unknown) { - QueuePacket(packets.send.actor.events.SetEventStatus.BuildPacket(actorId, actor.actorId, enabled, unknown, conditionName)); + QueuePacket(packets.send.actor.events.SetEventStatus.BuildPacket(actor.actorId, enabled, unknown, conditionName)); } public void RunEventFunction(string functionName, params object[] parameters) diff --git a/FFXIVClassic Map Server/dataobjects/Session.cs b/FFXIVClassic Map Server/dataobjects/Session.cs index 5a83c565..5344b928 100644 --- a/FFXIVClassic Map Server/dataobjects/Session.cs +++ b/FFXIVClassic Map Server/dataobjects/Session.cs @@ -36,10 +36,10 @@ namespace FFXIVClassic_Map_Server.dataobjects Server.GetWorldConnection().QueuePacket(basePacket); } - public void QueuePacket(SubPacket subPacket, bool isAuthed, bool isEncrypted) + public void QueuePacket(SubPacket subPacket) { - subPacket.header.targetId = id; - Server.GetWorldConnection().QueuePacket(subPacket, isAuthed, isEncrypted); + subPacket.SetTargetId(id); + Server.GetWorldConnection().QueuePacket(subPacket, true, false); } public Player GetActor() @@ -107,7 +107,7 @@ namespace FFXIVClassic_Map_Server.dataobjects if (npc.GetUniqueId().Equals("1") && milliseconds - lastMilis > 1000) { lastMilis = milliseconds; - GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId)); + GetActor().QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId)); actorInstanceList.RemoveAt(i); continue; } @@ -115,7 +115,7 @@ namespace FFXIVClassic_Map_Server.dataobjects if (!list.Contains(actorInstanceList[i])) { - GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId)); + GetActor().QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId)); actorInstanceList.RemoveAt(i); } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs index f23866c2..49814e28 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs @@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x016C; public const uint PACKET_SIZE = 0x48; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.EmoteEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.EmoteEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetEventStatus.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetEventStatus.cs index c86d3a0f..5f0e85e8 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetEventStatus.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetEventStatus.cs @@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x0136; public const uint PACKET_SIZE = 0x48; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, bool enabled, byte unknown2, string conditionName) + public static SubPacket BuildPacket(uint sourceActorId, bool enabled, byte unknown2, string conditionName) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs index f6ed17d4..3f866f44 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs @@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x016B; public const uint PACKET_SIZE = 0x48; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.NoticeEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.NoticeEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs index a093788a..0caa1982 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs @@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x016F; public const uint PACKET_SIZE = 0x58; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushCircleEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.PushCircleEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -31,7 +31,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs index 8b070ea7..21b270fb 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs @@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x0170; public const uint PACKET_SIZE = 0x60; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushFanEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.PushFanEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events binWriter.Write((Single)condition.radius); binWriter.Write((UInt32)0xbfc90fdb); binWriter.Write((UInt32)0x3f860a92); - binWriter.Write((UInt32)sourceActorID); //Actor Id + binWriter.Write((UInt32)sourceActorId); //Actor Id binWriter.Write((Single)10.0f); binWriter.Seek(4, SeekOrigin.Current); binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box @@ -32,8 +32,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } - new SubPacket(OPCODE, sourceActorID, playerActorID, data).DebugPrintSubPacket(); - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + new SubPacket(OPCODE, sourceActorId, data).DebugPrintSubPacket(); + return new SubPacket(OPCODE, sourceActorId, data); } } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs index a397e088..81d2cf96 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs @@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x0175; public const uint PACKET_SIZE = 0x60; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushBoxEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.PushBoxEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -31,7 +31,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs index f3b47bfd..2d0a6b49 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs @@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x012E; public const uint PACKET_SIZE = 0x48; - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.TalkEventCondition condition) + public static SubPacket BuildPacket(uint sourceActorId, EventList.TalkEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events } } - return new SubPacket(OPCODE, sourceActorID, playerActorID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/inventory/InventoryEndChangePacket.cs b/FFXIVClassic Map Server/packets/send/Actor/inventory/InventoryEndChangePacket.cs index 24499b25..bab10398 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/inventory/InventoryEndChangePacket.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/inventory/InventoryEndChangePacket.cs @@ -7,14 +7,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory public const ushort OPCODE = 0x016E; public const uint PACKET_SIZE = 0x28; - public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId) + public static SubPacket BuildPacket(uint sourceActorId) { - return new SubPacket(OPCODE, sourceActorId, targetActorId, new byte[8]); - } - - public static SubPacket BuildPacket(uint playerActorID) - { - return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]); + return new SubPacket(OPCODE, sourceActorId, new byte[8]); } + } } diff --git a/FFXIVClassic Map Server/packets/send/GameMessagePacket.cs b/FFXIVClassic Map Server/packets/send/GameMessagePacket.cs index 553f5eec..52ef05ff 100644 --- a/FFXIVClassic Map Server/packets/send/GameMessagePacket.cs +++ b/FFXIVClassic Map Server/packets/send/GameMessagePacket.cs @@ -58,7 +58,7 @@ namespace FFXIVClassic_Map_Server.packets.send private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR4 = 0x48; private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR5 = 0x68; - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint actorId, uint textOwnerActorId, ushort textId, byte log) + public static SubPacket BuildPacket(uint sourceActorId, uint actorId, uint textOwnerActorId, ushort textId, byte log) { byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR1 - 0x20]; @@ -73,10 +73,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(OPCODE_GAMEMESSAGE_WITH_ACTOR1, sourceId, targetId, data); + return new SubPacket(OPCODE_GAMEMESSAGE_WITH_ACTOR1, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint actorId, uint textOwnerActorId, ushort textId, byte log, List lParams) + public static SubPacket BuildPacket(uint sourceActorId, uint actorId, uint textOwnerActorId, ushort textId, byte log, List lParams) { int lParamsSize = findSizeOfParams(lParams); byte[] data; @@ -121,10 +121,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(opcode, sourceId, targetId, data); + return new SubPacket(opcode, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, string sender, byte log) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, string sender, byte log) { byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 - 0x20]; @@ -139,10 +139,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1, sourceId, targetId, data); + return new SubPacket(OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, string sender, byte log, List lParams) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, string sender, byte log, List lParams) { int lParamsSize = findSizeOfParams(lParams); byte[] data; @@ -187,10 +187,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(opcode, sourceId, targetId, data); + return new SubPacket(opcode, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log) { byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER1 - 0x20]; @@ -205,10 +205,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1, sourceId, targetId, data); + return new SubPacket(OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log, List lParams) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log, List lParams) { int lParamsSize = findSizeOfParams(lParams); byte[] data; @@ -253,10 +253,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(opcode, sourceId, targetId, data); + return new SubPacket(opcode, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, byte log) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, byte log) { byte[] data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR1 - 0x20]; @@ -270,10 +270,10 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1, sourceId, targetId, data); + return new SubPacket(OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1, sourceActorId, data); } - public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, byte log, List lParams) + public static SubPacket BuildPacket(uint sourceActorId, uint textOwnerActorId, ushort textId, byte log, List lParams) { int lParamsSize = findSizeOfParams(lParams); byte[] data; @@ -317,7 +317,7 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(opcode, sourceId, targetId, data); + return new SubPacket(opcode, sourceActorId, data); } private static int findSizeOfParams(List lParams) diff --git a/FFXIVClassic Map Server/packets/send/SendMessagePacket.cs b/FFXIVClassic Map Server/packets/send/SendMessagePacket.cs index 5fa97c71..9b368e90 100644 --- a/FFXIVClassic Map Server/packets/send/SendMessagePacket.cs +++ b/FFXIVClassic Map Server/packets/send/SendMessagePacket.cs @@ -36,7 +36,7 @@ namespace FFXIVClassic_Map_Server.packets.send public const ushort OPCODE = 0x0003; public const uint PACKET_SIZE = 0x248; - public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint messageType, string sender, string message) + public static SubPacket BuildPacket(uint sourceActorId, uint messageType, string sender, string message) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -51,7 +51,7 @@ namespace FFXIVClassic_Map_Server.packets.send } } - return new SubPacket(OPCODE, playerActorID, targetID, data); + return new SubPacket(OPCODE, sourceActorId, data); } } diff --git a/FFXIVClassic Map Server/utils/ActorPropertyPacketUtil.cs b/FFXIVClassic Map Server/utils/ActorPropertyPacketUtil.cs index e5f11f8f..20200876 100644 --- a/FFXIVClassic Map Server/utils/ActorPropertyPacketUtil.cs +++ b/FFXIVClassic Map Server/utils/ActorPropertyPacketUtil.cs @@ -9,16 +9,14 @@ namespace FFXIVClassic_Map_Server.utils class ActorPropertyPacketUtil { private Actor forActor; - private uint playerActorId; private List subPackets = new List(); private SetActorPropetyPacket currentActorPropertyPacket; private string currentTarget; - public ActorPropertyPacketUtil(string firstTarget, Actor forActor, uint playerActorId) + public ActorPropertyPacketUtil(string firstTarget, Actor forActor) { currentActorPropertyPacket = new SetActorPropetyPacket(firstTarget); this.forActor = forActor; - this.playerActorId = playerActorId; this.currentTarget = firstTarget; } @@ -28,7 +26,7 @@ namespace FFXIVClassic_Map_Server.utils { currentActorPropertyPacket.SetIsMore(true); currentActorPropertyPacket.AddTarget(); - subPackets.Add(currentActorPropertyPacket.BuildPacket(playerActorId, forActor.actorId)); + subPackets.Add(currentActorPropertyPacket.BuildPacket(forActor.actorId)); currentActorPropertyPacket = new SetActorPropetyPacket(currentTarget); currentActorPropertyPacket.AddProperty(forActor, property); } @@ -45,7 +43,7 @@ namespace FFXIVClassic_Map_Server.utils { currentActorPropertyPacket.AddTarget(); currentActorPropertyPacket.SetIsMore(false); - subPackets.Add(currentActorPropertyPacket.BuildPacket(playerActorId, forActor.actorId)); + subPackets.Add(currentActorPropertyPacket.BuildPacket(forActor.actorId)); return subPackets; }