Ejemplo n.º 1
0
        private void SalvagePageResponses(int responseID)
        {
            var player = GetPC();
            var model  = CraftService.GetPlayerCraftingData(player);

            switch (responseID)
            {
            case 1:     // Reassemble Component(s)

                NWItem fuel = _.GetItemPossessedBy(player, "ass_power");
                // Look for reassembly fuel in the player's inventory.
                if (!fuel.IsValid)
                {
                    player.SendMessage(ColorTokenService.Red("You must have a 'Reassembly Fuel Cell' in your inventory in order to start this process."));
                    return;
                }

                if (model.IsConfirmingReassemble)
                {
                    // Calculate delay, fire off delayed event, and show timing bar.
                    float delay = CraftService.CalculateCraftingDelay(player, (int)SkillType.Harvesting);
                    NWNXPlayer.StartGuiTimingBar(player, delay, string.Empty);
                    var @event = new OnReassembleComplete(player, model.SerializedSalvageItem, model.SalvageComponentTypeID);
                    player.DelayEvent(delay, @event);

                    // Make the player play an animation.
                    player.AssignCommand(() =>
                    {
                        _.ClearAllActions();
                        _.ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0f, delay);
                    });

                    // Show sparks halfway through the process.
                    _.DelayCommand(1.0f * (delay / 2.0f), () =>
                    {
                        _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM), NWGameObject.OBJECT_SELF);
                    });

                    // Immobilize the player while crafting.
                    Effect immobilize = _.EffectCutsceneImmobilize();
                    immobilize = _.TagEffect(immobilize, "CRAFTING_IMMOBILIZATION");
                    _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, immobilize, player);

                    // Clear the temporary crafting data and end this conversation.
                    model.SerializedSalvageItem = string.Empty;
                    EndConversation();
                }
                else
                {
                    model.IsConfirmingReassemble = true;
                    SetResponseText("SalvagePage", 1, "CONFIRM REASSEMBLE COMPONENT(S)");
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void SalvagePageResponses(int responseID)
        {
            var player = GetPC();
            var model  = CraftService.GetPlayerCraftingData(player);

            switch (responseID)
            {
            case 1:     // Reassemble Component(s)
                if (model.IsConfirmingReassemble)
                {
                    // Calculate delay, fire off delayed event, and show timing bar.
                    float delay = CraftService.CalculateCraftingDelay(player, (int)SkillType.Harvesting);
                    NWNXPlayer.StartGuiTimingBar(player, delay, string.Empty);
                    player.DelayEvent <ReassembleComplete>(delay, player, model.SerializedSalvageItem, model.SalvageComponentTypeID);

                    // Make the player play an animation.
                    player.AssignCommand(() =>
                    {
                        _.ClearAllActions();
                        _.ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0f, delay);
                    });

                    // Show sparks halfway through the process.
                    _.DelayCommand(1.0f * (delay / 2.0f), () =>
                    {
                        _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM), Object.OBJECT_SELF);
                    });

                    // Immobilize the player while crafting.
                    Effect immobilize = _.EffectCutsceneImmobilize();
                    immobilize = _.TagEffect(immobilize, "CRAFTING_IMMOBILIZATION");
                    _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, immobilize, player);

                    // Clear the temporary crafting data and end this conversation.
                    model.SerializedSalvageItem = string.Empty;
                    EndConversation();
                }
                else
                {
                    model.IsConfirmingReassemble = true;
                    SetResponseText("SalvagePage", 1, "CONFIRM REASSEMBLE COMPONENT(S)");
                }
                break;
            }
        }