void ConfirmClassPopup_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
     {
         sender.CloseWindow();
         CloseWindow();
     }
     else if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.No)
     {
         selectedClass = null;
         sender.CancelWindow();
     }
 }
Ejemplo n.º 2
0
        void EndRest()
        {
            const int youWakeUpTextId         = 353;
            const int enemiesNearby           = 354;
            const int youAreHealedTextId      = 350;
            const int finishedLoiteringTextId = 349;

            if (enemyBrokeRest)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(enemiesNearby);
                mb.OnClose += RestFinishedPopup_OnClose;
            }
            else
            {
                if (remainingHoursRented == 0)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(HardStrings.expiredRentedRoom);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                    playerEntity.RemoveExpiredRentedRooms();
                }
                else if (currentRestMode == RestModes.TimedRest)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUpTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.FullRest)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealedTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.Loiter)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoiteringTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
            }
        }
        void ShowAffiliationsDialog()
        {
            List <TextFile.Token> tokens           = new List <TextFile.Token>();
            List <IGuild>         guildMemberships = GameManager.Instance.GuildManager.GetMemberships();

            if (guildMemberships.Count == 0)
            {
                DaggerfallUI.MessageBox(noAffiliationsMsgId);
            }
            else
            {
                TextFile.Token tab = TextFile.TabToken;
                tab.x = 125;
                tokens.Add(new TextFile.Token()
                {
                    text       = HardStrings.affiliation,
                    formatting = TextFile.Formatting.TextHighlight
                });
                tokens.Add(tab);
                tokens.Add(new TextFile.Token()
                {
                    text       = HardStrings.rank,
                    formatting = TextFile.Formatting.TextHighlight
                });
                tokens.Add(TextFile.NewLineToken);

                foreach (IGuild guild in guildMemberships)
                {
                    tokens.Add(TextFile.CreateTextToken(guild.GetAffiliation()));
                    tokens.Add(tab);
                    tokens.Add(TextFile.CreateTextToken(guild.GetTitle() //)); DEBUG rep:
                                                        + " (rep:" + guild.GetReputation(playerEntity).ToString() + ")"));
                    tokens.Add(TextFile.NewLineToken);
                }

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(tokens.ToArray(), null, false);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
        }
 void EndRest()
 {
     if (currentRestMode == RestModes.TimedRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUp);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.FullRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealed);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.Loiter)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoitering);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
 }
        private void ConfirmTrade_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                // Deduct gold - adding gold sound for additional feedback
                GameManager.Instance.PlayerEntity.DeductGoldAmount(GetTradePrice());
                DaggerfallUI.Instance.PlayOneShot(SoundClips.GoldPieces);

                // Add to player entity spellbook
                GameManager.Instance.PlayerEntity.AddSpell(offeredSpells[spellsListBox.SelectedIndex]);
            }
            if (autoClose)
            {
                // Drop back to HUD like classic
                DaggerfallUI.Instance.PopToHUD();
            }
            else
            {
                CloseWindow();
            }
        }
Ejemplo n.º 6
0
        public void BeginButtonOnClickHandler(BaseScreenComponent sender, Vector2 position)
        {
            Refresh();

            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            // Warns player if they have a disease
            if (GameManager.Instance.PlayerEffectManager.DiseaseCount > 0 || GameManager.Instance.PlayerEffectManager.PoisonCount > 0)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(1010);
                messageBox.SetTextTokens(tokens);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTravelPopupDiseasedButtonClick;
                uiManager.PushWindow(messageBox);
            }
            else
            {
                CallFastTravelGoldCheck();
            }
        }
Ejemplo n.º 7
0
        private void InputMessageBox_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            daysToRent = 0;
            bool result = int.TryParse(input, out daysToRent);

            if (!result || daysToRent < 1)
            {
                return;
            }

            int daysAlreadyRented = 0;

            if (rentedRoom != null)
            {
                daysAlreadyRented = (int)((rentedRoom.expiryTime - DaggerfallUnity.Instance.WorldTime.Now.ToSeconds()) / DaggerfallDateTime.SecondsPerDay);
            }

            if (daysToRent + daysAlreadyRented > 350)
            {
                DaggerfallUI.MessageBox(tooManyDaysFutureId);
            }
            else if (GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.KnightlyOrder).FreeTavernRooms())
            {
                DaggerfallUI.MessageBox(HardStrings.roomFreeForKnightSuchAsYou);
                RentRoom();
            }
            else
            {
                int cost = FormulaHelper.CalculateRoomCost(daysToRent);
                tradePrice = FormulaHelper.CalculateTradePrice(cost, buildingData.quality, false);

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(offerPriceId);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmRenting_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
Ejemplo n.º 8
0
        void CreateCharChooseBioWindow_OnClose()
        {
            if (!createCharChooseBioWindow.Cancelled)
            {
                if (!createCharChooseBioWindow.ChoseQuestions)
                {
                    // Choose answers at random
                    System.Random rand     = new System.Random(System.DateTime.Now.Millisecond);
                    BiogFile      autoBiog = new BiogFile(characterDocument);
                    for (int i = 0; i < autoBiog.Questions.Length; i++)
                    {
                        List <BiogFile.Answer> answers;
                        answers = autoBiog.Questions[i].Answers;
                        int index = rand.Next(0, answers.Count);
                        for (int j = 0; j < answers[index].Effects.Count; j++)
                        {
                            autoBiog.AddEffect(answers[index].Effects[j], i);
                        }
                    }
                    // Show reputation changes
                    autoBiog.DigestRepChanges();
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, createCharChooseBioWindow);
                    messageBox.SetTextTokens(CreateCharBiography.reputationToken, autoBiog);
                    messageBox.ClickAnywhereToClose = true;
                    messageBox.Show();
                    messageBox.OnClose += ReputationBox_OnClose;

                    characterDocument.biographyEffects = autoBiog.AnswerEffects;
                    characterDocument.backStory        = autoBiog.GenerateBackstory(characterDocument.classIndex);
                }
                else
                {
                    SetBiographyWindow();
                }
            }
            else
            {
                SetClassSelectWindow();
            }
        }
