Example #1
0
        private void QuestCompleteMessage_OnClose()
        {
            PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;

            // Train the skill, for free
            DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now;

            playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime();
            now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3);
            playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180);
            int   skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skill);
            short tallyAmount = (short)(UnityEngine.Random.Range(10, 20 + 1) * skillAdvancementMultiplier);

            playerEntity.TallySkill(skill, tallyAmount);
        }
        protected void TrainSkillIntense(DFCareer.Skills skillToTrain)
        {
            DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now;

            now.RaiseTime(DaggerfallDateTime.SecondsPerDay * 4);
            playerEntity.Skills.SetPermanentSkillValue(skillToTrain, (short)(playerEntity.Skills.GetPermanentSkillValue(skillToTrain) + 4));

            TrainSkill(skillToTrain);

            TextFile.Token[] intenseTokens =
            {
                TextFile.CreateTextToken("You have spent the last 4 days intensively training your "),  newLine,
                TextFile.CreateTextToken(skillToTrain + " skill, and have improved it significantly."), newLine,newLine,
                TextFile.CreateTextToken("Now it's time to begin your fifth and final session...")
            };
            DaggerfallUI.MessageBox(intenseTokens);
        }
        public void TrainingSkill_OnItemPicked(int index, string skillName)
        {
            CloseWindow();
            List <DFCareer.Skills> trainingSkills;

            if (guildTrainingSkills.TryGetValue(service, out trainingSkills))
            {
                DFCareer.Skills skillToTrain = trainingSkills[index];
                int             maxTraining  = 50;
                if (DaggerfallSkills.IsLanguageSkill(skillToTrain))     // BCHG: Language skill training is capped by char intelligence instead of 50%
                {
                    maxTraining = playerEntity.Stats.PermanentIntelligence;
                }

                if (playerEntity.Skills.GetPermanentSkillValue(skillToTrain) > maxTraining)
                {
                    // Inform player they're too skilled to train
                    TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(TrainingTooSkilledId);
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                    messageBox.SetTextTokens(tokens, this);
                    messageBox.ClickAnywhereToClose = true;
                    uiManager.PushWindow(messageBox);
                }
                else
                {   // Train the skill
                    DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now;
                    playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime();
                    now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3);
                    playerEntity.DeductGoldAmount(GetServicePrice());
                    playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180);
                    int   skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skillToTrain);
                    short tallyAmount = (short)(UnityEngine.Random.Range(10, 21) * skillAdvancementMultiplier);
                    playerEntity.TallySkill(skillToTrain, tallyAmount);
                    DaggerfallUI.MessageBox(TrainSkillId);
                }
            }
            else
            {
                Debug.LogError("Invalid skill selected for training.");
            }
        }
Example #4
0
 void Update()
 {
     DaggerfallDateTime.RaiseTime(Time.deltaTime * TimeScale);
     RaiseEvents();
 }
