mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Implemented the player portion of the new actor system.
This commit is contained in:
		| @@ -214,19 +214,17 @@ namespace FFXIVClassic_Lobby_Server | ||||
|                             reply12.replaceActorID(player.actorID); | ||||
|                             #endregion | ||||
|  | ||||
|                            client.queuePacket(SetMapPacket.buildPacket(player.actorID, 0xD1, 0xF4), true, false);                             | ||||
|                             client.queuePacket(SetMapPacket.buildPacket(player.actorID, 0xD1, 0xF4), true, false);                             | ||||
|                            // client.queuePacket(SetMapPacket.buildPacket(player.actorID, 0x68, 0xF4), true, false); | ||||
|                             client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false); | ||||
|                             client.queuePacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "-------- Login Message --------\nWelcome to the 1.0 Dev Server"), true, false); | ||||
|                             client.queuePacket(SetMusicPacket.buildPacket(player.actorID, 0x3D, 0x01), true, false); | ||||
|                             client.queuePacket(SetWeatherPacket.buildPacket(player.actorID, SetWeatherPacket.WEATHER_CLEAR), true, false);                             | ||||
|  | ||||
|                             client.queuePacket(AddActorPacket.buildPacket(player.actorID, player.actorID, 0), true, false); | ||||
|  | ||||
|                            // client.queuePacket(reply6); | ||||
|  | ||||
|                             client.queuePacket(block132); | ||||
|                             BasePacket actorPacket = player.getActor().createActorSpawnPackets(player.actorID); | ||||
|                             //client.queuePacket(block132); | ||||
|                             BasePacket actorPacket = player.getActor().getInitPackets(player.actorID); | ||||
|                             actorPacket.debugPrintPacket(); | ||||
|                             client.queuePacket(actorPacket); | ||||
|                  | ||||
| @@ -245,12 +243,7 @@ namespace FFXIVClassic_Lobby_Server | ||||
|                             partyListEntries.Add(new ListEntry(0x029B27D3, 0xFFFFFFFF, 0x195, false, true, "Valentine Bluefeather")); | ||||
|                             BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(player.actorID, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false); | ||||
|                             client.queuePacket(partyListPacket);                           | ||||
|                              | ||||
|                             //0x144 happens | ||||
|                             client.queuePacket(SetActorStatusAllPacket.buildPacket(player.actorID, player.actorID, new ushort[] { 23263, 23264 }), true, false);                             | ||||
|                             client.queuePacket(SetActorIconPacket.buildPacket(player.actorID, player.actorID, 0), true, false);                             | ||||
|                             client.queuePacket(SetActorIsZoningPacket.buildPacket(player.actorID, player.actorID, false), true, false);     | ||||
|                 | ||||
|                                             | ||||
|                             ////////ITEMS//////// | ||||
|                             client.queuePacket(InventoryBeginChangePacket.buildPacket(player.actorID), true, false); | ||||
|  | ||||
|   | ||||
| @@ -24,7 +24,8 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|         public uint displayNameId = 0xFFFFFFFF; | ||||
|         public string customDisplayName; | ||||
|  | ||||
|         public uint animationId; | ||||
|         public uint currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE; | ||||
|         public uint currentSubState = SetActorStatePacket.SUB_STATE_NONE; | ||||
|  | ||||
|         public float positionX, positionY, positionZ, rotation; | ||||
|         public float oldPositionX, oldPositionY, oldPositionZ, oldRotation; | ||||
| @@ -32,6 +33,8 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|  | ||||
|         public uint currentZoneId; | ||||
|  | ||||
|         public bool isZoning = false; | ||||
|  | ||||
|         public string className; | ||||
|         public List<LuaParam> classParams; | ||||
|  | ||||
| @@ -40,6 +43,11 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|             actorId = Id; | ||||
|         } | ||||
|  | ||||
|         public SubPacket createAddActorPacket(uint playerActorId) | ||||
|         { | ||||
|             return AddActorPacket.buildPacket(actorId, playerActorId, 0); | ||||
|         }  | ||||
|  | ||||
|         public SubPacket createNamePacket(uint playerActorId) | ||||
|         {             | ||||
|             return SetActorNamePacket.buildPacket(actorId, playerActorId,  displayNameId, displayNameId == 0xFFFFFFFF ? customDisplayName : ""); | ||||
| @@ -59,19 +67,33 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|         public SubPacket createPositionUpdatePacket(uint playerActorId) | ||||
|         { | ||||
|             return MoveActorToPositionPacket.buildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState); | ||||
|         }         | ||||
|         } | ||||
|  | ||||
|         public SubPacket createScriptBindPacket(uint playerActorId) | ||||
|         public SubPacket createStatePacket(uint playerActorID) | ||||
|         { | ||||
|             return SetActorStatePacket.buildPacket(actorId, playerActorID, currentMainState, currentSubState); | ||||
|         } | ||||
|  | ||||
|         public SubPacket createIsZoneingPacket(uint playerActorId) | ||||
|         { | ||||
|             return SetActorIsZoningPacket.buildPacket(actorId, playerActorId, false); | ||||
|         } | ||||
|  | ||||
|         public virtual SubPacket createScriptBindPacket(uint playerActorId) | ||||
|         { | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         public BasePacket createActorSpawnPackets(uint playerActorId) | ||||
|         public virtual BasePacket getInitPackets(uint playerActorId) | ||||
|         { | ||||
|             if (this is Character) | ||||
|                 return ((Character)this).createActorSpawnPackets(playerActorId); | ||||
|             else | ||||
|                 return null; | ||||
|             List<SubPacket> subpackets = new List<SubPacket>(); | ||||
|             subpackets.Add(createAddActorPacket(playerActorId)); | ||||
|             subpackets.Add(createSpeedPacket(playerActorId)); | ||||
|             subpackets.Add(createSpawnPositonPacket(playerActorId, 0xFF));             | ||||
|             subpackets.Add(createNamePacket(playerActorId)); | ||||
|             subpackets.Add(createStatePacket(playerActorId)); | ||||
|             subpackets.Add(createIsZoneingPacket(playerActorId)); | ||||
|             return BasePacket.createPacket(subpackets, true, false); | ||||
|         } | ||||
|          | ||||
|         public override bool Equals(Object obj) | ||||
|   | ||||
| @@ -8,6 +8,9 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
| { | ||||
|     class CharaWork | ||||
|     { | ||||
|         public uint PROPERTY_NAMEPLATE_VISIBLE = 1; | ||||
|         public uint PROPERTY_NAMEPLATE_VISIBLE2 = 5; | ||||
|  | ||||
|         public ParameterSave    parameterSave = new ParameterSave(); | ||||
|         public ParameterTemp    parameterTemp = new ParameterTemp(); | ||||
|         public BattleSave       battleSave = new BattleSave(); | ||||
| @@ -15,8 +18,9 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
|         public EventSave        eventSave = new EventSave(); | ||||
|         public EventTemp        eventTemp = new EventTemp(); | ||||
|  | ||||
|         public byte[] property = new byte[32]; | ||||
|         public byte[]   property = new byte[32]; | ||||
|  | ||||
|         public ushort[] status = new ushort[20]; | ||||
|         public uint[]   statusShownTime = new uint[20]; | ||||
|  | ||||
|         public int[]    command = new int[64]; | ||||
|   | ||||
| @@ -39,12 +39,13 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
|         public uint modelID; | ||||
|         public uint[] appearanceIDs = new uint[0x1D]; | ||||
|  | ||||
|         public uint animationId = 0; | ||||
|  | ||||
|         public uint currentTarget = 0xC0000000; | ||||
|         public uint currentLockedTarget = 0xC0000000; | ||||
|  | ||||
|         public uint currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE; | ||||
|         public uint currentSubState = SetActorStatePacket.SUB_STATE_PLAYER; | ||||
|  | ||||
|         public uint currentActorIcon = 0; | ||||
|          | ||||
|         public CharaWork charaWork = new CharaWork(); | ||||
|         public PlayerWork playerWork = new PlayerWork(); | ||||
|  | ||||
| @@ -52,27 +53,25 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
|         { | ||||
|         } | ||||
|  | ||||
|         public SubPacket createAppearancePacket(uint playerActorID) | ||||
|         public SubPacket createAppearancePacket(uint playerActorId) | ||||
|         { | ||||
|             SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelID, appearanceIDs); | ||||
|             return setappearance.buildPacket(actorId, playerActorID); | ||||
|             return setappearance.buildPacket(actorId, playerActorId); | ||||
|         } | ||||
|  | ||||
|         public SubPacket createStatePacket(uint playerActorID) | ||||
|         public SubPacket createInitStatusPacket(uint playerActorId) | ||||
|         { | ||||
|             return SetActorStatePacket.buildPacket(actorId, playerActorID, currentMainState, currentSubState); | ||||
|             return (SetActorStatusAllPacket.buildPacket(actorId, playerActorId, charaWork.status));                       | ||||
|         } | ||||
|  | ||||
|         public BasePacket createActorSpawnPackets(uint playerActorID) | ||||
|         public SubPacket createSetActorIconPacket(uint playerActorId) | ||||
|         { | ||||
|             List<SubPacket> subpackets = new List<SubPacket>(); | ||||
|             subpackets.Add(createSpeedPacket(playerActorID)); | ||||
|             subpackets.Add(createSpawnPositonPacket(playerActorID, 0xFF)); | ||||
|             subpackets.Add(createAppearancePacket(playerActorID)); | ||||
|             subpackets.Add(createNamePacket(playerActorID)); | ||||
|             subpackets.Add(_0xFPacket.buildPacket(playerActorID, playerActorID)); | ||||
|             subpackets.Add(createStatePacket(playerActorID));             | ||||
|             return BasePacket.createPacket(subpackets, true, false); | ||||
|             return SetActorIconPacket.buildPacket(actorId, playerActorId, currentActorIcon); | ||||
|         } | ||||
|  | ||||
|         public SubPacket createIdleAnimationPacket(uint playerActorId) | ||||
|         { | ||||
|             return SetActorIdleAnimationPacket.buildPacket(actorId, playerActorId, animationId); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|   | ||||
| @@ -1,7 +1,10 @@ | ||||
| using FFXIVClassic_Lobby_Server; | ||||
| using FFXIVClassic_Lobby_Server.common; | ||||
| using FFXIVClassic_Lobby_Server.dataobjects; | ||||
| using FFXIVClassic_Lobby_Server.packets; | ||||
| using FFXIVClassic_Map_Server.dataobjects.database; | ||||
| using FFXIVClassic_Map_Server.lua; | ||||
| using FFXIVClassic_Map_Server.packets.send.actor; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| @@ -12,6 +15,8 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
| { | ||||
|     class Player : Character | ||||
|     { | ||||
|         PlayerWork playerWork = new PlayerWork(); | ||||
|  | ||||
|         public Player(uint actorID) : base(actorID) | ||||
|         { | ||||
|             actorName = String.Format("_player{0:00000000}", actorID); | ||||
| @@ -66,7 +71,59 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara | ||||
|             appearanceIDs[L_EAR] = appearance.leftEar; | ||||
|             appearanceIDs[R_FINGER] = appearance.rightFinger; | ||||
|             appearanceIDs[L_FINGER] = appearance.leftFinger; | ||||
|  | ||||
|         } | ||||
|  | ||||
|         public List<SubPacket> create0x132Packets(uint playerActorId) | ||||
|         { | ||||
|             List<SubPacket> packets = new List<SubPacket>(); | ||||
|             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")); | ||||
|             return packets; | ||||
|         } | ||||
|  | ||||
|         public override SubPacket createScriptBindPacket(uint playerActorId) | ||||
|         { | ||||
|             List<LuaParam> lParams; | ||||
|             if (isMyPlayer(playerActorId)) | ||||
|             { | ||||
|  | ||||
|                 lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true); | ||||
|             } | ||||
|             else | ||||
|                 lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true); | ||||
|  | ||||
|             return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams); | ||||
|         }         | ||||
|  | ||||
|         public override BasePacket getInitPackets(uint playerActorId) | ||||
|         { | ||||
|             List<SubPacket> subpackets = new List<SubPacket>(); | ||||
|             subpackets.Add(createAddActorPacket(playerActorId)); | ||||
|             if (isMyPlayer(playerActorId)) | ||||
|                 subpackets.AddRange(create0x132Packets(playerActorId)); | ||||
|             subpackets.Add(createSpeedPacket(playerActorId)); | ||||
|             subpackets.Add(createSpawnPositonPacket(playerActorId, 0xFF)); | ||||
|             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.Add(createScriptBindPacket(playerActorId)); | ||||
|             return BasePacket.createPacket(subpackets, true, false); | ||||
|         } | ||||
|  | ||||
|         public bool isMyPlayer(uint otherActorId) | ||||
|         { | ||||
|             return actorId == otherActorId; | ||||
|         }         | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -137,7 +137,7 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     BasePacket p = actor.createActorSpawnPackets(playerActor.actorId); | ||||
|                     BasePacket p = actor.getInitPackets(playerActor.actorId); | ||||
|                     p.replaceActorID(playerActor.actorId); | ||||
|                     basePackets.Add(p); | ||||
|                     actorInstanceList.Add(actor); | ||||
|   | ||||
| @@ -186,7 +186,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             return luaParams; | ||||
|         } | ||||
|  | ||||
|         public static List<LuaParam> createLuaParamList(object[] list) | ||||
|         public static List<LuaParam> createLuaParamList(params object[] list) | ||||
|         { | ||||
|             List<LuaParam> luaParams = new List<LuaParam>(); | ||||
|  | ||||
| @@ -218,7 +218,7 @@ namespace FFXIVClassic_Map_Server | ||||
|             } | ||||
|  | ||||
|             return luaParams; | ||||
|         } | ||||
|         }         | ||||
|  | ||||
|         public static object[] createLuaParamObjectList(List <LuaParam> luaParams) | ||||
|         { | ||||
|   | ||||
| @@ -25,10 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor | ||||
|  | ||||
|                     if (displayNameID == 0xFFFFFFFF) | ||||
|                     { | ||||
|                         if (customName.Length <= 0x20) | ||||
|                             binWriter.Write(Encoding.ASCII.GetBytes(customName)); | ||||
|                         else | ||||
|                             binWriter.Write(Encoding.ASCII.GetBytes("ERROR: NAME TO BIG")); | ||||
|                         binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName)); | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|   | ||||
| @@ -25,6 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor | ||||
|         public const int MAIN_STATE_UNKNOWN4 = 0x20; | ||||
|  | ||||
|         //What is this for? | ||||
|         public const int SUB_STATE_NONE = 0x00; | ||||
|         public const int SUB_STATE_PLAYER = 0xBF; | ||||
|         public const int SUB_STATE_MONSTER = 0x03; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user