Ejemplo n.º 9
0
        void ShowSkillsDialog(List <DFCareer.Skills> skills, bool twoColumn = false)
        {
            bool secondColumn            = false;
            List <TextFile.Token> tokens = new List <TextFile.Token>();

            for (int i = 0; i < skills.Count; i++)
            {
                if (!twoColumn)
                {
                    tokens.AddRange(CreateSkillTokens(skills[i]));
                    if (i < skills.Count - 1)
                    {
                        tokens.Add(TextFile.NewLineToken);
                    }
                }
                else
                {
                    tokens.AddRange(CreateSkillTokens(skills[i]));
                    if (!secondColumn)
                    {
                        secondColumn = !secondColumn;
                        tokens.Add(TextFile.TabToken);
                    }
                    else
                    {
                        secondColumn = !secondColumn;
                        if (i < skills.Count - 1)
                        {
                            tokens.Add(TextFile.NewLineToken);
                        }
                    }
                }
            }

            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);

            messageBox.SetTextTokens(tokens.ToArray());
            messageBox.ClickAnywhereToClose = true;
            messageBox.Show();
        }
Ejemplo n.º 10
0
        private void SaveLoadEventHandler(BaseScreenComponent sender, Vector2 position)
        {
            if (mode == Modes.SaveGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText("DaggerfallUI", "youMustEnterASaveName"));
                    return;
                }

                // Get save key and confirm if already exists
                int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);
                if (key != -1)
                {
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                    messageBox.SetText(new string[] { TextManager.Instance.GetText("DaggerfallUI", "confirmOverwriteSave"), "" });
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                    messageBox.OnButtonClick += ConfirmOverwrite_OnButtonClick;
                    uiManager.PushWindow(messageBox);
                }
                else
                {
                    SaveGame();
                }
            }
            else if (mode == Modes.LoadGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText("DaggerfallUI", "youMustSelectASaveName"));
                    return;
                }

                loadingLabel.Text = TextManager.Instance.GetText("DaggerfallUI", "loading");
                loading           = true;
            }
        }
Ejemplo n.º 11
0
        private void SaveOptionsAndContinue()
        {
            DaggerfallUnity.Settings.ShowOptionsAtStart = alwayShowOptions.IsChecked;
            DaggerfallUnity.Settings.VSync = vsync.IsChecked;
            DaggerfallUnity.Settings.SwapHealthAndFatigueColors = swapHealthAndFatigue.IsChecked;
            DaggerfallUnity.Settings.InvertMouseVertical        = invertMouseVertical.IsChecked;
            DaggerfallUnity.Settings.MouseLookSmoothing         = mouseSmoothing.IsChecked;
            DaggerfallUnity.Settings.Handedness    = GetHandedness(leftHandWeapons.IsChecked);
            DaggerfallUnity.Settings.PlayerNudity  = playerNudity.IsChecked;
            DaggerfallUnity.Settings.ClickToAttack = clickToAttack.IsChecked;
            DaggerfallUnity.Settings.SaveSettings();

            if (ModManager.Instance)
            {
                foreach (Mod mod in ModManager.Instance.Mods.Where(x => x.Enabled))
                {
                    bool?isGameVersionSatisfied = mod.IsGameVersionSatisfied();
                    if (isGameVersionSatisfied == false)
                    {
                        var messageBox = new DaggerfallMessageBox(uiManager, this, true);
                        messageBox.SetText(GetText("incompatibleMods"));
                        messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                        messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true);
                        messageBox.OnButtonClick += (_, messageBoxButton) =>
                        {
                            moveNextStage = messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes;
                            messageBox.CloseWindow();
                        };
                        uiManager.PushWindow(messageBox);
                        return;
                    }
                    else if (isGameVersionSatisfied == null)
                    {
                        Debug.LogWarningFormat("Unknown format for property \"DFUnity_Version\" of mod {0}. Please use x.y.z version of minimum compatible game build.", mod.Title);
                    }
                }
            }

            moveNextStage = true;
        }
Ejemplo n.º 12
0
        void AnswerButton_OnMouseClick(BaseScreenComponent sender, Vector2 pos)
        {
            int answerIndex = (int)sender.Tag;
            List <BiogFile.Answer> curAnswers = biogFile.Questions[questionIndex].Answers;

            if (answerIndex >= curAnswers.Count)
            {
                return; // not an answer for this question
            }
            else if (questionIndex < biogFile.Questions.Length - 1)
            {
                foreach (string effect in curAnswers[answerIndex].Effects)
                {
                    biogFile.AddEffect(effect, questionIndex);
                }
                questionIndex++;
                PopulateControls(biogFile.Questions[questionIndex]);
            }
            else
            {
                // Add final effects
                foreach (string effect in curAnswers[answerIndex].Effects)
                {
                    biogFile.AddEffect(effect, questionIndex);
                }

                // Create text biography
                BackStory = biogFile.GenerateBackstory(Document.classIndex);

                // Show reputation changes
                biogFile.DigestRepChanges();
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(reputationToken, biogFile);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();

                CloseWindow();
            }
        }
        private void BuyButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            const int tradeMessageBaseId = 260;
            const int notEnoughGoldId    = 454;
            int       tradePrice         = GetTradePrice();
            int       msgOffset          = 0;

            if (!GameManager.Instance.PlayerEntity.Items.Contains(Items.ItemGroups.MiscItems, (int)Items.MiscItems.Spellbook))
            {
                DaggerfallUI.MessageBox(noSpellBook);
            }
            else if (GameManager.Instance.PlayerEntity.GetGoldAmount() < tradePrice)
            {
                DaggerfallUI.MessageBox(notEnoughGoldId);
            }
            else
            {
                if (presentedCost >> 1 <= tradePrice)
                {
                    if (presentedCost - (presentedCost >> 2) <= tradePrice)
                    {
                        msgOffset = 2;
                    }
                    else
                    {
                        msgOffset = 1;
                    }
                }

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(tradeMessageBaseId + msgOffset);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTrade_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
        // Show a popup such as accept/reject message close guild window
        protected virtual void ShowQuestPopupMessage(Quest quest, int id, bool exitOnClose = true)
        {
            // Get message resource
            Message message = quest.GetMessage(id);
            if (message == null)
                return;

            // Setup popup message
            TextFile.Token[] tokens = message.GetTextTokens();
            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager);
            messageBox.SetTextTokens(tokens, this.offeredQuest.ExternalMCP);
            messageBox.ClickAnywhereToClose = true;
            messageBox.AllowCancel = true;
            messageBox.ParentPanel.BackgroundColor = Color.clear;

            // Exit menu on close if requested
            if (exitOnClose)
                messageBox.OnClose += QuestPopupMessage_OnClose;

            // Present popup message
            messageBox.Show();
        }
