Esempio n. 1
0
        private void HandleMainPageResponses(int responseID)
        {
            var         model  = CraftService.GetPlayerCraftingData(GetPC());
            NWPlaceable device = GetDevice();

            switch (responseID)
            {
            case 1:     // Examine Base Item
                CraftBlueprint entity        = CraftService.GetBlueprintByID(model.BlueprintID);
                NWPlaceable    tempContainer = (_.GetObjectByTag("craft_temp_store"));
                NWItem         examineItem   = (_.CreateItemOnObject(entity.ItemResref, tempContainer.Object));
                GetPC().AssignCommand(() => _.ActionExamine(examineItem.Object));
                examineItem.Destroy(0.1f);
                break;

            case 2:     // Create item
                if (!model.CanBuildItem)
                {
                    GetPC().FloatingText("You are missing some required components.");
                    return;
                }

                int effectiveLevel = CraftService.CalculatePCEffectiveLevel(GetPC(), model.PlayerSkillRank, (SkillType)model.Blueprint.SkillID);
                int difficulty     = effectiveLevel - model.AdjustedLevel;

                if (difficulty <= -5)
                {
                    GetPC().FloatingText("It's impossible to make this item because its level is too high. Use lower-level components to reduce the level and difficulty.");
                    return;
                }

                CraftService.CraftItem(GetPC(), device);
                model.IsAccessingStorage = true;
                EndConversation();
                break;

            case 3:     // Select main components
                model.Access = CraftingAccessType.MainComponent;
                OpenDeviceInventory();
                break;

            case 4:     // Select secondary components
                model.Access = CraftingAccessType.SecondaryComponent;
                OpenDeviceInventory();
                break;

            case 5:     // Select tertiary components
                model.Access = CraftingAccessType.TertiaryComponent;
                OpenDeviceInventory();
                break;

            case 6:     // Select enhancement components
                model.Access = CraftingAccessType.Enhancement;
                OpenDeviceInventory();
                break;

            case 7:     // Back (return to blueprint selection)
                CraftService.ClearPlayerCraftingData(GetPC());
                SwitchConversation("CraftingDevice");
                break;
            }
        }