Esempio n. 1
0
        private void HandleBlueprintListPageResponse(int responseID)
        {
            DialogResponse response    = GetResponseByID("BlueprintListPage", responseID);
            int            blueprintID = (int)response.CustomData;

            if (blueprintID == -1)
            {
                ChangePage("CraftCategoriesPage");
                return;
            }

            var model = CraftService.GetPlayerCraftingData(GetPC());

            model.Blueprint        = CraftService.GetBlueprintByID(blueprintID);
            model.BlueprintID      = blueprintID;
            model.PlayerSkillRank  = SkillService.GetPCSkillRank(GetPC(), model.Blueprint.SkillID);
            model.MainMinimum      = model.Blueprint.MainMinimum;
            model.MainMaximum      = model.Blueprint.MainMaximum;
            model.SecondaryMinimum = model.Blueprint.SecondaryMinimum;
            model.SecondaryMaximum = model.Blueprint.SecondaryMaximum;
            model.TertiaryMinimum  = model.Blueprint.TertiaryMinimum;
            model.TertiaryMaximum  = model.Blueprint.TertiaryMaximum;

            string header = CraftService.BuildBlueprintHeader(GetPC(), blueprintID, false);

            SetPageHeader("BlueprintDetailsPage", header);
            ChangePage("BlueprintDetailsPage");
        }
Esempio n. 2
0
        public override void Initialize()
        {
            ToggleBackButton(false);

            var model  = CraftService.GetPlayerCraftingData(GetPC());
            var device = GetDevice();

            // Entering the conversation for the first time from the blueprint selection menu.
            if (!model.IsInitialized)
            {
                model.IsInitialized   = true;
                model.Blueprint       = CraftService.GetBlueprintByID(model.BlueprintID);
                model.PlayerSkillRank = SkillService.GetPCSkillRank(GetPC(), model.Blueprint.SkillID);

                switch ((SkillType)model.Blueprint.SkillID)
                {
                case SkillType.Armorsmith:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.ArmorBlueprints);
                    break;

                case SkillType.Engineering:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.EngineeringBlueprints);
                    break;

                case SkillType.Weaponsmith:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.WeaponBlueprints);
                    break;

                case SkillType.Fabrication:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.FabricationBlueprints);
                    break;

                case SkillType.Medicine:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.MedicalBlueprints);
                    break;

                case SkillType.Lightsaber:
                    model.PlayerPerkLevel = PerkService.GetCreaturePerkLevel(GetPC(), PerkType.LightsaberBlueprints);
                    // Lightsabers do not have Optimisation or Efficiency perks.
                    break;

                default:
                    model.PlayerPerkLevel = 0;
                    break;
                }
                GetDevice().IsLocked   = true;
                model.MainMinimum      = model.Blueprint.MainMinimum;
                model.SecondaryMinimum = model.Blueprint.SecondaryMinimum;
                model.TertiaryMinimum  = model.Blueprint.TertiaryMinimum;

                model.MainMaximum      = model.Blueprint.MainMaximum;
                model.SecondaryMaximum = model.Blueprint.SecondaryMaximum > 0 ? model.Blueprint.SecondaryMaximum : 0;
                model.TertiaryMaximum  = model.Blueprint.TertiaryMaximum > 0 ? model.Blueprint.TertiaryMaximum : 0;

                if (model.MainMinimum <= 0)
                {
                    model.MainMinimum = 1;
                }
                if (model.SecondaryMinimum <= 0 && model.Blueprint.SecondaryMinimum > 0)
                {
                    model.SecondaryMinimum = 1;
                }
                if (model.TertiaryMinimum <= 0 && model.Blueprint.TertiaryMinimum > 0)
                {
                    model.TertiaryMinimum = 1;
                }
            }
            // Otherwise returning from accessing the device's inventory.
            else
            {
                model.Access = CraftingAccessType.None;

                _.SetEventScript(device.Object, EVENT_SCRIPT_PLACEABLE_ON_USED, "script_1");
                _.SetEventScript(device.Object, EVENT_SCRIPT_PLACEABLE_ON_OPEN, string.Empty);
                _.SetEventScript(device.Object, EVENT_SCRIPT_PLACEABLE_ON_CLOSED, string.Empty);
                _.SetEventScript(device.Object, EVENT_SCRIPT_PLACEABLE_ON_INVENTORYDISTURBED, string.Empty);
            }


            SetPageHeader("MainPage", CraftService.BuildBlueprintHeader(GetPC(), true));
            BuildMainPageOptions();
        }