Ejemplo n.º 15
0
        void ShowTradePopup()
        {
            const int tradeMessageBaseId = 260;
            const int notEnoughGoldId    = 454;
            int       msgOffset          = 0;
            int       tradePrice         = GetTradePrice();

            if (windowMode != WindowModes.Sell && windowMode != WindowModes.SellMagic && PlayerEntity.GetGoldAmount() < tradePrice)
            {
                DaggerfallUI.MessageBox(notEnoughGoldId);
            }
            else
            {
                if (cost >> 1 <= tradePrice)
                {
                    if (cost - (cost >> 2) <= tradePrice)
                    {
                        msgOffset = 2;
                    }
                    else
                    {
                        msgOffset = 1;
                    }
                }
                if (windowMode == WindowModes.Sell || windowMode == WindowModes.SellMagic)
                {
                    msgOffset += 3;
                }

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(tradeMessageBaseId + msgOffset);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTrade_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
Ejemplo n.º 16
0
        public override void OnPush()
        {
            base.OnPush();

            buildingDiscoveryData = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData;

            // Check guild advancement
            TextFile.Token[] updatedRank = guild.UpdateRank(playerEntity);
            if (updatedRank != null)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                messageBox.SetTextTokens(updatedRank, guild);
                messageBox.ClickAnywhereToClose = true;
                uiManager.PushWindow(messageBox);
            }
            // Check for free healing (Temple members)
            if (guild.FreeHealing() && playerEntity.CurrentHealth < playerEntity.MaxHealth)
            {
                playerEntity.SetHealth(playerEntity.MaxHealth);
                DaggerfallUI.MessageBox(350);
            }
            // TODO: Check for magicka restoration (sorcerers)
        }
Ejemplo n.º 17
0
        protected void ConfirmGettingScammed_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            int playerIntell = player.Stats.LiveIntelligence;

            if (LimitedGoldShops.LimitedGoldShops.ShopBuildingData.TryGetValue(currentBuildingID, out sd))
            {
                investedFlag = sd.InvestedIn;
                shopAttitude = sd.ShopAttitude;
            }

            CloseWindow();
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
                if (playerEntity.GetGoldAmount() >= investOffer)
                {
                    playerEntity.DeductGoldAmount(investOffer);
                    DaggerfallUI.Instance.PlayOneShot(SoundClips.GoldPieces);
                    tokens = LGSTextTokenHolder.ShopTextTokensNeutral(3);
                    if (investedFlag)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNeutral(4);
                    }
                    DaggerfallUI.MessageBox(tokens);
                    investOffer = 0;
                    LimitedGoldShops.LimitedGoldShops.UpdateInvestAmount(investOffer);
                }
                else
                {
                    DaggerfallUI.MessageBox("Good joke there, you really got me there, ya jerk...");
                }
            }
            else if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.No)
            {
                DaggerfallUI.MessageBox("Yeah, I was just joking as well, haha...");
            }
        }
        protected override void GetQuest()
        {
            // Just exit if this NPC already involved in an active quest
            // If quest conditions are complete the quest system should pickup ending
            if (QuestMachine.Instance.IsLastNPCClickedAnActiveQuestor())
            {
                CloseWindow();
                return;
            }

            // Get the faction id for affecting reputation on success/failure, and current rep
            int     factionId  = questorNPC.factionID;
            Genders gender     = questorNPC.gender;
            int     reputation = GameManager.Instance.PlayerEntity.FactionData.GetReputation(factionId);
            int     level      = GameManager.Instance.PlayerEntity.Level;

            // Select a quest at random from appropriate pool
            offeredQuest = GameManager.Instance.QuestListsManager.GetSocialQuest(socialGroup, factionId, gender, reputation, level);
            if (offeredQuest != null)
            {
                // Log offered quest
                Debug.LogFormat("Offering quest {0} from Social group {1} affecting factionId {2}", offeredQuest.QuestName, socialGroup, offeredQuest.FactionId);

                // Offer the quest to player
                DaggerfallMessageBox messageBox = QuestMachine.Instance.CreateMessagePrompt(offeredQuest, (int)QuestMachine.QuestMessages.QuestorOffer);// TODO - need to provide an mcp for macros?
                if (messageBox != null)
                {
                    messageBox.OnButtonClick += OfferQuest_OnButtonClick;
                    messageBox.Show();
                }
            }
            else if (!GameManager.Instance.IsPlayerInsideCastle) // Failed get quest messages do not appear inside castles in classic.
            {
                ShowFailGetQuestMessage();
            }
        }
