mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Implemented equipment packets as well as actor name/appearance packets. Appearance and name is now retrieved for the chara id.
This commit is contained in:
		| @@ -1,4 +1,10 @@ | ||||
| using System; | ||||
| using FFXIVClassic_Lobby_Server; | ||||
| using FFXIVClassic_Lobby_Server.common; | ||||
| using FFXIVClassic_Lobby_Server.dataobjects; | ||||
| using FFXIVClassic_Lobby_Server.packets; | ||||
| using FFXIVClassic_Map_Server.packets.send.actor; | ||||
| using FFXIVClassic_Map_Server.packets.send.Actor; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| @@ -6,38 +12,40 @@ using System.Text; | ||||
| namespace FFXIVClassic_Map_Server.dataobjects | ||||
| { | ||||
|     class Actor | ||||
|     { | ||||
|         enum Appearance { | ||||
|             MODEL, | ||||
|             SIZE, | ||||
|             COLORINFO, | ||||
|             FACEINFO, | ||||
|             HIGHLIGHT_HAIR, | ||||
|             VOICE, | ||||
|             WEAPON1, | ||||
|             WEAPON2, | ||||
|             WEAPON3, | ||||
|             HEADGEAR, | ||||
|             BODYGEAR, | ||||
|             LEGSGEAR, | ||||
|             HANDSGEAR, | ||||
|             FEETGEAR, | ||||
|             WAISTGEAR, | ||||
|             UNKNOWN1, | ||||
|             R_EAR, | ||||
|             L_EAR, | ||||
|             UNKNOWN2, | ||||
|             UNKNOWN3, | ||||
|             R_FINGER, | ||||
|             L_FINGER | ||||
|         } | ||||
|     {         | ||||
|         public const int    SIZE = 0; | ||||
|         public const int    COLORINFO = 1; | ||||
|         public const int    FACEINFO = 2; | ||||
|         public const int    HIGHLIGHT_HAIR = 3; | ||||
|         public const int    VOICE = 4; | ||||
|         public const int    WEAPON1 = 5; | ||||
|         public const int    WEAPON2 = 6; | ||||
|         public const int    WEAPON3 = 7; | ||||
|         public const int    UNKNOWN1 = 8; | ||||
|         public const int    UNKNOWN2 = 9; | ||||
|         public const int    UNKNOWN3 = 10; | ||||
|         public const int    UNKNOWN4 = 11; | ||||
|         public const int    HEADGEAR = 12; | ||||
|         public const int    BODYGEAR = 13; | ||||
|         public const int    LEGSGEAR = 14; | ||||
|         public const int    HANDSGEAR = 15; | ||||
|         public const int    FEETGEAR = 16; | ||||
|         public const int    WAISTGEAR = 17; | ||||
|         public const int    UNKNOWN5 = 18; | ||||
|         public const int    R_EAR = 19; | ||||
|         public const int    L_EAR = 20; | ||||
|         public const int    UNKNOWN6 = 21; | ||||
|         public const int    UNKNOWN7 = 22; | ||||
|         public const int    R_FINGER = 23; | ||||
|         public const int    L_FINGER = 24; | ||||
|  | ||||
|         public uint actorID; | ||||
|  | ||||
|         public uint displayNameID; | ||||
|         public string customDisplayName; | ||||
|  | ||||
|         public uint[] appearanceIDs; | ||||
|         public uint modelID; | ||||
|         public uint[] appearanceIDs = new uint[0x1D]; | ||||
|  | ||||
|         public float positionX, positionY, positionZ; | ||||
|         public float oldPositionX, oldPositionY, oldPositionZ; | ||||
| @@ -49,5 +57,40 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|             actorID = id; | ||||
|         } | ||||
|  | ||||
|         public void setPlayerAppearance() | ||||
|         { | ||||
|             Appearance appearance = Database.getAppearance(actorID); | ||||
|  | ||||
|             modelID = Appearance.getTribeModel(appearance.tribe); | ||||
|             appearanceIDs[SIZE] = appearance.size; | ||||
|             appearanceIDs[COLORINFO] = (uint)(appearance.skinColor | (appearance.hairColor << 10) | (appearance.eyeColor << 20)); | ||||
|             appearanceIDs[FACEINFO] = PrimitiveConversion.ToUInt32(appearance.getFaceInfo()); | ||||
|             appearanceIDs[HIGHLIGHT_HAIR] = (uint)(appearance.hairHighlightColor | appearance.hairStyle << 10); | ||||
|             appearanceIDs[VOICE] = appearance.voice; | ||||
|             appearanceIDs[WEAPON1] = appearance.mainHand; | ||||
|             appearanceIDs[WEAPON2] = appearance.offHand; | ||||
|             appearanceIDs[HEADGEAR] = appearance.head; | ||||
|             appearanceIDs[BODYGEAR] = appearance.body; | ||||
|             appearanceIDs[LEGSGEAR] = appearance.legs; | ||||
|             appearanceIDs[HANDSGEAR] = appearance.hands; | ||||
|             appearanceIDs[FEETGEAR] = appearance.feet; | ||||
|             appearanceIDs[WAISTGEAR] = appearance.waist; | ||||
|             appearanceIDs[R_EAR] = appearance.rightEar; | ||||
|             appearanceIDs[L_EAR] = appearance.leftEar; | ||||
|             appearanceIDs[R_FINGER] = appearance.rightFinger; | ||||
|             appearanceIDs[L_FINGER] = appearance.leftFinger; | ||||
|         } | ||||
|  | ||||
|         public SubPacket createNamePacket(uint playerActorID) | ||||
|         {             | ||||
|             return SetActorNamePacket.buildPacket(playerActorID, actorID, displayNameID, displayNameID == 0xFFFFFFFF ? customDisplayName : ""); | ||||
|         } | ||||
|  | ||||
|         public SubPacket createAppearancePacket(uint playerActorID) | ||||
|         { | ||||
|             SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelID, appearanceIDs); | ||||
|             return setappearance.buildPacket(playerActorID, actorID); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										143
									
								
								FFXIVClassic Map Server/dataobjects/Appearance.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								FFXIVClassic Map Server/dataobjects/Appearance.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,143 @@ | ||||
| using FFXIVClassic_Lobby_Server.common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace FFXIVClassic_Lobby_Server.dataobjects | ||||
| { | ||||
|     class Appearance | ||||
|     { | ||||
|         //////////// | ||||
|         //Chara Info | ||||
|         public byte tribe = 0; | ||||
|         public byte size = 0; | ||||
|         public byte voice = 0; | ||||
|         public ushort skinColor = 0; | ||||
|  | ||||
|         public ushort hairStyle = 0; | ||||
|         public ushort hairColor = 0; | ||||
|         public ushort hairHighlightColor = 0; | ||||
|         public ushort eyeColor = 0; | ||||
|         public byte characteristicsColor = 0; | ||||
|  | ||||
|         public byte faceType = 0; | ||||
|         public byte faceEyebrows = 0; | ||||
|         public byte faceEyeShape = 0; | ||||
|         public byte faceIrisSize = 0; | ||||
|         public byte faceNose = 0; | ||||
|         public byte faceMouth = 0; | ||||
|         public byte faceFeatures = 0; | ||||
|         public byte characteristics = 0; | ||||
|         public byte ears = 0; | ||||
|  | ||||
|         public uint mainHand = 0; | ||||
|         public uint offHand = 0; | ||||
|  | ||||
|         public uint head = 0; | ||||
|         public uint body = 0; | ||||
|         public uint legs = 0; | ||||
|         public uint hands = 0; | ||||
|         public uint feet = 0; | ||||
|         public uint waist = 0; | ||||
|         public uint rightEar = 0; | ||||
|         public uint leftEar = 0; | ||||
|         public uint rightFinger = 0; | ||||
|         public uint leftFinger = 0; | ||||
|         //Chara Info | ||||
|         //////////// | ||||
|  | ||||
|         public struct FaceInfo | ||||
|         { | ||||
|             [BitfieldLength(5)] | ||||
|             public uint characteristics; | ||||
|             [BitfieldLength(3)] | ||||
|             public uint characteristicsColor; | ||||
|             [BitfieldLength(6)] | ||||
|             public uint type; | ||||
|             [BitfieldLength(2)] | ||||
|             public uint ears; | ||||
|             [BitfieldLength(2)] | ||||
|             public uint mouth; | ||||
|             [BitfieldLength(2)] | ||||
|             public uint features; | ||||
|             [BitfieldLength(3)] | ||||
|             public uint nose; | ||||
|             [BitfieldLength(3)] | ||||
|             public uint eyeShape; | ||||
|             [BitfieldLength(1)] | ||||
|             public uint irisSize; | ||||
|             [BitfieldLength(3)] | ||||
|             public uint eyebrows; | ||||
|             [BitfieldLength(2)] | ||||
|             public uint unknown; | ||||
|         } | ||||
|  | ||||
|         public FaceInfo getFaceInfo() | ||||
|         { | ||||
|             FaceInfo faceInfo = new FaceInfo(); | ||||
|             faceInfo.characteristics = characteristics; | ||||
|             faceInfo.characteristicsColor = characteristicsColor; | ||||
|             faceInfo.type = faceType; | ||||
|             faceInfo.ears = ears; | ||||
|             faceInfo.features = faceFeatures; | ||||
|             faceInfo.eyebrows = faceEyebrows; | ||||
|             faceInfo.eyeShape = faceEyeShape; | ||||
|             faceInfo.irisSize = faceIrisSize; | ||||
|             faceInfo.mouth = faceMouth; | ||||
|             faceInfo.nose = faceNose; | ||||
|             return faceInfo; | ||||
|         } | ||||
|  | ||||
|         public static UInt32 getTribeModel(byte tribe) | ||||
|         { | ||||
|             switch (tribe) | ||||
|             { | ||||
|                 //Hyur Midlander Male | ||||
|                 case 1: | ||||
|                 default: | ||||
|                     return 1; | ||||
|  | ||||
|                 //Hyur Midlander Female | ||||
|                 case 2: | ||||
|                     return 2; | ||||
|  | ||||
|                 //Elezen Male | ||||
|                 case 4: | ||||
|                 case 6: | ||||
|                     return 3; | ||||
|  | ||||
|                 //Elezen Female | ||||
|                 case 5: | ||||
|                 case 7: | ||||
|                     return 4; | ||||
|  | ||||
|                 //Lalafell Male | ||||
|                 case 8: | ||||
|                 case 10: | ||||
|                     return 5; | ||||
|  | ||||
|                 //Lalafell Female | ||||
|                 case 9: | ||||
|                 case 11: | ||||
|                     return 6; | ||||
|  | ||||
|                 //Miqo'te Female | ||||
|                 case 12: | ||||
|                 case 13: | ||||
|                     return 8; | ||||
|  | ||||
|                 //Roegadyn Male | ||||
|                 case 14: | ||||
|                 case 15: | ||||
|                     return 7; | ||||
|  | ||||
|                 //Hyur Highlander Male | ||||
|                 case 3: | ||||
|                     return 9; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -27,7 +27,8 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|         public Player(uint actorId) | ||||
|         { | ||||
|             this.actorID = actorId; | ||||
|             createPlayerActor(actorId, null); | ||||
|             Character chara = Database.getCharacter(actorId); | ||||
|             createPlayerActor(actorId, chara); | ||||
|         } | ||||
|  | ||||
|         public void addConnection(ClientConnection conn) | ||||
| @@ -72,9 +73,19 @@ namespace FFXIVClassic_Map_Server.dataobjects | ||||
|             return conn1; | ||||
|         } | ||||
|  | ||||
|         public Actor getActor() | ||||
|         { | ||||
|             return playerActor; | ||||
|         } | ||||
|  | ||||
|         public void createPlayerActor(uint actorId, Character chara) | ||||
|         { | ||||
|             playerActor = new Actor(actorId); | ||||
|  | ||||
|             playerActor.displayNameID = 0xFFFFFFFF; | ||||
|             playerActor.customDisplayName = chara.name; | ||||
|             playerActor.setPlayerAppearance(); | ||||
|  | ||||
|             actorInstanceList.Add(playerActor); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user