private IEnumerator EquipWeapon(HTNPlayer target) { yield return((object)CoroutineEx.waitForSeconds(0.25f)); if (!Object.op_Equality((Object)target, (Object)null) && !target.IsDestroyed && (!target.IsDead() && !target.IsWounded()) && (!Object.op_Equality((Object)target.inventory, (Object)null) && target.inventory.containerBelt != null)) { Item slot = target.inventory.containerBelt.GetSlot(0); if (slot != null) { target.UpdateActiveItem(slot.uid); yield return((object)CoroutineEx.waitForSeconds(0.25f)); MurdererDomain aiDomain = target.AiDomain as MurdererDomain; if (Object.op_Implicit((Object)aiDomain)) { if (slot.info.category == ItemCategory.Weapon) { BaseEntity heldEntity = slot.GetHeldEntity(); if (heldEntity is BaseProjectile) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true); aiDomain.ReloadFirearm(); } else if (heldEntity is BaseMelee) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); Chainsaw chainsaw = heldEntity as Chainsaw; if (Object.op_Implicit((Object)chainsaw)) { chainsaw.ServerNPCStart(); } } else if (heldEntity is ThrownWeapon) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true); } } else if (slot.info.category == ItemCategory.Medical) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true); } else if (slot.info.category == ItemCategory.Tool) { BaseEntity heldEntity = slot.GetHeldEntity(); if (heldEntity is BaseMelee) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); Chainsaw chainsaw = heldEntity as Chainsaw; if (Object.op_Implicit((Object)chainsaw)) { chainsaw.ServerNPCStart(); } } else { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true); } } } } } }
private IEnumerator EquipWeapon(HTNPlayer target) { yield return(CoroutineEx.waitForSeconds(0.25f)); if (target == null || target.IsDestroyed || target.IsDead() || target.IsWounded() || target.inventory == null || target.inventory.containerBelt == null) { yield break; } Item item = target.inventory.containerBelt.GetSlot(0); if (item == null) { yield break; } target.UpdateActiveItem(item.uid); yield return(CoroutineEx.waitForSeconds(0.25f)); MurdererDomain aiDomain = target.AiDomain as MurdererDomain; if (aiDomain) { if (item.info.category == ItemCategory.Weapon) { BaseEntity heldEntity = item.GetHeldEntity(); if (heldEntity is BaseProjectile) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true); aiDomain.ReloadFirearm(); } else if (heldEntity is BaseMelee) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); Chainsaw chainsaw = heldEntity as Chainsaw; if (chainsaw) { chainsaw.ServerNPCStart(); } } else if (heldEntity is ThrownWeapon) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true); } } else if (item.info.category == ItemCategory.Medical) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true); } else if (item.info.category == ItemCategory.Tool) { BaseEntity baseEntity = item.GetHeldEntity(); if (!(baseEntity is BaseMelee)) { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true); } else { aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); Chainsaw chainsaw1 = baseEntity as Chainsaw; if (chainsaw1) { chainsaw1.ServerNPCStart(); } } } } }