static void UseItem(Obj_AI_Base target, DzItem item) { if (!Items.HasItem(item.Id) || !Items.CanUseItem(item.Id)) { return; } switch (item.Mode) { case ItemMode.Targeted: Items.UseItem(item.Id, target); break; case ItemMode.NoTarget: Items.UseItem(item.Id, ObjectManager.Player); break; case ItemMode.Skillshot: if (item.CustomInput == null) { return; } var customPred = Prediction.GetPrediction(item.CustomInput); if (customPred.Hitchance >= GetHitchance()) { Items.UseItem(item.Id, customPred.CastPosition); } break; } }
static SpellSlot GetItemSpellSlot(DzItem item) { foreach (var it in ObjectManager.Player.InventoryItems.Where(it => (int)it.Id == item.Id)) { return(it.SpellSlot != SpellSlot.Unknown ? it.SpellSlot : SpellSlot.Unknown); } return(SpellSlot.Unknown); }