private void OnCreateCraftedItem(OnCreateCraftedItem data) { using (new Profiler(nameof(CraftCreateItem))) { try { RunCreateItem(data.Player); data.Player.IsBusy = false; } catch (Exception ex) { LoggingService.LogError(ex); } } }
public static void CraftItem(NWPlayer oPC, NWPlaceable device) { var model = GetPlayerCraftingData(oPC); CraftBlueprint blueprint = DataService.CraftBlueprint.GetByID(model.BlueprintID); if (blueprint == null) { return; } if (oPC.IsBusy) { oPC.SendMessage("You are too busy right now."); return; } if (!model.CanBuildItem) { oPC.SendMessage("You are missing one or more components..."); return; } oPC.IsBusy = true; float modifiedCraftDelay = CalculateCraftingDelay(oPC, blueprint.SkillID); oPC.AssignCommand(() => { _.ClearAllActions(); _.ActionPlayAnimation(Animation.LoopingGetMid, 1.0f, modifiedCraftDelay); }); _.DelayCommand(1.0f * (modifiedCraftDelay / 2.0f), () => { _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Blood_Spark_Medium), device.Object); }); var immobilize = _.EffectCutsceneImmobilize(); immobilize = _.TagEffect(immobilize, "CRAFTING_IMMOBILIZATION"); _.ApplyEffectToObject(DurationType.Permanent, immobilize, oPC.Object); NWNXPlayer.StartGuiTimingBar(oPC, modifiedCraftDelay, ""); var @event = new OnCreateCraftedItem(oPC); oPC.DelayEvent(modifiedCraftDelay, @event); }
public static void CraftItem(NWPlayer oPC, NWPlaceable device) { var model = GetPlayerCraftingData(oPC); CraftBlueprint blueprint = DataService.CraftBlueprint.GetByID(model.BlueprintID); if (blueprint == null) { return; } if (oPC.IsBusy) { oPC.SendMessage("You are too busy right now."); return; } if (!model.CanBuildItem) { oPC.SendMessage("You are missing one or more components..."); return; } oPC.IsBusy = true; float modifiedCraftDelay = CalculateCraftingDelay(oPC, blueprint.SkillID); oPC.AssignCommand(() => { _.ClearAllActions(); _.ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0f, modifiedCraftDelay); }); _.DelayCommand(1.0f * (modifiedCraftDelay / 2.0f), () => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM), device.Object); }); Effect immobilize = _.EffectCutsceneImmobilize(); immobilize = _.TagEffect(immobilize, "CRAFTING_IMMOBILIZATION"); _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, immobilize, oPC.Object); NWNXPlayer.StartGuiTimingBar(oPC, modifiedCraftDelay, ""); var @event = new OnCreateCraftedItem(oPC); oPC.DelayEvent(modifiedCraftDelay, @event); }