Ejemplo n.º 19
0
        void DaggerfallClassSelectWindow_OnItemPicked(int index, string className)
        {
            if (index == classList.Count) // "Custom" option selected
            {
                selectedClass = null;
                CloseWindow();
            }
            else
            {
                selectedClass = classList[index];

                TextFile.Token[]     textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(startClassDescriptionID + index);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(textTokens);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                Button noButton = messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                noButton.ClickSound       = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
                messageBox.OnButtonClick += ConfirmClassPopup_OnButtonClick;
                uiManager.PushWindow(messageBox);

                AudioClip clip = DaggerfallUnity.Instance.SoundReader.GetAudioClip(SoundClips.SelectClassDrums);
                DaggerfallUI.Instance.AudioSource.PlayOneShot(clip);
            }
        }
Ejemplo n.º 20
0
        public void TrainingSkill_OnItemPicked(int index, string skillName)
        {
            CloseWindow();
            List <DFCareer.Skills> trainingSkills;

            if (guildTrainingSkills.TryGetValue(service, out trainingSkills))
            {
                DFCareer.Skills skillToTrain = trainingSkills[index];

                if (playerEntity.Skills.GetPermanentSkillValue(skillToTrain) > 50)
                {
                    // 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)(Random.Range(10, 21) * skillAdvancementMultiplier);
                    playerEntity.TallySkill(skillToTrain, tallyAmount);
                    DaggerfallUI.MessageBox(TrainSkillId);
                }
            }
            else
            {
                Debug.LogError("Invalid skill selected for training.");
            }
        }
Ejemplo n.º 21
0
        // Handle current quest clicks - ask if want to travel to last location for quest.
        protected virtual void HandleQuestClicks(Message questMessage)
        {
            // Get last actual Place resource mentioned in quest message
            // If no Place resouce is mentioned specifically then Place will be null
            // An example of where this happens is the DB initiation quest where entry is kept secret from journal
            // When using ParentQuest.LastPlaceReferenced this can result in player being sent to an unrelated home location for last NPC processed
            Place place = GetLastPlaceMentionedInMessage(questMessage);

            Debug.Log(questMessage.ParentQuest.QuestName);
            if (place != null &&
                !string.IsNullOrEmpty(place.SiteDetails.locationName) &&
                place.SiteDetails.locationName != GameManager.Instance.PlayerGPS.CurrentLocation.Name)
            {
                findPlaceName = place.SiteDetails.locationName;
                if (DaggerfallUI.Instance.DfTravelMapWindow.CanFindPlace(place.SiteDetails.regionName, findPlaceName))
                {
                    findPlaceRegion = DaggerfallUnity.Instance.ContentReader.MapFileReader.GetRegionIndex(place.SiteDetails.regionName);
                    string entryStr = string.Format("{0} in {1} province", findPlaceName, place.SiteDetails.regionName);
                    DaggerfallMessageBox dialogBox = CreateDialogBox(entryStr, "confirmFind");
                    dialogBox.OnButtonClick += FindPlace_OnButtonClick;
                    DaggerfallUI.UIManager.PushWindow(dialogBox);
                }
            }
        }
        protected void OfferQuest()
        {
            if (offeredQuest != null)
            {
                // Log offered quest
                Debug.LogFormat("Offering quest {0} from Guild {1} affecting factionId {2}", offeredQuest.QuestName, guildGroup, offeredQuest.FactionId);

                // Offer the quest to player, setting external context provider to guild if a member
                if (guild.IsMember())
                {
                    offeredQuest.ExternalMCP = guild;
                }
                DaggerfallMessageBox messageBox = QuestMachine.Instance.CreateMessagePrompt(offeredQuest, (int)QuestMachine.QuestMessages.QuestorOffer);
                if (messageBox != null)
                {
                    messageBox.OnButtonClick += OfferQuest_OnButtonClick;
                    messageBox.Show();
                }
            }
            else
            {
                ShowFailGetQuestMessage();
            }
        }
        protected virtual void TrainingSkill_OnItemPicked(int index, string skillName)
        {
            CloseWindow();
            List <DFCareer.Skills> trainingSkills = GetTrainingSkills();

            DFCareer.Skills skillToTrain = trainingSkills[index];

            if (playerEntity.Skills.GetPermanentSkillValue(skillToTrain) > Guild.GetTrainingMax(skillToTrain))
            {
                // 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, Guild);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
            else
            {
                // Take payment.
                playerEntity.DeductGoldAmount(Guild.GetTrainingPrice());
                // Train the skill
                TrainSkill(skillToTrain);
            }
        }
        protected virtual void TrainingService()
        {
            // Check enough time has passed since last trained
            DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now;

            if ((now.ToClassicDaggerfallTime() - playerEntity.TimeOfLastSkillTraining) < 720)
            {
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(TrainingToSoonId);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                messageBox.SetTextTokens(tokens);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
            else
            {   // Offer training price
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(TrainingOfferId);
                messageBox.SetTextTokens(tokens, Guild);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTraining_OnButtonClick;
                messageBox.Show();
            }
        }
Ejemplo n.º 25
0
        protected virtual DaggerfallMessageBox CreateDialogBox(string entryStr, string baseKey)
        {
            string heading     = TextManager.Instance.GetLocalizedText(baseKey + "Head");
            string action      = TextManager.Instance.GetLocalizedText(baseKey);
            string explanation = TextManager.Instance.GetLocalizedText(baseKey + "2");

            TextFile.Token[] tokens = new TextFile.Token[] {
                TextFile.CreateTextToken(heading), TextFile.CreateFormatToken(TextFile.Formatting.JustifyCenter), TextFile.NewLineToken,
                TextFile.CreateTextToken(action), TextFile.NewLineToken, TextFile.NewLineToken,
                new TextFile.Token()
                {
                    text = entryStr, formatting = TextFile.Formatting.TextHighlight
                }, TextFile.CreateFormatToken(TextFile.Formatting.JustifyCenter), TextFile.NewLineToken,
                TextFile.CreateTextToken(explanation), TextFile.CreateFormatToken(TextFile.Formatting.EndOfRecord)
            };

            DaggerfallMessageBox dialogBox = new DaggerfallMessageBox(uiManager, this);

            dialogBox.SetHighlightColor(Color.white);
            dialogBox.SetTextTokens(tokens);
            dialogBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            dialogBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            return(dialogBox);
        }
        private void ConfirmTraining_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            CloseWindow();
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                if (playerEntity.GetGoldAmount() >= guild.GetTrainingPrice())
                {
                    // Show skill picker loaded with guild training skills
                    DaggerfallListPickerWindow skillPicker = new DaggerfallListPickerWindow(uiManager, this);
                    skillPicker.OnItemPicked += TrainingSkill_OnItemPicked;

                    foreach (DFCareer.Skills skill in GetTrainingSkills())
                    {
                        skillPicker.ListBox.AddItem(DaggerfallUnity.Instance.TextProvider.GetSkillName(skill));
                    }

                    uiManager.PushWindow(skillPicker);
                }
                else
                {
                    DaggerfallUI.MessageBox(NotEnoughGoldId);
                }
            }
        }
        /// <summary>
        /// Button handler for travel confirmation pop up. This is a temporary solution until implementing the final pop-up.
        /// </summary>
        void ConfirmTravelPopupButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            //sender.CloseWindow();

            //if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            //{
            //    DFPosition pos = MapsFile.LongitudeLatitudeToMapPixel((int)locationInfo.Longitude, (int)locationInfo.Latitude);
            //    TravelToLocation(pos);
            //}
        }
        private void SaveLoadEventHandler(BaseScreenComponent sender, Vector2 position)
        {
            if (mode == Modes.SaveGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(HardStrings.youMustEnterASaveName);
                    return;
                }

                // Get save key and confirm if already exists
                int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);
                if (key != -1)
                {
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                    messageBox.SetText(HardStrings.confirmOverwriteSave, "");
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                    messageBox.OnButtonClick += ConfirmOverwrite_OnButtonClick;
                    uiManager.PushWindow(messageBox);
                }
                else
                {
                    SaveGame();
                }
            }
            else if (mode == Modes.LoadGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(HardStrings.youMustSelectASaveName);
                    return;
                }

                LoadGame();
            }
        }
        private void DeleteSaveButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            // Must have a save selected
            if (savesList.SelectedIndex < 0)
                return;

            // Confirmation
            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            messageBox.SetText(HardStrings.confirmDeleteSave, "");
            messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Delete);
            messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Cancel);
            messageBox.OnButtonClick += ConfirmDelete_OnButtonClick;
            uiManager.PushWindow(messageBox);
        }