Example #5
0
    private static void FullMoon_OnNewMagicRound()
    {
        if (!DaggerfallUnity.Instance.IsReady || !playerEnterExit || GameManager.IsGamePaused || DaggerfallUI.Instance.FadeBehaviour.FadeInProgress)
        {
            return;
        }
        if (GameManager.Instance.PlayerEffectManager.HasLycanthropy() && !playerEntity.IsResting)
        {
            if (!IsWearingHircineRing() || beastWithRing)
            {
                if (fullMoon)
                {
                    ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                    DaggerfallUI.Instance.FadeBehaviour.SmashHUDToBlack();
                    if (Dice100.SuccessRoll(playerEntity.Stats.LiveLuck))
                    {
                        playerEntity.PreventEnemySpawns = true;
                    }
                    int timeRaised = 109000 + UnityEngine.Random.Range(10, 400);
                    timeNow.RaiseTime(timeRaised);

                    if (playerEnterExit.IsPlayerInsideDungeon)
                    {
                        DungeonMoon();
                    }
                    else
                    {
                        if (playerEnterExit.IsPlayerInside)
                        {
                            playerEnterExit.TransitionExterior();
                        }

                        RandomLocation();
                    }

                    if (Dice100.SuccessRoll(playerEntity.Stats.LiveLuck))
                    {
                        playerEntity.PreventEnemySpawns = true;
                    }
                }

                if (timeNow.SecundaLunarPhase == LunarPhases.Full || timeNow.MassarLunarPhase == LunarPhases.Full)
                {
                    if (!fullWarning)
                    {
                        DaggerfallUI.MessageBox("The moon calls to you. You are unable to resist its pull.");
                        ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                        fullWarning = true;
                    }
                    else if (GameManager.Instance.PlayerEffectManager.HasLycanthropy() && !fullMoon)
                    {
                        GameManager.Instance.TransportManager.TransportMode = TransportModes.Foot;
                        DaggerfallUI.Instance.FadeBehaviour.SmashHUDToBlack();
                        fullMoon = true;
                    }
                    else
                    {
                        fullMoon = false;
                    }
                }
                else
                {
                    fullMoon      = false;
                    fullWarning   = false;
                    beastWithRing = false;
                }
                if (killAll && !GameManager.IsGamePaused)
                {
                    DaggerfallUI.Instance.FadeBehaviour.FadeHUDFromBlack();
                    killAll = false;
                    KillAll();
                }
            }
            else
            {
                if (timeNow.SecundaLunarPhase == LunarPhases.Full || timeNow.MassarLunarPhase == LunarPhases.Full)
                {
                    if (!fullWarning)
                    {
                        DaggerfallUI.MessageBox("The moon calls to you, but the Hircine Ring protects you. As long as you stay in your human shape.");
                        ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                        fullWarning = true;
                    }
                    else if (playerEntity.IsInBeastForm)
                    {
                        beastWithRing = true;
                    }
                }
                else
                {
                    fullMoon      = false;
                    fullWarning   = false;
                    beastWithRing = false;
                }
            }
        }
    }
Example #6
0
 void Update()
 {
     WorldDateTime.RaiseTime(Time.deltaTime * TimeScale);
     RaiseEvents();
 }
Example #7
0
    private static void FullMoon_OnNewMagicRound()
    {
        if (GameManager.Instance.PlayerEffectManager.HasLycanthropy())
        {
            if (!IsWearingHircineRing() || beastWithRing)
            {
                if (fullMoon)
                {
                    ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                    DaggerfallUI.Instance.FadeBehaviour.SmashHUDToBlack();
                    int timeRaised = 109000 + UnityEngine.Random.Range(10, 400);
                    timeNow.RaiseTime(timeRaised);

                    if (playerEnterExit.IsPlayerInside)
                    {
                        playerEnterExit.TransitionExterior();
                    }

                    RandomLocation();
                    int roll = UnityEngine.Random.Range(-50, 101);
                    if (roll < playerEntity.Stats.LiveLuck)
                    {
                        playerEntity.PreventEnemySpawns = true;
                    }
                }

                if (timeNow.SecundaLunarPhase == LunarPhases.Full || timeNow.MassarLunarPhase == LunarPhases.Full)
                {
                    if (!fullWarning)
                    {
                        DaggerfallUI.MessageBox("The moon calls to you. You can feel the change is about to happen.");
                        ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                        fullWarning = true;
                    }
                    else if (GameManager.Instance.PlayerEffectManager.HasLycanthropy() && !fullMoon)
                    {
                        GameManager.Instance.TransportManager.TransportMode = TransportModes.Foot;
                        DaggerfallUI.Instance.FadeBehaviour.SmashHUDToBlack();
                        fullMoon = true;
                        DropAllItems();
                    }
                    else
                    {
                        fullMoon = false;
                    }
                }
                else
                {
                    fullMoon      = false;
                    fullWarning   = false;
                    beastWithRing = false;
                }
                if (killAll && !GameManager.IsGamePaused)
                {
                    DaggerfallUI.Instance.FadeBehaviour.FadeHUDFromBlack();
                    killAll = false;
                    KillAll();
                }
            }
            else
            {
                if (timeNow.SecundaLunarPhase == LunarPhases.Full || timeNow.MassarLunarPhase == LunarPhases.Full)
                {
                    if (!fullWarning)
                    {
                        DaggerfallUI.MessageBox("The moon calls to you. The Hircine Ring protects you, as long as you stay in your human shape.");
                        ModManager.Instance.SendModMessage("TravelOptions", "pauseTravel");
                        fullWarning = true;
                    }
                    else if (playerEntity.IsInBeastForm)
                    {
                        beastWithRing = true;
                    }
                }
                else
                {
                    fullMoon      = false;
                    fullWarning   = false;
                    beastWithRing = false;
                }
            }
        }
    }