| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Linq; |
| using UnityEngine; |
| using UnityEngine; |
| |
| |
| . | public class VisEquipment : MonoBehaviour |
| public class VisEquipment : MonoBehaviour, IMonoUpdater |
| { |
| { |
| private void Awake() |
| private void Awake() |
| { |
| { |
| this.m_nview = ((this.m_nViewOverride != null) ? this.m_nViewOverride : base.GetComponent<ZNetView>()); |
| this.m_nview = ((this.m_nViewOverride != null) ? this.m_nViewOverride : base.GetComponent<ZNetView>()); |
| Transform transform = base.transform.Find("Visual"); |
| Transform transform = base.transform.Find("Visual"); |
| if (transform == null) |
| if (transform == null) |
| { |
| { |
| transform = base.transform; |
| transform = base.transform; |
| } |
| } |
| this.m_visual = transform.gameObject; |
| this.m_visual = transform.gameObject; |
| this.m_lodGroup = this.m_visual.GetComponentInChildren<LODGroup>(); |
| this.m_lodGroup = this.m_visual.GetComponentInChildren<LODGroup>(); |
| if (this.m_bodyModel != null && this.m_bodyModel.material.HasProperty("_ChestTex")) |
| if (this.m_bodyModel != null && this.m_bodyModel.material.HasProperty("_ChestTex")) |
| { |
| { |
| this.m_emptyBodyTexture = this.m_bodyModel.material.GetTexture("_ChestTex"); |
| this.m_emptyBodyTexture = this.m_bodyModel.material.GetTexture("_ChestTex"); |
| } |
| } |
| if (this.m_bodyModel != null && this.m_bodyModel.material.HasProperty("_LegsTex")) |
| if (this.m_bodyModel != null && this.m_bodyModel.material.HasProperty("_LegsTex")) |
| { |
| { |
| this.m_emptyLegsTexture = this.m_bodyModel.material.GetTexture("_LegsTex"); |
| this.m_emptyLegsTexture = this.m_bodyModel.material.GetTexture("_LegsTex"); |
| } |
| } |
| } |
| } |
| |
| |
| private void OnEnable() |
| private void OnEnable() |
| { |
| { |
| VisEquipment.Instances.Add(this); |
| VisEquipment.Instances.Add(this); |
| } |
| } |
| |
| |
| private void OnDisable() |
| private void OnDisable() |
| { |
| { |
| VisEquipment.Instances.Remove(this); |
| VisEquipment.Instances.Remove(this); |
| } |
| } |
| |
| |
| private void Start() |
| private void Start() |
| { |
| { |
| this.UpdateVisuals(); |
| this.UpdateVisuals(); |
| } |
| } |
| |
| |
| public void SetWeaponTrails(bool enabled) |
| public void SetWeaponTrails(bool enabled) |
| { |
| { |
| if (this.m_useAllTrails) |
| if (this.m_useAllTrails) |
| { |
| { |
| MeleeWeaponTrail[] array = base.gameObject.GetComponentsInChildren<MeleeWeaponTrail>(); |
| MeleeWeaponTrail[] array = base.gameObject.GetComponentsInChildren<MeleeWeaponTrail>(); |
| for (int i = 0; i < array.Length; i++) |
| for (int i = 0; i < array.Length; i++) |
| { |
| { |
| array[i].Emit = enabled; |
| array[i].Emit = enabled; |
| } |
| } |
| return; |
| return; |
| } |
| } |
| if (this.m_rightItemInstance) |
| if (this.m_rightItemInstance) |
| { |
| { |
| MeleeWeaponTrail[] array = this.m_rightItemInstance.GetComponentsInChildren<MeleeWeaponTrail>(); |
| MeleeWeaponTrail[] array = this.m_rightItemInstance.GetComponentsInChildren<MeleeWeaponTrail>(); |
| for (int i = 0; i < array.Length; i++) |
| for (int i = 0; i < array.Length; i++) |
| { |
| { |
| array[i].Emit = enabled; |
| array[i].Emit = enabled; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public void SetModel(int index) |
| public void SetModel(int index) |
| { |
| { |
| if (this.m_modelIndex == index) |
| if (this.m_modelIndex == index) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (index < 0 || index >= this.m_models.Length) |
| if (index < 0 || index >= this.m_models.Length) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ZLog.Log("Vis equip model set to " + index.ToString()); |
| ZLog.Log("Vis equip model set to " + index.ToString()); |
| this.m_modelIndex = index; |
| this.m_modelIndex = index; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_modelIndex, this.m_modelIndex, false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_modelIndex, this.m_modelIndex, false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetSkinColor(Vector3 color) |
| public void SetSkinColor(Vector3 color) |
| { |
| { |
| if (color == this.m_skinColor) |
| if (color == this.m_skinColor) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_skinColor = color; |
| this.m_skinColor = color; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_skinColor, this.m_skinColor); |
| this.m_nview.GetZDO().Set(ZDOVars.s_skinColor, this.m_skinColor); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetHairColor(Vector3 color) |
| public void SetHairColor(Vector3 color) |
| { |
| { |
| if (this.m_hairColor == color) |
| if (this.m_hairColor == color) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_hairColor = color; |
| this.m_hairColor = color; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_hairColor, this.m_hairColor); |
| this.m_nview.GetZDO().Set(ZDOVars.s_hairColor, this.m_hairColor); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetItem(VisSlot slot, string name, int variant = 0) |
| public void SetItem(VisSlot slot, string name, int variant = 0) |
| { |
| { |
| switch (slot) |
| switch (slot) |
| { |
| { |
| case VisSlot.HandLeft: |
| case VisSlot.HandLeft: |
| this.SetLeftItem(name, variant); |
| this.SetLeftItem(name, variant); |
| return; |
| return; |
| case VisSlot.HandRight: |
| case VisSlot.HandRight: |
| this.SetRightItem(name); |
| this.SetRightItem(name); |
| return; |
| return; |
| case VisSlot.BackLeft: |
| case VisSlot.BackLeft: |
| this.SetLeftBackItem(name, variant); |
| this.SetLeftBackItem(name, variant); |
| return; |
| return; |
| case VisSlot.BackRight: |
| case VisSlot.BackRight: |
| this.SetRightBackItem(name); |
| this.SetRightBackItem(name); |
| return; |
| return; |
| case VisSlot.Chest: |
| case VisSlot.Chest: |
| this.SetChestItem(name); |
| this.SetChestItem(name); |
| return; |
| return; |
| case VisSlot.Legs: |
| case VisSlot.Legs: |
| this.SetLegItem(name); |
| this.SetLegItem(name); |
| return; |
| return; |
| case VisSlot.Helmet: |
| case VisSlot.Helmet: |
| this.SetHelmetItem(name); |
| this.SetHelmetItem(name); |
| return; |
| return; |
| case VisSlot.Shoulder: |
| case VisSlot.Shoulder: |
| this.SetShoulderItem(name, variant); |
| this.SetShoulderItem(name, variant); |
| return; |
| return; |
| case VisSlot.Utility: |
| case VisSlot.Utility: |
| this.SetUtilityItem(name); |
| this.SetUtilityItem(name); |
| return; |
| return; |
| case VisSlot.Beard: |
| case VisSlot.Beard: |
| this.SetBeardItem(name); |
| this.SetBeardItem(name); |
| return; |
| return; |
| case VisSlot.Hair: |
| case VisSlot.Hair: |
| this.SetHairItem(name); |
| this.SetHairItem(name); |
| return; |
| return; |
| default: |
| default: |
| throw new NotImplementedException("Unknown slot: " + slot.ToString()); |
| throw new NotImplementedException("Unknown slot: " + slot.ToString()); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetLeftItem(string name, int variant) |
| public void SetLeftItem(string name, int variant) |
| { |
| { |
| if (this.m_leftItem == name && this.m_leftItemVariant == variant) |
| if (this.m_leftItem == name && this.m_leftItemVariant == variant) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_leftItem = name; |
| this.m_leftItem = name; |
| this.m_leftItemVariant = variant; |
| this.m_leftItemVariant = variant; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftItemVariant, variant, false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftItemVariant, variant, false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetRightItem(string name) |
| public void SetRightItem(string name) |
| { |
| { |
| if (this.m_rightItem == name) |
| if (this.m_rightItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_rightItem = name; |
| this.m_rightItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_rightItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_rightItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetLeftBackItem(string name, int variant) |
| public void SetLeftBackItem(string name, int variant) |
| { |
| { |
| if (this.m_leftBackItem == name && this.m_leftBackItemVariant == variant) |
| if (this.m_leftBackItem == name && this.m_leftBackItemVariant == variant) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_leftBackItem = name; |
| this.m_leftBackItem = name; |
| this.m_leftBackItemVariant = variant; |
| this.m_leftBackItemVariant = variant; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftBackItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftBackItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftBackItemVariant, variant, false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_leftBackItemVariant, variant, false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetRightBackItem(string name) |
| public void SetRightBackItem(string name) |
| { |
| { |
| if (this.m_rightBackItem == name) |
| if (this.m_rightBackItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_rightBackItem = name; |
| this.m_rightBackItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_rightBackItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_rightBackItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetChestItem(string name) |
| public void SetChestItem(string name) |
| { |
| { |
| if (this.m_chestItem == name) |
| if (this.m_chestItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_chestItem = name; |
| this.m_chestItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_chestItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_chestItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetLegItem(string name) |
| public void SetLegItem(string name) |
| { |
| { |
| if (this.m_legItem == name) |
| if (this.m_legItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_legItem = name; |
| this.m_legItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_legItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_legItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetHelmetItem(string name) |
| public void SetHelmetItem(string name) |
| { |
| { |
| if (this.m_helmetItem == name) |
| if (this.m_helmetItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_helmetItem = name; |
| this.m_helmetItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_helmetItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_helmetItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetShoulderItem(string name, int variant) |
| public void SetShoulderItem(string name, int variant) |
| { |
| { |
| if (this.m_shoulderItem == name && this.m_shoulderItemVariant == variant) |
| if (this.m_shoulderItem == name && this.m_shoulderItemVariant == variant) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_shoulderItem = name; |
| this.m_shoulderItem = name; |
| this.m_shoulderItemVariant = variant; |
| this.m_shoulderItemVariant = variant; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_shoulderItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_shoulderItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_shoulderItemVariant, variant, false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_shoulderItemVariant, variant, false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetBeardItem(string name) |
| public void SetBeardItem(string name) |
| { |
| { |
| if (this.m_beardItem == name) |
| if (this.m_beardItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_beardItem = name; |
| this.m_beardItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_beardItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_beardItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetHairItem(string name) |
| public void SetHairItem(string name) |
| { |
| { |
| if (this.m_hairItem == name) |
| if (this.m_hairItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_hairItem = name; |
| this.m_hairItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_hairItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_hairItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetUtilityItem(string name) |
| public void SetUtilityItem(string name) |
| { |
| { |
| if (this.m_utilityItem == name) |
| if (this.m_utilityItem == name) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_utilityItem = name; |
| this.m_utilityItem = name; |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| if (this.m_nview.GetZDO() != null && this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.GetZDO().Set(ZDOVars.s_utilityItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_utilityItem, string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode(), false); |
| } |
| } |
| } |
| } |
| |
| |
| . | public void CustomUpdate() |
| public void CustomUpdate(float deltaTime, float time) |
| { |
| { |
| this.UpdateVisuals(); |
| this.UpdateVisuals(); |
| } |
| } |
| |
| |
| private void UpdateVisuals() |
| private void UpdateVisuals() |
| { |
| { |
| this.UpdateEquipmentVisuals(); |
| this.UpdateEquipmentVisuals(); |
| if (this.m_isPlayer) |
| if (this.m_isPlayer) |
| { |
| { |
| this.UpdateBaseModel(); |
| this.UpdateBaseModel(); |
| this.UpdateColors(); |
| this.UpdateColors(); |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateColors() |
| private void UpdateColors() |
| { |
| { |
| Color color = Utils.Vec3ToColor(this.m_skinColor); |
| Color color = Utils.Vec3ToColor(this.m_skinColor); |
| Color color2 = Utils.Vec3ToColor(this.m_hairColor); |
| Color color2 = Utils.Vec3ToColor(this.m_hairColor); |
| if (this.m_nview.GetZDO() != null) |
| if (this.m_nview.GetZDO() != null) |
| { |
| { |
| color = Utils.Vec3ToColor(this.m_nview.GetZDO().GetVec3(ZDOVars.s_skinColor, Vector3.one)); |
| color = Utils.Vec3ToColor(this.m_nview.GetZDO().GetVec3(ZDOVars.s_skinColor, Vector3.one)); |
| color2 = Utils.Vec3ToColor(this.m_nview.GetZDO().GetVec3(ZDOVars.s_hairColor, Vector3.one)); |
| color2 = Utils.Vec3ToColor(this.m_nview.GetZDO().GetVec3(ZDOVars.s_hairColor, Vector3.one)); |
| } |
| } |
| this.m_bodyModel.materials[0].SetColor("_SkinColor", color); |
| this.m_bodyModel.materials[0].SetColor("_SkinColor", color); |
| this.m_bodyModel.materials[1].SetColor("_SkinColor", color2); |
| this.m_bodyModel.materials[1].SetColor("_SkinColor", color2); |
| if (this.m_beardItemInstance) |
| if (this.m_beardItemInstance) |
| { |
| { |
| Renderer[] array = this.m_beardItemInstance.GetComponentsInChildren<Renderer>(); |
| Renderer[] array = this.m_beardItemInstance.GetComponentsInChildren<Renderer>(); |
| for (int i = 0; i < array.Length; i++) |
| for (int i = 0; i < array.Length; i++) |
| { |
| { |
| array[i].material.SetColor("_SkinColor", color2); |
| array[i].material.SetColor("_SkinColor", color2); |
| } |
| } |
| } |
| } |
| if (this.m_hairItemInstance) |
| if (this.m_hairItemInstance) |
| { |
| { |
| Renderer[] array = this.m_hairItemInstance.GetComponentsInChildren<Renderer>(); |
| Renderer[] array = this.m_hairItemInstance.GetComponentsInChildren<Renderer>(); |
| for (int i = 0; i < array.Length; i++) |
| for (int i = 0; i < array.Length; i++) |
| { |
| { |
| array[i].material.SetColor("_SkinColor", color2); |
| array[i].material.SetColor("_SkinColor", color2); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateBaseModel() |
| private void UpdateBaseModel() |
| { |
| { |
| if (this.m_models.Length == 0) |
| if (this.m_models.Length == 0) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| int num = this.m_modelIndex; |
| int num = this.m_modelIndex; |
| if (this.m_nview.GetZDO() != null) |
| if (this.m_nview.GetZDO() != null) |
| { |
| { |
| num = this.m_nview.GetZDO().GetInt(ZDOVars.s_modelIndex, 0); |
| num = this.m_nview.GetZDO().GetInt(ZDOVars.s_modelIndex, 0); |
| } |
| } |
| if (this.m_currentModelIndex != num || this.m_bodyModel.sharedMesh != this.m_models[num].m_mesh) |
| if (this.m_currentModelIndex != num || this.m_bodyModel.sharedMesh != this.m_models[num].m_mesh) |
| { |
| { |
| this.m_currentModelIndex = num; |
| this.m_currentModelIndex = num; |
| this.m_bodyModel.sharedMesh = this.m_models[num].m_mesh; |
| this.m_bodyModel.sharedMesh = this.m_models[num].m_mesh; |
| this.m_bodyModel.materials[0].SetTexture("_MainTex", this.m_models[num].m_baseMaterial.GetTexture("_MainTex")); |
| this.m_bodyModel.materials[0].SetTexture("_MainTex", this.m_models[num].m_baseMaterial.GetTexture("_MainTex")); |
| this.m_bodyModel.materials[0].SetTexture("_SkinBumpMap", this.m_models[num].m_baseMaterial.GetTexture("_SkinBumpMap")); |
| this.m_bodyModel.materials[0].SetTexture("_SkinBumpMap", this.m_models[num].m_baseMaterial.GetTexture("_SkinBumpMap")); |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateEquipmentVisuals() |
| private void UpdateEquipmentVisuals() |
| { |
| { |
| int num = 0; |
| int num = 0; |
| int num2 = 0; |
| int num2 = 0; |
| int num3 = 0; |
| int num3 = 0; |
| int num4 = 0; |
| int num4 = 0; |
| int num5 = 0; |
| int num5 = 0; |
| int num6 = 0; |
| int num6 = 0; |
| int num7 = 0; |
| int num7 = 0; |
| int num8 = 0; |
| int num8 = 0; |
| int num9 = 0; |
| int num9 = 0; |
| int num10 = 0; |
| int num10 = 0; |
| int num11 = 0; |
| int num11 = 0; |
| int num12 = this.m_shoulderItemVariant; |
| int num12 = this.m_shoulderItemVariant; |
| int num13 = this.m_leftItemVariant; |
| int num13 = this.m_leftItemVariant; |
| int num14 = this.m_leftBackItemVariant; |
| int num14 = this.m_leftBackItemVariant; |
| ZDO zdo = this.m_nview.GetZDO(); |
| ZDO zdo = this.m_nview.GetZDO(); |
| if (zdo != null) |
| if (zdo != null) |
| { |
| { |
| num = zdo.GetInt(ZDOVars.s_leftItem, 0); |
| num = zdo.GetInt(ZDOVars.s_leftItem, 0); |
| num2 = zdo.GetInt(ZDOVars.s_rightItem, 0); |
| num2 = zdo.GetInt(ZDOVars.s_rightItem, 0); |
| num3 = zdo.GetInt(ZDOVars.s_chestItem, 0); |
| num3 = zdo.GetInt(ZDOVars.s_chestItem, 0); |
| num4 = zdo.GetInt(ZDOVars.s_legItem, 0); |
| num4 = zdo.GetInt(ZDOVars.s_legItem, 0); |
| num5 = zdo.GetInt(ZDOVars.s_helmetItem, 0); |
| num5 = zdo.GetInt(ZDOVars.s_helmetItem, 0); |
| num8 = zdo.GetInt(ZDOVars.s_shoulderItem, 0); |
| num8 = zdo.GetInt(ZDOVars.s_shoulderItem, 0); |
| num9 = zdo.GetInt(ZDOVars.s_utilityItem, 0); |
| num9 = zdo.GetInt(ZDOVars.s_utilityItem, 0); |
| if (this.m_isPlayer) |
| if (this.m_isPlayer) |
| { |
| { |
| num6 = zdo.GetInt(ZDOVars.s_beardItem, 0); |
| num6 = zdo.GetInt(ZDOVars.s_beardItem, 0); |
| num7 = zdo.GetInt(ZDOVars.s_hairItem, 0); |
| num7 = zdo.GetInt(ZDOVars.s_hairItem, 0); |
| num10 = zdo.GetInt(ZDOVars.s_leftBackItem, 0); |
| num10 = zdo.GetInt(ZDOVars.s_leftBackItem, 0); |
| num11 = zdo.GetInt(ZDOVars.s_rightBackItem, 0); |
| num11 = zdo.GetInt(ZDOVars.s_rightBackItem, 0); |
| num12 = zdo.GetInt(ZDOVars.s_shoulderItemVariant, 0); |
| num12 = zdo.GetInt(ZDOVars.s_shoulderItemVariant, 0); |
| num13 = zdo.GetInt(ZDOVars.s_leftItemVariant, 0); |
| num13 = zdo.GetInt(ZDOVars.s_leftItemVariant, 0); |
| num14 = zdo.GetInt(ZDOVars.s_leftBackItemVariant, 0); |
| num14 = zdo.GetInt(ZDOVars.s_leftBackItemVariant, 0); |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| if (!string.IsNullOrEmpty(this.m_leftItem)) |
| if (!string.IsNullOrEmpty(this.m_leftItem)) |
| { |
| { |
| num = this.m_leftItem.GetStableHashCode(); |
| num = this.m_leftItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_rightItem)) |
| if (!string.IsNullOrEmpty(this.m_rightItem)) |
| { |
| { |
| num2 = this.m_rightItem.GetStableHashCode(); |
| num2 = this.m_rightItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_chestItem)) |
| if (!string.IsNullOrEmpty(this.m_chestItem)) |
| { |
| { |
| num3 = this.m_chestItem.GetStableHashCode(); |
| num3 = this.m_chestItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_legItem)) |
| if (!string.IsNullOrEmpty(this.m_legItem)) |
| { |
| { |
| num4 = this.m_legItem.GetStableHashCode(); |
| num4 = this.m_legItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_helmetItem)) |
| if (!string.IsNullOrEmpty(this.m_helmetItem)) |
| { |
| { |
| num5 = this.m_helmetItem.GetStableHashCode(); |
| num5 = this.m_helmetItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_shoulderItem)) |
| if (!string.IsNullOrEmpty(this.m_shoulderItem)) |
| { |
| { |
| num8 = this.m_shoulderItem.GetStableHashCode(); |
| num8 = this.m_shoulderItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_utilityItem)) |
| if (!string.IsNullOrEmpty(this.m_utilityItem)) |
| { |
| { |
| num9 = this.m_utilityItem.GetStableHashCode(); |
| num9 = this.m_utilityItem.GetStableHashCode(); |
| } |
| } |
| if (this.m_isPlayer) |
| if (this.m_isPlayer) |
| { |
| { |
| if (!string.IsNullOrEmpty(this.m_beardItem)) |
| if (!string.IsNullOrEmpty(this.m_beardItem)) |
| { |
| { |
| num6 = this.m_beardItem.GetStableHashCode(); |
| num6 = this.m_beardItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_hairItem)) |
| if (!string.IsNullOrEmpty(this.m_hairItem)) |
| { |
| { |
| num7 = this.m_hairItem.GetStableHashCode(); |
| num7 = this.m_hairItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_leftBackItem)) |
| if (!string.IsNullOrEmpty(this.m_leftBackItem)) |
| { |
| { |
| num10 = this.m_leftBackItem.GetStableHashCode(); |
| num10 = this.m_leftBackItem.GetStableHashCode(); |
| } |
| } |
| if (!string.IsNullOrEmpty(this.m_rightBackItem)) |
| if (!string.IsNullOrEmpty(this.m_rightBackItem)) |
| { |
| { |
| num11 = this.m_rightBackItem.GetStableHashCode(); |
| num11 = this.m_rightBackItem.GetStableHashCode(); |
| } |
| } |
| } |
| } |
| } |
| } |
| bool flag = false; |
| bool flag = false; |
| flag = this.SetRightHandEquipped(num2) || flag; |
| flag = this.SetRightHandEquipped(num2) || flag; |
| flag = this.SetLeftHandEquipped(num, num13) || flag; |
| flag = this.SetLeftHandEquipped(num, num13) || flag; |
| flag = this.SetChestEquipped(num3) || flag; |
| flag = this.SetChestEquipped(num3) || flag; |
| flag = this.SetLegEquipped(num4) || flag; |
| flag = this.SetLegEquipped(num4) || flag; |
| flag = this.SetHelmetEquipped(num5, num7) || flag; |
| flag = this.SetHelmetEquipped(num5, num7) || flag; |
| flag = this.SetShoulderEquipped(num8, num12) || flag; |
| flag = this.SetShoulderEquipped(num8, num12) || flag; |
| flag = this.SetUtilityEquipped(num9) || flag; |
| flag = this.SetUtilityEquipped(num9) || flag; |
| if (this.m_isPlayer) |
| if (this.m_isPlayer) |
| { |
| { |
| num6 = this.GetHairItem(this.m_helmetHideBeard, num6, ItemDrop.ItemData.AccessoryType.Beard); |
| num6 = this.GetHairItem(this.m_helmetHideBeard, num6, ItemDrop.ItemData.AccessoryType.Beard); |
| flag = this.SetBeardEquipped(num6) || flag; |
| flag = this.SetBeardEquipped(num6) || flag; |
| flag = this.SetBackEquipped(num10, num11, num14) || flag; |
| flag = this.SetBackEquipped(num10, num11, num14) || flag; |
| num7 = this.GetHairItem(this.m_helmetHideHair, num7, ItemDrop.ItemData.AccessoryType.Hair); |
| num7 = this.GetHairItem(this.m_helmetHideHair, num7, ItemDrop.ItemData.AccessoryType.Hair); |
| flag = this.SetHairEquipped(num7) || flag; |
| flag = this.SetHairEquipped(num7) || flag; |
| } |
| } |
| if (flag) |
| if (flag) |
| { |
| { |
| this.UpdateLodgroup(); |
| this.UpdateLodgroup(); |
| } |
| } |
| } |
| } |
| |
| |
| private int GetHairItem(ItemDrop.ItemData.HelmetHairType type, int itemHash, ItemDrop.ItemData.AccessoryType accessory) |
| private int GetHairItem(ItemDrop.ItemData.HelmetHairType type, int itemHash, ItemDrop.ItemData.AccessoryType accessory) |
| { |
| { |
| if (type == ItemDrop.ItemData.HelmetHairType.Hidden) |
| if (type == ItemDrop.ItemData.HelmetHairType.Hidden) |
| { |
| { |
| return 0; |
| return 0; |
| } |
| } |
| if (type == ItemDrop.ItemData.HelmetHairType.Default) |
| if (type == ItemDrop.ItemData.HelmetHairType.Default) |
| { |
| { |
| return itemHash; |
| return itemHash; |
| } |
| } |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| if (itemPrefab) |
| if (itemPrefab) |
| { |
| { |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| if (component != null) |
| if (component != null) |
| { |
| { |
| List<ItemDrop.ItemData.HelmetHairSettings> list; |
| List<ItemDrop.ItemData.HelmetHairSettings> list; |
| if (accessory != ItemDrop.ItemData.AccessoryType.Hair) |
| if (accessory != ItemDrop.ItemData.AccessoryType.Hair) |
| { |
| { |
| if (accessory != ItemDrop.ItemData.AccessoryType.Beard) |
| if (accessory != ItemDrop.ItemData.AccessoryType.Beard) |
| { |
| { |
| throw new Exception("Acecssory type not implemented"); |
| throw new Exception("Acecssory type not implemented"); |
| } |
| } |
| list = component.m_itemData.m_shared.m_helmetBeardSettings; |
| list = component.m_itemData.m_shared.m_helmetBeardSettings; |
| } |
| } |
| else |
| else |
| { |
| { |
| list = component.m_itemData.m_shared.m_helmetHairSettings; |
| list = component.m_itemData.m_shared.m_helmetHairSettings; |
| } |
| } |
| ItemDrop.ItemData.HelmetHairSettings helmetHairSettings = list.FirstOrDefault((ItemDrop.ItemData.HelmetHairSettings x) => x.m_setting == type); |
| ItemDrop.ItemData.HelmetHairSettings helmetHairSettings = list.FirstOrDefault((ItemDrop.ItemData.HelmetHairSettings x) => x.m_setting == type); |
| if (helmetHairSettings != null) |
| if (helmetHairSettings != null) |
| { |
| { |
| return helmetHairSettings.m_hairPrefab.name.GetStableHashCode(); |
| return helmetHairSettings.m_hairPrefab.name.GetStableHashCode(); |
| } |
| } |
| } |
| } |
| } |
| } |
| return 0; |
| return 0; |
| } |
| } |
| |
| |
| private void UpdateLodgroup() |
| private void UpdateLodgroup() |
| { |
| { |
| if (this.m_lodGroup == null) |
| if (this.m_lodGroup == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| List<Renderer> list = new List<Renderer>(this.m_visual.GetComponentsInChildren<Renderer>()); |
| List<Renderer> list = new List<Renderer>(this.m_visual.GetComponentsInChildren<Renderer>()); |
| for (int i = list.Count - 1; i >= 0; i--) |
| for (int i = list.Count - 1; i >= 0; i--) |
| { |
| { |
| Renderer renderer = list[i]; |
| Renderer renderer = list[i]; |
| LODGroup componentInParent = renderer.GetComponentInParent<LODGroup>(); |
| LODGroup componentInParent = renderer.GetComponentInParent<LODGroup>(); |
| if (componentInParent != null && componentInParent != this.m_lodGroup) |
| if (componentInParent != null && componentInParent != this.m_lodGroup) |
| { |
| { |
| LOD[] lods = componentInParent.GetLODs(); |
| LOD[] lods = componentInParent.GetLODs(); |
| for (int j = 0; j < lods.Length; j++) |
| for (int j = 0; j < lods.Length; j++) |
| { |
| { |
| if (Array.IndexOf<Renderer>(lods[j].renderers, renderer) >= 0) |
| if (Array.IndexOf<Renderer>(lods[j].renderers, renderer) >= 0) |
| { |
| { |
| list.RemoveAt(i); |
| list.RemoveAt(i); |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| LOD[] lods2 = this.m_lodGroup.GetLODs(); |
| LOD[] lods2 = this.m_lodGroup.GetLODs(); |
| lods2[0].renderers = list.ToArray(); |
| lods2[0].renderers = list.ToArray(); |
| this.m_lodGroup.SetLODs(lods2); |
| this.m_lodGroup.SetLODs(lods2); |
| } |
| } |
| |
| |
| private bool SetRightHandEquipped(int hash) |
| private bool SetRightHandEquipped(int hash) |
| { |
| { |
| if (this.m_currentRightItemHash == hash) |
| if (this.m_currentRightItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_rightItemInstance) |
| if (this.m_rightItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_rightItemInstance); |
| UnityEngine.Object.Destroy(this.m_rightItemInstance); |
| this.m_rightItemInstance = null; |
| this.m_rightItemInstance = null; |
| } |
| } |
| this.m_currentRightItemHash = hash; |
| this.m_currentRightItemHash = hash; |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_rightItemInstance = this.AttachItem(hash, 0, this.m_rightHand, true, false); |
| this.m_rightItemInstance = this.AttachItem(hash, 0, this.m_rightHand, true, false); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetLeftHandEquipped(int hash, int variant) |
| private bool SetLeftHandEquipped(int hash, int variant) |
| { |
| { |
| if (this.m_currentLeftItemHash == hash && this.m_currentLeftItemVariant == variant) |
| if (this.m_currentLeftItemHash == hash && this.m_currentLeftItemVariant == variant) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_leftItemInstance) |
| if (this.m_leftItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_leftItemInstance); |
| UnityEngine.Object.Destroy(this.m_leftItemInstance); |
| this.m_leftItemInstance = null; |
| this.m_leftItemInstance = null; |
| } |
| } |
| this.m_currentLeftItemHash = hash; |
| this.m_currentLeftItemHash = hash; |
| this.m_currentLeftItemVariant = variant; |
| this.m_currentLeftItemVariant = variant; |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_leftItemInstance = this.AttachItem(hash, variant, this.m_leftHand, true, false); |
| this.m_leftItemInstance = this.AttachItem(hash, variant, this.m_leftHand, true, false); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetBackEquipped(int leftItem, int rightItem, int leftVariant) |
| private bool SetBackEquipped(int leftItem, int rightItem, int leftVariant) |
| { |
| { |
| if (this.m_currentLeftBackItemHash == leftItem && this.m_currentRightBackItemHash == rightItem && this.m_currentLeftBackItemVariant == leftVariant) |
| if (this.m_currentLeftBackItemHash == leftItem && this.m_currentRightBackItemHash == rightItem && this.m_currentLeftBackItemVariant == leftVariant) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_leftBackItemInstance) |
| if (this.m_leftBackItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_leftBackItemInstance); |
| UnityEngine.Object.Destroy(this.m_leftBackItemInstance); |
| this.m_leftBackItemInstance = null; |
| this.m_leftBackItemInstance = null; |
| } |
| } |
| if (this.m_rightBackItemInstance) |
| if (this.m_rightBackItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_rightBackItemInstance); |
| UnityEngine.Object.Destroy(this.m_rightBackItemInstance); |
| this.m_rightBackItemInstance = null; |
| this.m_rightBackItemInstance = null; |
| } |
| } |
| this.m_currentLeftBackItemHash = leftItem; |
| this.m_currentLeftBackItemHash = leftItem; |
| this.m_currentRightBackItemHash = rightItem; |
| this.m_currentRightBackItemHash = rightItem; |
| this.m_currentLeftBackItemVariant = leftVariant; |
| this.m_currentLeftBackItemVariant = leftVariant; |
| if (this.m_currentLeftBackItemHash != 0) |
| if (this.m_currentLeftBackItemHash != 0) |
| { |
| { |
| this.m_leftBackItemInstance = this.AttachBackItem(leftItem, leftVariant, false); |
| this.m_leftBackItemInstance = this.AttachBackItem(leftItem, leftVariant, false); |
| } |
| } |
| if (this.m_currentRightBackItemHash != 0) |
| if (this.m_currentRightBackItemHash != 0) |
| { |
| { |
| this.m_rightBackItemInstance = this.AttachBackItem(rightItem, 0, true); |
| this.m_rightBackItemInstance = this.AttachBackItem(rightItem, 0, true); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private GameObject AttachBackItem(int hash, int variant, bool rightHand) |
| private GameObject AttachBackItem(int hash, int variant, bool rightHand) |
| { |
| { |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.Log("Missing back attach item prefab: " + hash.ToString()); |
| ZLog.Log("Missing back attach item prefab: " + hash.ToString()); |
| return null; |
| return null; |
| } |
| } |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop.ItemData.ItemType itemType = ((component.m_itemData.m_shared.m_attachOverride != ItemDrop.ItemData.ItemType.None) ? component.m_itemData.m_shared.m_attachOverride : component.m_itemData.m_shared.m_itemType); |
| ItemDrop.ItemData.ItemType itemType = ((component.m_itemData.m_shared.m_attachOverride != ItemDrop.ItemData.ItemType.None) ? component.m_itemData.m_shared.m_attachOverride : component.m_itemData.m_shared.m_itemType); |
| if (itemType == ItemDrop.ItemData.ItemType.Torch) |
| if (itemType == ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| if (rightHand) |
| if (rightHand) |
| { |
| { |
| return this.AttachItem(hash, variant, this.m_backMelee, false, true); |
| return this.AttachItem(hash, variant, this.m_backMelee, false, true); |
| } |
| } |
| return this.AttachItem(hash, variant, this.m_backTool, false, true); |
| return this.AttachItem(hash, variant, this.m_backTool, false, true); |
| } |
| } |
| else |
| else |
| { |
| { |
| switch (itemType) |
| switch (itemType) |
| { |
| { |
| case ItemDrop.ItemData.ItemType.OneHandedWeapon: |
| case ItemDrop.ItemData.ItemType.OneHandedWeapon: |
| return this.AttachItem(hash, variant, this.m_backMelee, false, true); |
| return this.AttachItem(hash, variant, this.m_backMelee, false, true); |
| case ItemDrop.ItemData.ItemType.Bow: |
| case ItemDrop.ItemData.ItemType.Bow: |
| return this.AttachItem(hash, variant, this.m_backBow, false, true); |
| return this.AttachItem(hash, variant, this.m_backBow, false, true); |
| case ItemDrop.ItemData.ItemType.Shield: |
| case ItemDrop.ItemData.ItemType.Shield: |
| return this.AttachItem(hash, variant, this.m_backShield, false, true); |
| return this.AttachItem(hash, variant, this.m_backShield, false, true); |
| default: |
| default: |
| if (itemType != ItemDrop.ItemData.ItemType.TwoHandedWeapon) |
| if (itemType != ItemDrop.ItemData.ItemType.TwoHandedWeapon) |
| { |
| { |
| switch (itemType) |
| switch (itemType) |
| { |
| { |
| case ItemDrop.ItemData.ItemType.Tool: |
| case ItemDrop.ItemData.ItemType.Tool: |
| return this.AttachItem(hash, variant, this.m_backTool, false, true); |
| return this.AttachItem(hash, variant, this.m_backTool, false, true); |
| case ItemDrop.ItemData.ItemType.Attach_Atgeir: |
| case ItemDrop.ItemData.ItemType.Attach_Atgeir: |
| return this.AttachItem(hash, variant, this.m_backAtgeir, false, true); |
| return this.AttachItem(hash, variant, this.m_backAtgeir, false, true); |
| case ItemDrop.ItemData.ItemType.TwoHandedWeaponLeft: |
| case ItemDrop.ItemData.ItemType.TwoHandedWeaponLeft: |
| goto IL_10B; |
| goto IL_10B; |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| IL_10B: |
| IL_10B: |
| return this.AttachItem(hash, variant, this.m_backTwohandedMelee, false, true); |
| return this.AttachItem(hash, variant, this.m_backTwohandedMelee, false, true); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private bool SetChestEquipped(int hash) |
| private bool SetChestEquipped(int hash) |
| { |
| { |
| if (this.m_currentChestItemHash == hash) |
| if (this.m_currentChestItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_currentChestItemHash = hash; |
| this.m_currentChestItemHash = hash; |
| if (this.m_bodyModel == null) |
| if (this.m_bodyModel == null) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (this.m_chestItemInstances != null) |
| if (this.m_chestItemInstances != null) |
| { |
| { |
| foreach (GameObject gameObject in this.m_chestItemInstances) |
| foreach (GameObject gameObject in this.m_chestItemInstances) |
| { |
| { |
| if (this.m_lodGroup) |
| if (this.m_lodGroup) |
| { |
| { |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| } |
| } |
| UnityEngine.Object.Destroy(gameObject); |
| UnityEngine.Object.Destroy(gameObject); |
| } |
| } |
| this.m_chestItemInstances = null; |
| this.m_chestItemInstances = null; |
| this.m_bodyModel.material.SetTexture("_ChestTex", this.m_emptyBodyTexture); |
| this.m_bodyModel.material.SetTexture("_ChestTex", this.m_emptyBodyTexture); |
| this.m_bodyModel.material.SetTexture("_ChestBumpMap", null); |
| this.m_bodyModel.material.SetTexture("_ChestBumpMap", null); |
| this.m_bodyModel.material.SetTexture("_ChestMetal", null); |
| this.m_bodyModel.material.SetTexture("_ChestMetal", null); |
| } |
| } |
| if (this.m_currentChestItemHash == 0) |
| if (this.m_currentChestItemHash == 0) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.Log("Missing chest item " + hash.ToString()); |
| ZLog.Log("Missing chest item " + hash.ToString()); |
| return true; |
| return true; |
| } |
| } |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| if (component.m_itemData.m_shared.m_armorMaterial) |
| if (component.m_itemData.m_shared.m_armorMaterial) |
| { |
| { |
| this.m_bodyModel.material.SetTexture("_ChestTex", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestTex")); |
| this.m_bodyModel.material.SetTexture("_ChestTex", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestTex")); |
| this.m_bodyModel.material.SetTexture("_ChestBumpMap", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestBumpMap")); |
| this.m_bodyModel.material.SetTexture("_ChestBumpMap", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestBumpMap")); |
| this.m_bodyModel.material.SetTexture("_ChestMetal", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestMetal")); |
| this.m_bodyModel.material.SetTexture("_ChestMetal", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_ChestMetal")); |
| } |
| } |
| this.m_chestItemInstances = this.AttachArmor(hash, -1); |
| this.m_chestItemInstances = this.AttachArmor(hash, -1); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetShoulderEquipped(int hash, int variant) |
| private bool SetShoulderEquipped(int hash, int variant) |
| { |
| { |
| if (this.m_currentShoulderItemHash == hash && this.m_currentShoulderItemVariant == variant) |
| if (this.m_currentShoulderItemHash == hash && this.m_currentShoulderItemVariant == variant) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_currentShoulderItemHash = hash; |
| this.m_currentShoulderItemHash = hash; |
| this.m_currentShoulderItemVariant = variant; |
| this.m_currentShoulderItemVariant = variant; |
| if (this.m_bodyModel == null) |
| if (this.m_bodyModel == null) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (this.m_shoulderItemInstances != null) |
| if (this.m_shoulderItemInstances != null) |
| { |
| { |
| foreach (GameObject gameObject in this.m_shoulderItemInstances) |
| foreach (GameObject gameObject in this.m_shoulderItemInstances) |
| { |
| { |
| if (this.m_lodGroup) |
| if (this.m_lodGroup) |
| { |
| { |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| } |
| } |
| UnityEngine.Object.Destroy(gameObject); |
| UnityEngine.Object.Destroy(gameObject); |
| } |
| } |
| this.m_shoulderItemInstances = null; |
| this.m_shoulderItemInstances = null; |
| } |
| } |
| if (this.m_currentShoulderItemHash == 0) |
| if (this.m_currentShoulderItemHash == 0) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (ObjectDB.instance.GetItemPrefab(hash) == null) |
| if (ObjectDB.instance.GetItemPrefab(hash) == null) |
| { |
| { |
| ZLog.Log("Missing shoulder item " + hash.ToString()); |
| ZLog.Log("Missing shoulder item " + hash.ToString()); |
| return true; |
| return true; |
| } |
| } |
| this.m_shoulderItemInstances = this.AttachArmor(hash, variant); |
| this.m_shoulderItemInstances = this.AttachArmor(hash, variant); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetLegEquipped(int hash) |
| private bool SetLegEquipped(int hash) |
| { |
| { |
| if (this.m_currentLegItemHash == hash) |
| if (this.m_currentLegItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| this.m_currentLegItemHash = hash; |
| this.m_currentLegItemHash = hash; |
| if (this.m_bodyModel == null) |
| if (this.m_bodyModel == null) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (this.m_legItemInstances != null) |
| if (this.m_legItemInstances != null) |
| { |
| { |
| foreach (GameObject gameObject in this.m_legItemInstances) |
| foreach (GameObject gameObject in this.m_legItemInstances) |
| { |
| { |
| UnityEngine.Object.Destroy(gameObject); |
| UnityEngine.Object.Destroy(gameObject); |
| } |
| } |
| this.m_legItemInstances = null; |
| this.m_legItemInstances = null; |
| this.m_bodyModel.material.SetTexture("_LegsTex", this.m_emptyLegsTexture); |
| this.m_bodyModel.material.SetTexture("_LegsTex", this.m_emptyLegsTexture); |
| this.m_bodyModel.material.SetTexture("_LegsBumpMap", null); |
| this.m_bodyModel.material.SetTexture("_LegsBumpMap", null); |
| this.m_bodyModel.material.SetTexture("_LegsMetal", null); |
| this.m_bodyModel.material.SetTexture("_LegsMetal", null); |
| } |
| } |
| if (this.m_currentLegItemHash == 0) |
| if (this.m_currentLegItemHash == 0) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.Log("Missing legs item " + hash.ToString()); |
| ZLog.Log("Missing legs item " + hash.ToString()); |
| return true; |
| return true; |
| } |
| } |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| if (component.m_itemData.m_shared.m_armorMaterial) |
| if (component.m_itemData.m_shared.m_armorMaterial) |
| { |
| { |
| this.m_bodyModel.material.SetTexture("_LegsTex", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsTex")); |
| this.m_bodyModel.material.SetTexture("_LegsTex", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsTex")); |
| this.m_bodyModel.material.SetTexture("_LegsBumpMap", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsBumpMap")); |
| this.m_bodyModel.material.SetTexture("_LegsBumpMap", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsBumpMap")); |
| this.m_bodyModel.material.SetTexture("_LegsMetal", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsMetal")); |
| this.m_bodyModel.material.SetTexture("_LegsMetal", component.m_itemData.m_shared.m_armorMaterial.GetTexture("_LegsMetal")); |
| } |
| } |
| this.m_legItemInstances = this.AttachArmor(hash, -1); |
| this.m_legItemInstances = this.AttachArmor(hash, -1); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetBeardEquipped(int hash) |
| private bool SetBeardEquipped(int hash) |
| { |
| { |
| if (this.m_currentBeardItemHash == hash) |
| if (this.m_currentBeardItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_beardItemInstance) |
| if (this.m_beardItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_beardItemInstance); |
| UnityEngine.Object.Destroy(this.m_beardItemInstance); |
| this.m_beardItemInstance = null; |
| this.m_beardItemInstance = null; |
| } |
| } |
| this.m_currentBeardItemHash = hash; |
| this.m_currentBeardItemHash = hash; |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_beardItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| this.m_beardItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetHairEquipped(int hash) |
| private bool SetHairEquipped(int hash) |
| { |
| { |
| if (this.m_currentHairItemHash == hash) |
| if (this.m_currentHairItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_hairItemInstance) |
| if (this.m_hairItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_hairItemInstance); |
| UnityEngine.Object.Destroy(this.m_hairItemInstance); |
| this.m_hairItemInstance = null; |
| this.m_hairItemInstance = null; |
| } |
| } |
| this.m_currentHairItemHash = hash; |
| this.m_currentHairItemHash = hash; |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_hairItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| this.m_hairItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetHelmetEquipped(int hash, int hairHash) |
| private bool SetHelmetEquipped(int hash, int hairHash) |
| { |
| { |
| if (this.m_currentHelmetItemHash == hash) |
| if (this.m_currentHelmetItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_helmetItemInstance) |
| if (this.m_helmetItemInstance) |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_helmetItemInstance); |
| UnityEngine.Object.Destroy(this.m_helmetItemInstance); |
| this.m_helmetItemInstance = null; |
| this.m_helmetItemInstance = null; |
| } |
| } |
| this.m_currentHelmetItemHash = hash; |
| this.m_currentHelmetItemHash = hash; |
| VisEquipment.HelmetHides(hash, out this.m_helmetHideHair, out this.m_helmetHideBeard); |
| VisEquipment.HelmetHides(hash, out this.m_helmetHideHair, out this.m_helmetHideBeard); |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_helmetItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| this.m_helmetItemInstance = this.AttachItem(hash, 0, this.m_helmet, true, false); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private bool SetUtilityEquipped(int hash) |
| private bool SetUtilityEquipped(int hash) |
| { |
| { |
| if (this.m_currentUtilityItemHash == hash) |
| if (this.m_currentUtilityItemHash == hash) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_utilityItemInstances != null) |
| if (this.m_utilityItemInstances != null) |
| { |
| { |
| foreach (GameObject gameObject in this.m_utilityItemInstances) |
| foreach (GameObject gameObject in this.m_utilityItemInstances) |
| { |
| { |
| if (this.m_lodGroup) |
| if (this.m_lodGroup) |
| { |
| { |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| Utils.RemoveFromLodgroup(this.m_lodGroup, gameObject); |
| } |
| } |
| UnityEngine.Object.Destroy(gameObject); |
| UnityEngine.Object.Destroy(gameObject); |
| } |
| } |
| this.m_utilityItemInstances = null; |
| this.m_utilityItemInstances = null; |
| } |
| } |
| this.m_currentUtilityItemHash = hash; |
| this.m_currentUtilityItemHash = hash; |
| if (hash != 0) |
| if (hash != 0) |
| { |
| { |
| this.m_utilityItemInstances = this.AttachArmor(hash, -1); |
| this.m_utilityItemInstances = this.AttachArmor(hash, -1); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private static void HelmetHides(int itemHash, out ItemDrop.ItemData.HelmetHairType hideHair, out ItemDrop.ItemData.HelmetHairType hideBeard) |
| private static void HelmetHides(int itemHash, out ItemDrop.ItemData.HelmetHairType hideHair, out ItemDrop.ItemData.HelmetHairType hideBeard) |
| { |
| { |
| hideHair = ItemDrop.ItemData.HelmetHairType.Default; |
| hideHair = ItemDrop.ItemData.HelmetHairType.Default; |
| hideBeard = ItemDrop.ItemData.HelmetHairType.Default; |
| hideBeard = ItemDrop.ItemData.HelmetHairType.Default; |
| if (itemHash == 0) |
| if (itemHash == 0) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| hideHair = component.m_itemData.m_shared.m_helmetHideHair; |
| hideHair = component.m_itemData.m_shared.m_helmetHideHair; |
| hideBeard = component.m_itemData.m_shared.m_helmetHideBeard; |
| hideBeard = component.m_itemData.m_shared.m_helmetHideBeard; |
| } |
| } |
| |
| |
| private List<GameObject> AttachArmor(int itemHash, int variant = -1) |
| private List<GameObject> AttachArmor(int itemHash, int variant = -1) |
| { |
| { |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.Log("Missing attach item: " + itemHash.ToString() + " ob:" + base.gameObject.name); |
| ZLog.Log("Missing attach item: " + itemHash.ToString() + " ob:" + base.gameObject.name); |
| return null; |
| return null; |
| } |
| } |
| List<GameObject> list = new List<GameObject>(); |
| List<GameObject> list = new List<GameObject>(); |
| int childCount = itemPrefab.transform.childCount; |
| int childCount = itemPrefab.transform.childCount; |
| for (int i = 0; i < childCount; i++) |
| for (int i = 0; i < childCount; i++) |
| { |
| { |
| Transform child = itemPrefab.transform.GetChild(i); |
| Transform child = itemPrefab.transform.GetChild(i); |
| if (child.gameObject.name.CustomStartsWith("attach_")) |
| if (child.gameObject.name.CustomStartsWith("attach_")) |
| { |
| { |
| string text = child.gameObject.name.Substring(7); |
| string text = child.gameObject.name.Substring(7); |
| GameObject gameObject; |
| GameObject gameObject; |
| if (text == "skin") |
| if (text == "skin") |
| { |
| { |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(child.gameObject, this.m_bodyModel.transform.position, this.m_bodyModel.transform.parent.rotation, this.m_bodyModel.transform.parent); |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(child.gameObject, this.m_bodyModel.transform.position, this.m_bodyModel.transform.parent.rotation, this.m_bodyModel.transform.parent); |
| gameObject.SetActive(true); |
| gameObject.SetActive(true); |
| foreach (SkinnedMeshRenderer skinnedMeshRenderer in gameObject.GetComponentsInChildren<SkinnedMeshRenderer>()) |
| foreach (SkinnedMeshRenderer skinnedMeshRenderer in gameObject.GetComponentsInChildren<SkinnedMeshRenderer>()) |
| { |
| { |
| skinnedMeshRenderer.rootBone = this.m_bodyModel.rootBone; |
| skinnedMeshRenderer.rootBone = this.m_bodyModel.rootBone; |
| skinnedMeshRenderer.bones = this.m_bodyModel.bones; |
| skinnedMeshRenderer.bones = this.m_bodyModel.bones; |
| } |
| } |
| foreach (Cloth cloth in gameObject.GetComponentsInChildren<Cloth>()) |
| foreach (Cloth cloth in gameObject.GetComponentsInChildren<Cloth>()) |
| { |
| { |
| if (this.m_clothColliders.Length != 0) |
| if (this.m_clothColliders.Length != 0) |
| { |
| { |
| if (cloth.capsuleColliders.Length != 0) |
| if (cloth.capsuleColliders.Length != 0) |
| { |
| { |
| List<CapsuleCollider> list2 = new List<CapsuleCollider>(this.m_clothColliders); |
| List<CapsuleCollider> list2 = new List<CapsuleCollider>(this.m_clothColliders); |
| list2.AddRange(cloth.capsuleColliders); |
| list2.AddRange(cloth.capsuleColliders); |
| cloth.capsuleColliders = list2.ToArray(); |
| cloth.capsuleColliders = list2.ToArray(); |
| } |
| } |
| else |
| else |
| { |
| { |
| cloth.capsuleColliders = this.m_clothColliders; |
| cloth.capsuleColliders = this.m_clothColliders; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| Transform transform = Utils.FindChild(this.m_visual.transform, text, Utils.IterativeSearchType.DepthFirst); |
| Transform transform = Utils.FindChild(this.m_visual.transform, text, Utils.IterativeSearchType.DepthFirst); |
| if (transform == null) |
| if (transform == null) |
| { |
| { |
| ZLog.LogWarning("Missing joint " + text + " in item " + itemPrefab.name); |
| ZLog.LogWarning("Missing joint " + text + " in item " + itemPrefab.name); |
| goto IL_256; |
| goto IL_256; |
| } |
| } |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(child.gameObject); |
| gameObject = UnityEngine.Object.Instantiate<GameObject>(child.gameObject); |
| gameObject.SetActive(true); |
| gameObject.SetActive(true); |
| gameObject.transform.SetParent(transform); |
| gameObject.transform.SetParent(transform); |
| gameObject.transform.localPosition = Vector3.zero; |
| gameObject.transform.localPosition = Vector3.zero; |
| gameObject.transform.localRotation = Quaternion.identity; |
| gameObject.transform.localRotation = Quaternion.identity; |
| } |
| } |
| if (variant >= 0) |
| if (variant >= 0) |
| { |
| { |
| IEquipmentVisual componentInChildren = gameObject.GetComponentInChildren<IEquipmentVisual>(); |
| IEquipmentVisual componentInChildren = gameObject.GetComponentInChildren<IEquipmentVisual>(); |
| if (componentInChildren != null) |
| if (componentInChildren != null) |
| { |
| { |
| componentInChildren.Setup(variant); |
| componentInChildren.Setup(variant); |
| } |
| } |
| } |
| } |
| VisEquipment.CleanupInstance(gameObject); |
| VisEquipment.CleanupInstance(gameObject); |
| VisEquipment.EnableEquippedEffects(gameObject); |
| VisEquipment.EnableEquippedEffects(gameObject); |
| list.Add(gameObject); |
| list.Add(gameObject); |
| } |
| } |
| IL_256:; |
| IL_256:; |
| } |
| } |
| return list; |
| return list; |
| } |
| } |
| |
| |
| private GameObject AttachItem(int itemHash, int variant, Transform joint, bool enableEquipEffects = true, bool backAttach = false) |
| private GameObject AttachItem(int itemHash, int variant, Transform joint, bool enableEquipEffects = true, bool backAttach = false) |
| { |
| { |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.Log(string.Concat(new string[] |
| ZLog.Log(string.Concat(new string[] |
| { |
| { |
| "Missing attach item: ", |
| "Missing attach item: ", |
| itemHash.ToString(), |
| itemHash.ToString(), |
| " ob:", |
| " ob:", |
| base.gameObject.name, |
| base.gameObject.name, |
| " joint:", |
| " joint:", |
| joint ? joint.name : "none" |
| joint ? joint.name : "none" |
| })); |
| })); |
| return null; |
| return null; |
| } |
| } |
| GameObject gameObject = null; |
| GameObject gameObject = null; |
| int childCount = itemPrefab.transform.childCount; |
| int childCount = itemPrefab.transform.childCount; |
| for (int i = 0; i < childCount; i++) |
| for (int i = 0; i < childCount; i++) |
| { |
| { |
| Transform child = itemPrefab.transform.GetChild(i); |
| Transform child = itemPrefab.transform.GetChild(i); |
| if (backAttach && child.gameObject.name == "attach_back") |
| if (backAttach && child.gameObject.name == "attach_back") |
| { |
| { |
| gameObject = child.gameObject; |
| gameObject = child.gameObject; |
| break; |
| break; |
| } |
| } |
| if (child.gameObject.name == "attach" || (!backAttach && child.gameObject.name == "attach_skin")) |
| if (child.gameObject.name == "attach" || (!backAttach && child.gameObject.name == "attach_skin")) |
| { |
| { |
| gameObject = child.gameObject; |
| gameObject = child.gameObject; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| if (gameObject == null) |
| if (gameObject == null) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject); |
| GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject); |
| gameObject2.SetActive(true); |
| gameObject2.SetActive(true); |
| VisEquipment.CleanupInstance(gameObject2); |
| VisEquipment.CleanupInstance(gameObject2); |
| if (enableEquipEffects) |
| if (enableEquipEffects) |
| { |
| { |
| VisEquipment.EnableEquippedEffects(gameObject2); |
| VisEquipment.EnableEquippedEffects(gameObject2); |
| } |
| } |
| if (gameObject.name == "attach_skin") |
| if (gameObject.name == "attach_skin") |
| { |
| { |
| gameObject2.transform.SetParent(this.m_bodyModel.transform.parent); |
| gameObject2.transform.SetParent(this.m_bodyModel.transform.parent); |
| gameObject2.transform.localPosition = Vector3.zero; |
| gameObject2.transform.localPosition = Vector3.zero; |
| gameObject2.transform.localRotation = Quaternion.identity; |
| gameObject2.transform.localRotation = Quaternion.identity; |
| foreach (SkinnedMeshRenderer skinnedMeshRenderer in gameObject2.GetComponentsInChildren<SkinnedMeshRenderer>()) |
| foreach (SkinnedMeshRenderer skinnedMeshRenderer in gameObject2.GetComponentsInChildren<SkinnedMeshRenderer>()) |
| { |
| { |
| skinnedMeshRenderer.rootBone = this.m_bodyModel.rootBone; |
| skinnedMeshRenderer.rootBone = this.m_bodyModel.rootBone; |
| skinnedMeshRenderer.bones = this.m_bodyModel.bones; |
| skinnedMeshRenderer.bones = this.m_bodyModel.bones; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| gameObject2.transform.SetParent(joint); |
| gameObject2.transform.SetParent(joint); |
| gameObject2.transform.localPosition = Vector3.zero; |
| gameObject2.transform.localPosition = Vector3.zero; |
| gameObject2.transform.localRotation = Quaternion.identity; |
| gameObject2.transform.localRotation = Quaternion.identity; |
| } |
| } |
| IEquipmentVisual componentInChildren = gameObject2.GetComponentInChildren<IEquipmentVisual>(); |
| IEquipmentVisual componentInChildren = gameObject2.GetComponentInChildren<IEquipmentVisual>(); |
| if (componentInChildren != null) |
| if (componentInChildren != null) |
| { |
| { |
| componentInChildren.Setup(variant); |
| componentInChildren.Setup(variant); |
| } |
| } |
| return gameObject2; |
| return gameObject2; |
| } |
| } |
| |
| |
| private static void CleanupInstance(GameObject instance) |
| private static void CleanupInstance(GameObject instance) |
| { |
| { |
| Collider[] componentsInChildren = instance.GetComponentsInChildren<Collider>(); |
| Collider[] componentsInChildren = instance.GetComponentsInChildren<Collider>(); |
| for (int i = 0; i < componentsInChildren.Length; i++) |
| for (int i = 0; i < componentsInChildren.Length; i++) |
| { |
| { |
| componentsInChildren[i].enabled = false; |
| componentsInChildren[i].enabled = false; |
| } |
| } |
| } |
| } |
| |
| |
| private static void EnableEquippedEffects(GameObject instance) |
| private static void EnableEquippedEffects(GameObject instance) |
| { |
| { |
| Transform transform = instance.transform.Find("equiped"); |
| Transform transform = instance.transform.Find("equiped"); |
| if (transform) |
| if (transform) |
| { |
| { |
| transform.gameObject.SetActive(true); |
| transform.gameObject.SetActive(true); |
| } |
| } |
| } |
| } |
| |
| |
| public int GetModelIndex() |
| public int GetModelIndex() |
| { |
| { |
| int num = this.m_modelIndex; |
| int num = this.m_modelIndex; |
| if (this.m_nview.IsValid()) |
| if (this.m_nview.IsValid()) |
| { |
| { |
| num = this.m_nview.GetZDO().GetInt(ZDOVars.s_modelIndex, 0); |
| num = this.m_nview.GetZDO().GetInt(ZDOVars.s_modelIndex, 0); |
| } |
| } |
| return num; |
| return num; |
| } |
| } |
| |
| |
| . | public static List<VisEquipment> Instances { get; } = new List<VisEquipment>(); |
| public static List<IMonoUpdater> Instances { get; } = new List<IMonoUpdater>(); |
| |
| |
| public SkinnedMeshRenderer m_bodyModel; |
| public SkinnedMeshRenderer m_bodyModel; |
| |
| |
| public ZNetView m_nViewOverride; |
| public ZNetView m_nViewOverride; |
| |
| |
| [Header("Attachment points")] |
| [Header("Attachment points")] |
| public Transform m_leftHand; |
| public Transform m_leftHand; |
| |
| |
| public Transform m_rightHand; |
| public Transform m_rightHand; |
| |
| |
| public Transform m_helmet; |
| public Transform m_helmet; |
| |
| |
| public Transform m_backShield; |
| public Transform m_backShield; |
| |
| |
| public Transform m_backMelee; |
| public Transform m_backMelee; |
| |
| |
| public Transform m_backTwohandedMelee; |
| public Transform m_backTwohandedMelee; |
| |
| |
| public Transform m_backBow; |
| public Transform m_backBow; |
| |
| |
| public Transform m_backTool; |
| public Transform m_backTool; |
| |
| |
| public Transform m_backAtgeir; |
| public Transform m_backAtgeir; |
| |
| |
| public CapsuleCollider[] m_clothColliders = Array.Empty<CapsuleCollider>(); |
| public CapsuleCollider[] m_clothColliders = Array.Empty<CapsuleCollider>(); |
| |
| |
| public VisEquipment.PlayerModel[] m_models = Array.Empty<VisEquipment.PlayerModel>(); |
| public VisEquipment.PlayerModel[] m_models = Array.Empty<VisEquipment.PlayerModel>(); |
| |
| |
| public bool m_isPlayer; |
| public bool m_isPlayer; |
| |
| |
| public bool m_useAllTrails; |
| public bool m_useAllTrails; |
| |
| |
| private string m_leftItem = ""; |
| private string m_leftItem = ""; |
| |
| |
| private string m_rightItem = ""; |
| private string m_rightItem = ""; |
| |
| |
| private string m_chestItem = ""; |
| private string m_chestItem = ""; |
| |
| |
| private string m_legItem = ""; |
| private string m_legItem = ""; |
| |
| |
| private string m_helmetItem = ""; |
| private string m_helmetItem = ""; |
| |
| |
| private string m_shoulderItem = ""; |
| private string m_shoulderItem = ""; |
| |
| |
| private string m_beardItem = ""; |
| private string m_beardItem = ""; |
| |
| |
| private string m_hairItem = ""; |
| private string m_hairItem = ""; |
| |
| |
| private string m_utilityItem = ""; |
| private string m_utilityItem = ""; |
| |
| |
| private string m_leftBackItem = ""; |
| private string m_leftBackItem = ""; |
| |
| |
| private string m_rightBackItem = ""; |
| private string m_rightBackItem = ""; |
| |
| |
| private int m_shoulderItemVariant; |
| private int m_shoulderItemVariant; |
| |
| |
| private int m_leftItemVariant; |
| private int m_leftItemVariant; |
| |
| |
| private int m_leftBackItemVariant; |
| private int m_leftBackItemVariant; |
| |
| |
| private GameObject m_leftItemInstance; |
| private GameObject m_leftItemInstance; |
| |
| |
| private GameObject m_rightItemInstance; |
| private GameObject m_rightItemInstance; |
| |
| |
| private GameObject m_helmetItemInstance; |
| private GameObject m_helmetItemInstance; |
| |
| |
| private List<GameObject> m_chestItemInstances; |
| private List<GameObject> m_chestItemInstances; |
| |
| |
| private List<GameObject> m_legItemInstances; |
| private List<GameObject> m_legItemInstances; |
| |
| |
| private List<GameObject> m_shoulderItemInstances; |
| private List<GameObject> m_shoulderItemInstances; |
| |
| |
| private List<GameObject> m_utilityItemInstances; |
| private List<GameObject> m_utilityItemInstances; |
| |
| |
| private GameObject m_beardItemInstance; |
| private GameObject m_beardItemInstance; |
| |
| |
| private GameObject m_hairItemInstance; |
| private GameObject m_hairItemInstance; |
| |
| |
| private GameObject m_leftBackItemInstance; |
| private GameObject m_leftBackItemInstance; |
| |
| |
| private GameObject m_rightBackItemInstance; |
| private GameObject m_rightBackItemInstance; |
| |
| |
| private int m_currentLeftItemHash; |
| private int m_currentLeftItemHash; |
| |
| |
| private int m_currentRightItemHash; |
| private int m_currentRightItemHash; |
| |
| |
| private int m_currentChestItemHash; |
| private int m_currentChestItemHash; |
| |
| |
| private int m_currentLegItemHash; |
| private int m_currentLegItemHash; |
| |
| |
| private int m_currentHelmetItemHash; |
| private int m_currentHelmetItemHash; |
| |
| |
| private int m_currentShoulderItemHash; |
| private int m_currentShoulderItemHash; |
| |
| |
| private int m_currentBeardItemHash; |
| private int m_currentBeardItemHash; |
| |
| |
| private int m_currentHairItemHash; |
| private int m_currentHairItemHash; |
| |
| |
| private int m_currentUtilityItemHash; |
| private int m_currentUtilityItemHash; |
| |
| |
| private int m_currentLeftBackItemHash; |
| private int m_currentLeftBackItemHash; |
| |
| |
| private int m_currentRightBackItemHash; |
| private int m_currentRightBackItemHash; |
| |
| |
| private int m_currentShoulderItemVariant; |
| private int m_currentShoulderItemVariant; |
| |
| |
| private int m_currentLeftItemVariant; |
| private int m_currentLeftItemVariant; |
| |
| |
| private int m_currentLeftBackItemVariant; |
| private int m_currentLeftBackItemVariant; |
| |
| |
| private ItemDrop.ItemData.HelmetHairType m_helmetHideHair; |
| private ItemDrop.ItemData.HelmetHairType m_helmetHideHair; |
| |
| |
| private ItemDrop.ItemData.HelmetHairType m_helmetHideBeard; |
| private ItemDrop.ItemData.HelmetHairType m_helmetHideBeard; |
| |
| |
| private Texture m_emptyBodyTexture; |
| private Texture m_emptyBodyTexture; |
| |
| |
| private Texture m_emptyLegsTexture; |
| private Texture m_emptyLegsTexture; |
| |
| |
| private int m_modelIndex; |
| private int m_modelIndex; |
| |
| |
| private Vector3 m_skinColor = Vector3.one; |
| private Vector3 m_skinColor = Vector3.one; |
| |
| |
| private Vector3 m_hairColor = Vector3.one; |
| private Vector3 m_hairColor = Vector3.one; |
| |
| |
| private int m_currentModelIndex; |
| private int m_currentModelIndex; |
| |
| |
| private ZNetView m_nview; |
| private ZNetView m_nview; |
| |
| |
| private GameObject m_visual; |
| private GameObject m_visual; |
| |
| |
| private LODGroup m_lodGroup; |
| private LODGroup m_lodGroup; |
| |
| |
| [Serializable] |
| [Serializable] |
| public class PlayerModel |
| public class PlayerModel |
| { |
| { |
| public Mesh m_mesh; |
| public Mesh m_mesh; |
| |
| |
| public Material m_baseMaterial; |
| public Material m_baseMaterial; |
| } |
| } |
| } |
| } |
| |
| |