Ejemplo n.º 30
0
        protected void InvestMessageBox_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            int playerIntell = player.Stats.LiveIntelligence;

            if (LimitedGoldShops.LimitedGoldShops.ShopBuildingData.TryGetValue(currentBuildingID, out sd))
            {
                investedFlag = sd.InvestedIn;
                shopAttitude = sd.ShopAttitude;
            }

            bool result = int.TryParse(input, out investOffer);

            if (!result || investOffer < 500)
            {
                tokens = LGSTextTokenHolder.ShopTextTokensNeutral(5);
                DaggerfallUI.MessageBox(tokens);
                return;
            }

            DaggerfallMessageBox investConfimBox = new DaggerfallMessageBox(uiManager, this);

            if (buildQual <= 3) // 01 - 03
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(11, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(14, investOffer);
                }
            }
            else if (buildQual <= 7) // 04 - 07
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(3, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(10, investOffer);
                }
            }
            else if (buildQual <= 17) // 08 - 17
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(15, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(18, investOffer);
                }
            }
            else                      // 18 - 20
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(19, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(22, investOffer);
                }
            }
            if (investedFlag)
            {
                if (buildQual <= 3) // 01 - 03
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(13, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(16, investOffer);
                    }
                }
                else if (buildQual <= 7) // 04 - 07
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(9, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(12, investOffer);
                    }
                }
                else if (buildQual <= 17) // 08 - 17
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(17, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(20, investOffer);
                    }
                }
                else                      // 18 - 20
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(21, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(24, investOffer);
                    }
                }
            }
            investConfimBox.SetTextTokens(tokens);
            investConfimBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            investConfimBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            investConfimBox.OnButtonClick += ConfirmInvestment_OnButtonClick;
            uiManager.PushWindow(investConfimBox);
        }
 private void ConfirmExitBox_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     sender.CloseWindow();
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
     {
         DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiExitGame);
         CancelWindow();
     }
 }
        /// <summary>
        /// Handles events from Find Location pop-up.
        /// </summary>
        void HandleLocationFindEvent(DaggerfallInputMessageBox inputMessageBox, string locationName)
        {
            //locationSelected = false;

            if (string.IsNullOrEmpty(locationName) || !FindLocation(locationName))
            {
                TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(textTokens);
                messageBox.ClickAnywhereToClose = true;
                uiManager.PushWindow(messageBox);
                return;
            }
            else //place flashing crosshair over location
            {
                locationSelected = true;
                findingLocation = true;
                CreateCrossHair(MapsFile.GetPixelFromPixelID(locationSummary.ID), locationSummary.RegionIndex);
                StartRegionIdentify();
            }
        }
        void CreateConfirmationPopUp()
        {
            if (!locationSelected)
                return;

            TextFile.Token[] textTokens = new TextFile.Token[2];
            //int index = currentRegion.MapIdLookup[locationSummary.MapIndex];
            textTokens[0].text = string.Format("Travel to  {0} : {1} ?", currentDFRegion.Name, currentDFRegion.MapNames[locationSummary.MapIndex]);
            textTokens[0].formatting = TextFile.Formatting.Text;
            textTokens[1].text = null;
            textTokens[1].formatting = TextFile.Formatting.NewLine;

            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            messageBox.SetTextTokens(textTokens);
            messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            messageBox.OnButtonClick += ConfirmTravelPopupButtonClick;
            uiManager.PushWindow(messageBox);
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Adds another nested message box to be displayed next when click detected.
 /// </summary>
 /// <param name="nextMessageBox">Next message box.</param>
 public void AddNextMessageBox(DaggerfallMessageBox nextMessageBox)
 {
     this.nextMessageBox = nextMessageBox;
 }
 public static DaggerfallMessageBox MessageBox(int id)
 {
     DaggerfallMessageBox messageBox = new DaggerfallMessageBox(Instance.uiManager, Instance.uiManager.TopWindow);
     messageBox.SetTextTokens(id);
     messageBox.ClickAnywhereToClose = true;
     messageBox.Show();
     return messageBox;
 }
 void ConfirmRacePopup_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
     {
         CloseWindow();
     }
     else if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.No)
     {
         sender.CancelWindow();
     }
 }
        void ClickHandler(BaseScreenComponent sender, Vector2 position)
        {
            int offset = (int)position.y * racePickerBitmap.Width + (int)position.x;
            if (offset < 0 || offset >= racePickerBitmap.Data.Length)
                return;

            int id = racePickerBitmap.Data[offset];
            if (raceDict.ContainsKey(id))
            {
                promptLabel.Enabled = false;
                selectedRace = raceDict[id];

                TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(selectedRace.DescriptionID);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(textTokens);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                Button noButton = messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                noButton.ClickSound = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
                messageBox.OnButtonClick += ConfirmRacePopup_OnButtonClick;
                messageBox.OnCancel += ConfirmRacePopup_OnCancel;
                uiManager.PushWindow(messageBox);

                AudioClip clip = DaggerfallUnity.Instance.SoundReader.GetAudioClip((uint)selectedRace.ClipID);
                DaggerfallUI.Instance.AudioSource.PlayOneShot(clip);
            }
        }
