public static bool TrySwitchToolTo( NPCHumanContext c, NPCPlayerApex.ToolTypeEnum toolDay, NPCPlayerApex.ToolTypeEnum toolNight) { if (c != null) { Item obj = (Item)null; uint svActiveItemId = c.Human.svActiveItemID; if (Object.op_Inequality((Object)TOD_Sky.get_Instance(), (Object)null)) { obj = !TOD_Sky.get_Instance().get_IsDay() ? SwitchToolOperator.FindTool(c, toolNight) : SwitchToolOperator.FindTool(c, toolDay); } if (obj != null) { c.Human.UpdateActiveItem(obj.uid); if ((int)svActiveItemId != (int)c.Human.svActiveItemID) { c.Human.NextToolSwitchTime = Time.get_realtimeSinceStartup() + c.Human.ToolSwitchFrequency; c.SetFact(NPCPlayerApex.Facts.CurrentWeaponType, (byte)0, true, true); c.SetFact(NPCPlayerApex.Facts.CurrentToolType, (byte)c.Human.GetCurrentToolTypeEnum(), true, true); } return(true); } } return(false); }
public static bool TrySwitchToolTo(NPCHumanContext c, NPCPlayerApex.ToolTypeEnum toolDay, NPCPlayerApex.ToolTypeEnum toolNight) { if (c != null) { Item item = null; uint human = c.Human.svActiveItemID; if (TOD_Sky.Instance != null) { item = (!TOD_Sky.Instance.IsDay ? SwitchToolOperator.FindTool(c, toolNight) : SwitchToolOperator.FindTool(c, toolDay)); } if (item != null) { c.Human.UpdateActiveItem(item.uid); if (human != c.Human.svActiveItemID) { c.Human.NextToolSwitchTime = UnityEngine.Time.realtimeSinceStartup + c.Human.ToolSwitchFrequency; c.SetFact(NPCPlayerApex.Facts.CurrentWeaponType, 0, true, true); c.SetFact(NPCPlayerApex.Facts.CurrentToolType, (byte)c.Human.GetCurrentToolTypeEnum(), true, true); } return(true); } } return(false); }
public override void DoExecute(BaseContext c) { SwitchToolOperator.TrySwitchToolTo(c as NPCHumanContext, this.ToolTypeDay, this.ToolTypeNight); }