/// <summary> /// </summary> /// <param name="characterToSend"> /// </param> /// <returns> /// </returns> public static AppearanceUpdateMessage Create(ICharacter characterToSend) { var character = (Character)characterToSend; var message = new AppearanceUpdateMessage { Identity = character.Identity, Unknown = 0x00, }; List <AOMeshs> meshs; int counter; bool socialonly; bool showsocial; /* * bool showhelmet; * bool LeftPadVisible; * bool RightPadVisible; * bool DoubleLeftPad; * bool DoubleRightPad; * * int TexturesCount; * int HairMeshValue; * int WeaponMeshRightValue; * int WeaponMeshLeftValue; * * uint HeadMeshBaseValue; * int HeadMeshValue; * * int BackMeshValue; * int ShoulderMeshRightValue; */ // int ShoulderMeshRightValue; int VisualFlags; int PlayField; int bodyMesh = 0; /* * int OverrideTextureHead; * int OverrideTextureWeaponRight; * int OverrideTextureWeaponLeft; * int OverrideTextureShoulderpadRight; * int OverrideTextureShoulderpadLeft; * int OverrideTextureBack; * int OverrideTextureAttractor; */ var textures = new List <AOTextures>(); var socialTab = new Dictionary <int, int>(); lock (character) { VisualFlags = character.Stats[StatIds.visualflags].Value; socialonly = (VisualFlags & 0x40) > 0; showsocial = (VisualFlags & 0x20) > 0; bodyMesh = character.Stats[StatIds.mesh].Value; /* * showhelmet = ((character.Stats.VisualFlags.Value & 0x4) > 0); * LeftPadVisible = ((character.Stats.VisualFlags.Value & 0x1) > 0); * RightPadVisible = ((character.Stats.VisualFlags.Value & 0x2) > 0); * DoubleLeftPad = ((character.Stats.VisualFlags.Value & 0x8) > 0); * DoubleRightPad = ((character.Stats.VisualFlags.Value & 0x10) > 0); * * HairMeshValue = character.Stats.HairMesh.Value; * TexturesCount = character.Textures.Count; * HairMeshValue = character.Stats.HairMesh.Value; * WeaponMeshRightValue = character.Stats.WeaponMeshRight.Value; * WeaponMeshLeftValue = character.Stats.WeaponMeshLeft.Value; * * HeadMeshBaseValue = character.Stats.HeadMesh.StatBaseValue; * HeadMeshValue = character.Stats.HeadMesh.Value; * * BackMeshValue = character.Stats.BackMesh.Value; * ShoulderMeshRightValue = character.Stats.ShoulderMeshRight.Value; */ // ShoulderMeshLeftValue = character.Stats.ShoulderMeshLeft.Value; /* * OverrideTextureHead = character.Stats.OverrideTextureHead.Value; * OverrideTextureWeaponRight = character.Stats.OverrideTextureWeaponRight.Value; * OverrideTextureWeaponLeft = character.Stats.OverrideTextureWeaponLeft.Value; * OverrideTextureShoulderpadRight = character.Stats.OverrideTextureShoulderpadRight.Value; * OverrideTextureShoulderpadLeft = character.Stats.OverrideTextureShoulderpadLeft.Value; * OverrideTextureBack = character.Stats.OverrideTextureBack.Value; * OverrideTextureAttractor = character.Stats.OverrideTextureAttractor.Value; */ PlayField = character.Playfield.Identity.Instance; foreach (int num in character.SocialTab.Keys) { socialTab.Add(num, character.SocialTab[num]); } foreach (AOTextures texture in character.Textures) { textures.Add(new AOTextures(texture.place, texture.Texture)); } meshs = MeshLayers.GetMeshs(character, showsocial, socialonly); } var texturesToSend = new List <Texture>(); var aotemp = new AOTextures(0, 0); for (counter = 0; counter < 5; counter++) { aotemp.Texture = 0; aotemp.place = counter; int c2; for (c2 = 0; c2 < textures.Count; c2++) { if (textures[c2].place == counter) { aotemp.Texture = textures[c2].Texture; break; } } if (showsocial) { if (socialonly) { aotemp.Texture = socialTab[counter]; } else { if (socialTab[counter] != 0) { aotemp.Texture = socialTab[counter]; } } } texturesToSend.Add(new Texture { Place = aotemp.place, Id = aotemp.Texture, Unknown = 0 }); } message.Textures = texturesToSend.ToArray(); message.Meshes = meshs.Select( mesh => new Mesh { Position = (byte)mesh.Position, Id = (uint)mesh.Mesh, OverrideTextureId = mesh.OverrideTexture, Layer = (byte)mesh.Layer }).ToArray(); message.VisualFlags = (short)VisualFlags; message.Unknown1 = (byte)bodyMesh; return(message); }
/// <summary> /// </summary> /// <param name="character"> /// </param> public static void AnnounceAppearanceUpdate(Character character) { var message = new AppearanceUpdateMessage { Identity = character.Identity, Unknown = 0x00, }; List<AOMeshs> meshs; int counter; bool socialonly; bool showsocial; /* bool showhelmet; bool LeftPadVisible; bool RightPadVisible; bool DoubleLeftPad; bool DoubleRightPad; int TexturesCount; int HairMeshValue; int WeaponMeshRightValue; int WeaponMeshLeftValue; uint HeadMeshBaseValue; int HeadMeshValue; int BackMeshValue; int ShoulderMeshRightValue; */ // int ShoulderMeshRightValue; int VisualFlags; int PlayField; /* int OverrideTextureHead; int OverrideTextureWeaponRight; int OverrideTextureWeaponLeft; int OverrideTextureShoulderpadRight; int OverrideTextureShoulderpadLeft; int OverrideTextureBack; int OverrideTextureAttractor; */ var textures = new List<AOTextures>(); var socialTab = new Dictionary<int, int>(); lock (character) { VisualFlags = character.Stats["VisualFlags"].Value; socialonly = (character.Stats["VisualFlags"].Value & 0x40) > 0; showsocial = (character.Stats["VisualFlags"].Value & 0x20) > 0; /* showhelmet = ((character.Stats.VisualFlags.Value & 0x4) > 0); LeftPadVisible = ((character.Stats.VisualFlags.Value & 0x1) > 0); RightPadVisible = ((character.Stats.VisualFlags.Value & 0x2) > 0); DoubleLeftPad = ((character.Stats.VisualFlags.Value & 0x8) > 0); DoubleRightPad = ((character.Stats.VisualFlags.Value & 0x10) > 0); HairMeshValue = character.Stats.HairMesh.Value; TexturesCount = character.Textures.Count; HairMeshValue = character.Stats.HairMesh.Value; WeaponMeshRightValue = character.Stats.WeaponMeshRight.Value; WeaponMeshLeftValue = character.Stats.WeaponMeshLeft.Value; HeadMeshBaseValue = character.Stats.HeadMesh.StatBaseValue; HeadMeshValue = character.Stats.HeadMesh.Value; BackMeshValue = character.Stats.BackMesh.Value; ShoulderMeshRightValue = character.Stats.ShoulderMeshRight.Value; */ // ShoulderMeshLeftValue = character.Stats.ShoulderMeshLeft.Value; /* OverrideTextureHead = character.Stats.OverrideTextureHead.Value; OverrideTextureWeaponRight = character.Stats.OverrideTextureWeaponRight.Value; OverrideTextureWeaponLeft = character.Stats.OverrideTextureWeaponLeft.Value; OverrideTextureShoulderpadRight = character.Stats.OverrideTextureShoulderpadRight.Value; OverrideTextureShoulderpadLeft = character.Stats.OverrideTextureShoulderpadLeft.Value; OverrideTextureBack = character.Stats.OverrideTextureBack.Value; OverrideTextureAttractor = character.Stats.OverrideTextureAttractor.Value; */ PlayField = character.Playfield.Identity.Instance; foreach (int num in character.SocialTab.Keys) { socialTab.Add(num, character.SocialTab[num]); } foreach (AOTextures texture in character.Textures) { textures.Add(new AOTextures(texture.place, texture.Texture)); } meshs = MeshLayers.GetMeshs(character, showsocial, socialonly); } var texturesToSend = new List<Texture>(); var aotemp = new AOTextures(0, 0); for (counter = 0; counter < 5; counter++) { aotemp.Texture = 0; aotemp.place = counter; int c2; for (c2 = 0; c2 < textures.Count; c2++) { if (textures[c2].place == counter) { aotemp.Texture = textures[c2].Texture; break; } } if (showsocial) { if (socialonly) { aotemp.Texture = socialTab[counter]; } else { if (socialTab[counter] != 0) { aotemp.Texture = socialTab[counter]; } } } texturesToSend.Add(new Texture { Place = aotemp.place, Id = aotemp.Texture, Unknown = 0 }); } message.Textures = texturesToSend.ToArray(); message.Meshes = meshs.Select( mesh => new Mesh { Position = (byte)mesh.Position, Id = (uint)mesh.Mesh, OverrideTextureId = mesh.OverrideTexture, Layer = (byte)mesh.Layer }).ToArray(); message.VisualFlags = (short)VisualFlags; character.Playfield.Announce(message); }
/// <summary> /// </summary> /// <param name="character"> /// </param> public static void AnnounceAppearanceUpdate(ICharacter character) { AppearanceUpdateMessage message = Create(character); character.Playfield.Announce(message); }