Ejemplo n.º 38
0
 public static DaggerfallMessageBox MessageBox(string[] message)
 {
     DaggerfallMessageBox messageBox = new DaggerfallMessageBox(Instance.uiManager, Instance.uiManager.TopWindow);
     messageBox.SetText(message);
     messageBox.ClickAnywhereToClose = true;
     messageBox.Show();
     return messageBox;
 }
        void DaggerfallClassSelectWindow_OnItemPicked(int index, string className)
        {
            selectedClass = classList[index];

            TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(startClassDescriptionID + index);
            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            messageBox.SetTextTokens(textTokens);
            messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            Button noButton = messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            noButton.ClickSound = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
            messageBox.OnButtonClick += ConfirmClassPopup_OnButtonClick;
            uiManager.PushWindow(messageBox);

            AudioClip clip = DaggerfallUnity.Instance.SoundReader.GetAudioClip(SoundClips.SelectClassDrums);
            DaggerfallUI.Instance.AudioSource.PlayOneShot(clip);
        }
    void ShowModDescriptionPopUp_OnMouseClick(BaseScreenComponent sender, Vector2 position)
    {
        if (modSettings == null || modSettings.Length < 1)
            return;
        else if (string.IsNullOrEmpty(modSettings[currentSelection].modInfo.ModDescription))
            return;

        ModDescriptionMessageBox = new DaggerfallMessageBox(uiManager, this);
        ModDescriptionMessageBox.AllowCancel = true;
        ModDescriptionMessageBox.ClickAnywhereToClose = true;
        ModDescriptionMessageBox.ParentPanel.BackgroundTexture = null;

           string[] modDescription = modSettings[currentSelection].modInfo.ModDescription.Split('\n');
           ModDescriptionMessageBox.SetText(modDescription);
           uiManager.PushWindow(ModDescriptionMessageBox);
    }
        private void ConfirmDelete_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Delete)
            {
                // Get save key
                int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);
                if (key == -1)
                    return;

                // Delete save and refresh
                GameManager.Instance.SaveLoadManager.DeleteSaveFolder(key);
                saveNameTextBox.Text = string.Empty;
                UpdateSavesList();
                UpdateSelectedSaveInfo();
            }

            CloseWindow();
        }
Ejemplo n.º 42
0
 /// <summary>
 /// 11
 /// Pop-up text
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="thisAction"></param>
 public static void ShowText(GameObject obj, DaggerfallAction thisAction)
 {
     DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallWorkshop.Game.DaggerfallUI.UIManager, null);
     messageBox.SetTextTokens(thisAction.Index + TYPE_11_TEXT_INDEX);
     messageBox.ClickAnywhereToClose = true;
     messageBox.ParentPanel.BackgroundColor = Color.clear;
     messageBox.Show();
 }
 private void ConfirmOverwrite_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
     {
         SaveGame();
     }
     else
     {
         CloseWindow();
     }
 }
        void ShowSkillsDialog(List<DFCareer.Skills> skills, bool twoColumn = false)
        {
            bool secondColumn = false;
            List<TextFile.Token> tokens = new List<TextFile.Token>();
            for (int i = 0; i < skills.Count; i++)
            {
                if (!twoColumn)
                {
                    tokens.AddRange(CreateSkillTokens(skills[i]));
                    if (i < skills.Count - 1)
                        tokens.Add(TextFile.NewLineToken);
                }
                else
                {
                    tokens.AddRange(CreateSkillTokens(skills[i]));
                    if (!secondColumn)
                    {
                        secondColumn = !secondColumn;
                        tokens.Add(TextFile.TabToken);
                    }
                    else
                    {
                        secondColumn = !secondColumn;
                        if (i < skills.Count - 1)
                            tokens.Add(TextFile.NewLineToken);
                    }
                }
            }

            DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            messageBox.SetTextTokens(tokens.ToArray());
            messageBox.ClickAnywhereToClose = true;
            messageBox.Show();
        }
 private void ExitButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallMessageBox confirmExitBox = new DaggerfallMessageBox(uiManager, DaggerfallMessageBox.CommonMessageBoxButtons.YesNo, strAreYouSure, this);
     confirmExitBox.OnButtonClick += ConfirmExitBox_OnButtonClick;
     confirmExitBox.Show();
 }
