public HitArea SkeletonLookup(uint boneID) { if (Object.op_Equality((Object)this.skeletonProperties, (Object)null)) { return((HitArea) - 1); } SkeletonProperties.BoneProperty bone = this.skeletonProperties.FindBone(boneID); if (bone == null) { return((HitArea) - 1); } return(bone.area); }
public SkeletonProperties.BoneProperty FindBone(uint id) { if (this.quickLookup == null) { this.BuildDictionary(); } SkeletonProperties.BoneProperty boneProperty = null; if (!this.quickLookup.TryGetValue(id, out boneProperty)) { return(null); } return(boneProperty); }
public HitArea SkeletonLookup(uint boneID) { if (this.skeletonProperties == null) { return(HitArea.Head | HitArea.Chest | HitArea.Stomach | HitArea.Arm | HitArea.Hand | HitArea.Leg | HitArea.Foot); } SkeletonProperties.BoneProperty boneProperty = this.skeletonProperties.FindBone(boneID); if (boneProperty == null) { return(HitArea.Head | HitArea.Chest | HitArea.Stomach | HitArea.Arm | HitArea.Hand | HitArea.Leg | HitArea.Foot); } return(boneProperty.area); }
string GetBodypart(HitInfo hitInfo) { string bodypart = "Unknown Bodypart"; BaseCombatEntity hitEntity = hitInfo?.HitEntity as BaseCombatEntity; SkeletonProperties.BoneProperty boneProperty = hitEntity?.skeletonProperties?.FindBone(hitInfo.HitBone); bodypart = boneProperty?.name?.english ?? "Unknown Bodypart"; SetConfig("Bodyparts", FirstUpper(bodypart), FirstUpper(bodypart)); SaveConfig(); return(FirstUpper(Config["Bodyparts", FirstUpper(bodypart)].ToString())); }
string GetHitBone(HitInfo info) { string hitBone = ""; BaseCombatEntity hitEntity = info?.HitEntity as BaseCombatEntity; if (hitEntity != null) { SkeletonProperties.BoneProperty boneProperty = hitEntity.skeletonProperties?.FindBone(info.HitBone); string bone = boneProperty?.name?.english ?? ""; if (!boneNames.TryGetValue(bone, out hitBone)) { hitBone = bone; } } return(hitBone); }
private void BuildDictionary() { this.quickLookup = new Dictionary <uint, SkeletonProperties.BoneProperty>(); SkeletonProperties.BoneProperty[] bonePropertyArray = this.bones; for (int i = 0; i < (int)bonePropertyArray.Length; i++) { SkeletonProperties.BoneProperty boneProperty = bonePropertyArray[i]; uint num = StringPool.Get(boneProperty.bone.name); if (this.quickLookup.ContainsKey(num)) { string str = boneProperty.bone.name; string item = this.quickLookup[num].bone.name; Debug.LogWarning(string.Concat(new object[] { "Duplicate bone id ", num, " for ", str, " and ", item })); } else { this.quickLookup.Add(num, boneProperty); } } }