Ejemplo n.º 46
0
        protected void ConfirmInvestment_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            int playerIntell = player.Stats.LiveIntelligence;

            if (LimitedGoldShops.LimitedGoldShops.ShopBuildingData.TryGetValue(currentBuildingID, out sd))
            {
                investedFlag = sd.InvestedIn;
                shopAttitude = sd.ShopAttitude;
            }

            CloseWindow();
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
                if (playerEntity.GetGoldAmount() >= investOffer)
                {
                    playerEntity.DeductGoldAmount(investOffer);
                    DaggerfallUI.Instance.PlayOneShot(SoundClips.GoldPieces);
                    if (buildQual <= 3) // 01 - 03
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("I'll do my best, partner.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Thanks for the gold, ya nutter.");
                        }
                    }
                    else if (buildQual <= 7) // 04 - 07
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("Ya won't be disappointed, boss.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Really care for those fish, huh?");
                        }
                    }
                    else if (buildQual <= 17) // 08 - 17
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("Not a bad signature, do you practice?");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Your signature is atrocious, by the way.");
                        }
                    }
                    else if (buildQual >= 18) // 18 - 20
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("I never disappoint when it comes to turning a profit.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Wipe your feet next time, you're tracking sludge in, lamprey.");
                        }
                    }
                    LimitedGoldShops.LimitedGoldShops.UpdateInvestAmount(investOffer);
                }
                else
                {
                    if (buildQual <= 3) // 01 - 03
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("I think you counted wrong, you don't have that much.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("I know you don't have that much, stop lyin' ya idiot!");
                        }
                    }
                    else if (buildQual <= 7) // 04 - 07
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("Might want to recount, boss, cause I don't see that amount.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Who ya tryna impress, huh? I know you don't have that much.");
                        }
                    }
                    else if (buildQual <= 17) // 08 - 17
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("Sorry, but it appears your funds are less than you suggest.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("Quit wasting my damn time, you dolt, you don't have that much!");
                        }
                    }
                    else if (buildQual >= 18) // 18 - 20
                    {
                        if (shopAttitude == 0)
                        {
                            DaggerfallUI.MessageBox("I think you need to hire a new accountant, because you don't have that.");
                        }
                        else
                        {
                            DaggerfallUI.MessageBox("I need to charge more for my time, so leeches like you won't waste it so often!");
                        }
                    }
                }
            }
            else if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.No)
            {
                if (buildQual <= 3) // 01 - 03
                {
                    if (shopAttitude == 0)
                    {
                        DaggerfallUI.MessageBox("I understand your reluctance, just look around, haha!");
                    }
                    else
                    {
                        DaggerfallUI.MessageBox("Why you gettin' my hopes up, just to dash them down?");
                    }
                }
                else if (buildQual <= 7) // 04 - 07
                {
                    if (shopAttitude == 0)
                    {
                        DaggerfallUI.MessageBox("That's fine, I would not take such a gamble myself either.");
                    }
                    else
                    {
                        DaggerfallUI.MessageBox("Why you tryna bait me in just to pull away the line?");
                    }
                }
                else if (buildQual <= 17) // 08 - 17
                {
                    if (shopAttitude == 0)
                    {
                        DaggerfallUI.MessageBox("Very well, thankfully parchment is cheap around here.");
                    }
                    else
                    {
                        DaggerfallUI.MessageBox("What's with the indecisive always wasting my time in this town?");
                    }
                }
                else if (buildQual >= 18) // 18 - 20
                {
                    if (shopAttitude == 0)
                    {
                        DaggerfallUI.MessageBox("So be it, ask again when you are ready to commit.");
                    }
                    else
                    {
                        DaggerfallUI.MessageBox("The parasite sucks my precious time away once again, a pity.");
                    }
                }
            }
        }
 private void StatButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
     messageBox.SetTextTokens((int)sender.Tag);
     messageBox.ClickAnywhereToClose = true;
     messageBox.Show();
 }
        private void ServiceButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            // Check access to service
            if (!guild.CanAccessService(service))
            {
                if (guild.IsMember())
                {
                    DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
                    msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(InsufficientRankId));
                    msgBox.ClickAnywhereToClose = true;
                    msgBox.Show();
                }
                else
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "serviceMembersOnly"));
                }
                return;
            }
            // Handle known service
            switch (service)
            {
            case GuildServices.Quests:
                GetQuest();
                break;

            case GuildServices.Identify:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Identify, this, guild));
                break;

            case GuildServices.Repair:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Repair, this, guild));
                break;

            case GuildServices.Training:
                TrainingService();
                break;

            case GuildServices.Donate:
                DonationService();
                break;

            case GuildServices.CureDisease:
                CureDiseaseService();
                break;

            case GuildServices.BuyPotions:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Buy, this, guild)
                {
                    MerchantItems = GetMerchantPotions()
                });
                break;

            case GuildServices.MakePotions:
                MakePotionService();
                break;

            case GuildServices.BuySpells:
            case GuildServices.BuySpellsMages:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallSpellBookWindow(uiManager, this, true));
                break;

            case GuildServices.MakeSpells:
                CloseWindow();
                if (GameManager.Instance.PlayerEntity.Items.Contains(Items.ItemGroups.MiscItems, (int)Items.MiscItems.Spellbook))
                {
                    uiManager.PushWindow(DaggerfallUI.Instance.DfSpellMakerWindow);
                }
                else
                {
                    DaggerfallUI.MessageBox(TextManager.Instance.GetText("ClassicEffects", "noSpellbook"));
                }
                break;

            case GuildServices.BuyMagicItems:       // TODO: switch items depending on npcService?
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Buy, this, guild)
                {
                    MerchantItems = GetMerchantMagicItems()
                });
                break;

            case GuildServices.MakeMagicItems:
                CloseWindow();
                uiManager.PushWindow(DaggerfallUI.Instance.DfItemMakerWindow);
                break;

            case GuildServices.SellMagicItems:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.SellMagic, this, guild));
                break;

            case GuildServices.Teleport:
                CloseWindow();
                DaggerfallUI.Instance.DfTravelMapWindow.ActivateTeleportationTravel();
                uiManager.PushWindow(DaggerfallUI.Instance.DfTravelMapWindow);
                break;

            case GuildServices.DaedraSummoning:
                DaedraSummoningService((int)npcService);
                break;

            case GuildServices.ReceiveArmor:
                ReceiveArmorService();
                break;

            case GuildServices.ReceiveHouse:
                ReceiveHouseService();
                break;

            case GuildServices.Spymaster:
                const int            spyMasterGreetingTextId = 402;
                DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
                msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(spyMasterGreetingTextId));
                msgBox.ClickAnywhereToClose = true;
                msgBox.OnClose += SpyMasterGreetingPopUp_OnClose;
                msgBox.Show();
                break;

            case GuildServices.BuySoulgems:
                CloseWindow();
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Buy, this, guild)
                {
                    MerchantItems = GetMerchantMagicItems(true)
                });
                break;

            default:
                CloseWindow();
                Services.CustomGuildService customService;
                if (Services.GetCustomGuildService((int)service, out customService))
                {
                    customService(this);
                }
                else
                {
                    DaggerfallUI.MessageBox("Guild service not yet implemented.");
                }
                break;
            }
        }
 void RaiseOnButtonClickEvent(DaggerfallMessageBox sender, MessageBoxButtons messageBoxButton)
 {
     if (OnButtonClick != null)
         OnButtonClick(sender, messageBoxButton);
 }
        void CureDiseaseService()
        {
            CloseWindow();
            int numberOfDiseases = GameManager.Instance.PlayerEffectManager.DiseaseCount;

            if (playerEntity.TimeToBecomeVampireOrWerebeast != 0)
            {
                numberOfDiseases++;
            }

            // Check holidays for free / cheaper curing
            uint minutes   = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();
            int  holidayId = FormulaHelper.GetHolidayId(minutes, GameManager.Instance.PlayerGPS.CurrentRegionIndex);

            if (numberOfDiseases > 0 &&
                (holidayId == (int)DFLocation.Holidays.South_Winds_Prayer ||
                 holidayId == (int)DFLocation.Holidays.First_Harvest ||
                 holidayId == (int)DFLocation.Holidays.Second_Harvest))
            {
                GameManager.Instance.PlayerEffectManager.CureAllDiseases();
                playerEntity.TimeToBecomeVampireOrWerebeast = 0;
                DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "freeHolidayCuring"));
            }
            else if (numberOfDiseases > 0)
            {
                // Get base cost
                int baseCost = 250 * numberOfDiseases;

                // Apply rank-based discount if this is an Arkay temple
                baseCost = guild.ReducedCureCost(baseCost);

                // Apply temple quality and regional price modifiers
                int costBeforeBargaining = FormulaHelper.CalculateCost(baseCost, buildingDiscoveryData.quality);

                // Halve the price on North Winds Prayer holiday
                if (holidayId == (int)DFLocation.Holidays.North_Winds_Festival)
                {
                    costBeforeBargaining /= 2;
                }

                // Apply bargaining to get final price
                curingCost = FormulaHelper.CalculateTradePrice(costBeforeBargaining, buildingDiscoveryData.quality, false);

                // Index correct message
                const int tradeMessageBaseId = 260;
                int       msgOffset          = 0;
                if (costBeforeBargaining >> 1 <= curingCost)
                {
                    if (costBeforeBargaining - (costBeforeBargaining >> 2) <= curingCost)
                    {
                        msgOffset = 2;
                    }
                    else
                    {
                        msgOffset = 1;
                    }
                }
                // Offer curing at the calculated price.
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(tradeMessageBaseId + msgOffset);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmCuring_OnButtonClick;
                messageBox.Show();
            }
            else
            {   // Not diseased
                DaggerfallUI.MessageBox(30);
            }
        }
        void ShowInfoPopup(DaggerfallUnityItem item)
        {
            const int armorTextId = 1000;
            const int weaponTextId = 1001;
            const int miscTextId = 1003;

            TextFile.Token[] tokens = null;
            if (item.ItemGroup == ItemGroups.Armor)
                tokens = DaggerfallUnity.TextProvider.GetRSCTokens(armorTextId);
            else if (item.ItemGroup == ItemGroups.Weapons)
                tokens = DaggerfallUnity.TextProvider.GetRSCTokens(weaponTextId);
            else
                tokens = DaggerfallUnity.TextProvider.GetRSCTokens(miscTextId);

            if (tokens != null && tokens.Length > 0)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(tokens);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
        }
 void OkButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     if (statsRollout.BonusPool > 0)
     {
         DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
         messageBox.SetTextTokens(strYouMustDistributeYourBonusPoints);
         messageBox.ClickAnywhereToClose = true;
         messageBox.Show();
     }
     else
     {
         CloseWindow();
     }
 }
 /// <summary>
 /// Button handler for travel confirmation pop up. This is a temporary solution until implementing the final pop-up.
 /// </summary>
 void ConfirmTravelPopupButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     sender.CloseWindow();
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
         CreatePopUpWindow();
     else
         StopRegionIdentify();
 }