void BuyHouseButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
     if (DaggerfallBankManager.OwnsHouse)
     {
         GeneratePopup(TransactionResult.ALREADY_OWN_HOUSE);
     }
     else
     {
         BuildingDirectory buildingDirectory = GameManager.Instance.StreamingWorld.GetCurrentBuildingDirectory();
         if (buildingDirectory)
         {
             List <BuildingSummary> housesForSale = buildingDirectory.GetHousesForSale();
             // If houses are for sale, show them
             if (housesForSale.Count > 0)
             {
                 uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.BankPurchasePopup, new object[] { uiManager, this, housesForSale }));
             }
             else
             {
                 GeneratePopup(TransactionResult.NO_HOUSES_FOR_SALE);
             }
         }
         else
         {
             GeneratePopup(TransactionResult.NO_HOUSES_FOR_SALE);
         }
     }
 }
Exemplo n.º 2
0
        private static void BedActivation(RaycastHit hit)
        {
            IUserInterfaceManager uiManager = DaggerfallUI.UIManager;

            //uiManager.PushWindow(new DaggerfallRestWindow(uiManager, true));
            uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Rest, new object[] { uiManager, false }));
        }
Exemplo n.º 3
0
        // Handle clicks on the main panel
        protected override void ClickHandler(BaseScreenComponent sender, Vector2 position)
        {
            // If allowed handle clicks on map pixels without a location, allowing non-fast travel to any MP coords
            if (TravelOptionsMod.Instance.TargetCoordsAllowed && RegionSelected && !locationSelected && !MouseOverOtherRegion)
            {
                position.y -= regionPanelOffset;

                // Ensure clicks are inside region texture
                if (position.x < 0 || position.x > regionTextureOverlayPanelRect.width || position.y < 0 || position.y > regionTextureOverlayPanelRect.height)
                {
                    return;
                }

                if (popUp == null)
                {
                    popUp = (DaggerfallTravelPopUp)UIWindowFactory.GetInstanceWithArgs(UIWindowType.TravelPopUp, new object[] { uiManager, uiManager.TopWindow, this });
                }
                ((TravelOptionsPopUp)popUp).EndPos = GetClickMPCoords();
                uiManager.PushWindow(popUp);
            }
            else
            {
                base.ClickHandler(sender, position);
            }
        }
Exemplo n.º 4
0
        public override void Start(EntityEffectManager manager, DaggerfallEntityBehaviour caster = null)
        {
            base.Start(manager, caster);

            UserInterfaceManager  uiManager   = DaggerfallUI.UIManager as UserInterfaceManager;
            DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, null, DaggerfallTradeWindow.WindowModes.Identify, null });

            tradeWindow.UsingIdentifySpell = true;
            uiManager.PushWindow(tradeWindow);
        }
Exemplo n.º 5
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            DaggerfallVidPlayerWindow vidPlayerWindow = (DaggerfallVidPlayerWindow)
                                                        UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { DaggerfallUI.UIManager, videoName });

            vidPlayerWindow.EndOnAnyKey = false;
            DaggerfallUI.UIManager.PushWindow(vidPlayerWindow);

            SetComplete();
        }
        public static void LocatorService(IUserInterfaceWindow window)
        {
            Debug.Log("Locator service.");

            // Get the guild instance.
            IGuild thisGuild = GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.GGroup0);
            // Check how many holy items the player has. Offer 16 if no limit.
            int holyCount = 16;

            if (thisGuild.Rank < 6)
            {
                PlayerEntity playerEntity        = GameManager.Instance.PlayerEntity;
                List <DaggerfallUnityItem> tomes = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome);
                tomes.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome));
                List <DaggerfallUnityItem> daggers = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger);
                daggers.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger));
                holyCount = tomes.Count + daggers.Count;
            }
            if (thisGuild.Rank >= 6 || holyCount > 0)
            {
                // Show trade window and a popup message to inform player how many locators they can purchase.
                DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)
                                                    UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, thisGuild });
                tradeWindow.MerchantItems = GetLocatorDevices(holyCount, RankLocatorCosts[thisGuild.Rank]);
                DaggerfallUI.UIManager.PushWindow(tradeWindow);

                if (thisGuild.Rank < 6)
                {
                    tradeWindow.OnTrade += LocatorPurchase_OnTrade;
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager, window, true);
                    string[]             message    =
                    {
                        "We require that you provide the guild with either a holy tome",
                        "   or holy dagger for each locator device we supply you.",
                        " At least until you reach the more senior ranks of the guild.",              "",
                        "  You currently have " + holyCount + " holy items in your posession, so you",
                        "    can purchase up to that many locators at this time.",
                    };
                    messageBox.SetText(message);
                    messageBox.ClickAnywhereToClose = true;
                    messageBox.Show();
                }
            }
            else
            {
                DaggerfallUI.MessageBox(new string[] {
                    "You need to provide the guild either a holy tome or holy dagger",
                    " for each locator device we supply you with. You have neither."
                });
            }
        }
 void BuyShipButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     if (DaggerfallBankManager.OwnsShip)
     {
         GeneratePopup(TransactionResult.ALREADY_OWN_SHIP);
     }
     else if (GameManager.Instance.PlayerGPS.CurrentLocation.Exterior.ExteriorData.PortTownAndUnknown == 0)
     {
         GeneratePopup(TransactionResult.NOT_PORT_TOWN);
     }
     else    // Show ships for sale
     {
         uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.BankPurchasePopup, new object[] { uiManager, this, null }));
     }
 }
Exemplo n.º 8
0
        public static void LocatorService(IUserInterfaceWindow window)
        {
            // Get the guild instance.
            IGuild thisGuild = GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.GGroup0);

            // Check how many holy items the player has and offer that many discounted.
            PlayerEntity playerEntity        = GameManager.Instance.PlayerEntity;
            List <DaggerfallUnityItem> tomes = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome);

            tomes.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_tome));
            List <DaggerfallUnityItem> daggers = playerEntity.Items.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger);

            daggers.AddRange(playerEntity.WagonItems.SearchItems(ItemGroups.ReligiousItems, (int)ReligiousItems.Holy_dagger));
            int holyCount = tomes.Count + daggers.Count;

            // Show trade window and a popup message to inform player how many discounted locators they can purchase.
            DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)
                                                UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, thisGuild });

            tradeWindow.MerchantItems = GetLocatorDevices(holyCount, RankLocatorCosts[thisGuild.Rank]);
            DaggerfallUI.UIManager.PushWindow(tradeWindow);
            tradeWindow.OnTrade += LocatorPurchase_OnTrade;

            if (thisGuild.Rank < 8)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager, window);
                string[]             message    =
                {
                    "   If you can supply the guild with either a holy tome or holy dagger,",
                    "  then we can sell locator devices at a third of normal price per relic.",
                    "    Locator prices will reduce as you gain higher ranks in the guild.",
                    "",
                    "      You currently have " + holyCount + " holy relics in your posession, so you can",
                    "     purchase up to that many discounted locators at this time.",
                    "",
                    "   I also have a Scarab of Quiet Undead for sale that will help if you",
                    "  find you're having trouble with undead monstrosities in the field.",
                };
                if (holyCount == 0)
                {
                    message[4] = "       You don't have any holy relics with you right now, so";
                    message[5] = "     unfortunately we can't offer you any discounts this time.";
                }
                messageBox.SetText(message);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
        }
Exemplo n.º 9
0
 private void SellButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     Debug.Log("Sell");
     DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
     if (!guild.CanAccessService(Services.GetService(npcService)))
     {
         DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
         msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(DaggerfallGuildServicePopupWindow.InsufficientRankId));
         msgBox.ClickAnywhereToClose = true;
         msgBox.Show();
     }
     else
     {
         CloseWindow();
         uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.SellMagic, guild }));
     }
 }
Exemplo n.º 10
0
        public override void Start(EntityEffectManager manager, DaggerfallEntityBehaviour caster = null)
        {
            base.Start(manager, caster);

            // Refund spell point cost for this effect before opening trade window
            // Actual spell point cost is applied when player clicks Identify button in trade window
            // Any other effects bundled with identify on spell will not have their spell point cost refunded
            FormulaHelper.SpellCost cost = FormulaHelper.CalculateEffectCosts(this, settings, caster.Entity);
            caster.Entity.IncreaseMagicka(cost.spellPointCost);

            // Open identify trade window in spell mode
            UserInterfaceManager  uiManager   = DaggerfallUI.UIManager as UserInterfaceManager;
            DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, null, DaggerfallTradeWindow.WindowModes.Identify, null });

            tradeWindow.UsingIdentifySpell  = true;
            tradeWindow.IdentifySpellChance = ChanceValue();
            tradeWindow.IdentifySpellCost   = cost.spellPointCost;
            uiManager.PushWindow(tradeWindow);
        }
Exemplo n.º 11
0
        void ProgressDisease()
        {
            const string dreamVideoName = "ANIM0002.VID";   // Lycanthropy dream video

            // Do nothing if not incumbent or effect ended
            if (!IsIncumbent || forcedRoundsRemaining == 0 || daysOfSymptomsLeft == completedDiseaseValue)
            {
                return;
            }

            // Get current day and number of days that have passed (e.g. fast travel can progress time several days)
            uint currentDay = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime() / DaggerfallDateTime.MinutesPerDay;
            int  daysPast   = (int)(currentDay - startingDay);

            // Show dream after 1 day has passed, progress to full-blown lycanthropy after 3 days have passed
            if (daysPast > 0 && !warningDreamVideoScheduled && !warningDreamVideoPlayed)
            {
                // Play infection warning dream video
                DaggerfallVidPlayerWindow vidPlayerWindow = (DaggerfallVidPlayerWindow)
                                                            UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { DaggerfallUI.UIManager, dreamVideoName });
                vidPlayerWindow.EndOnAnyKey = false;
                DaggerfallUI.UIManager.PushWindow(vidPlayerWindow);
                vidPlayerWindow.OnClose   += WarningDreamVideoCompleted;
                warningDreamVideoScheduled = true;
            }
            else if (daysPast > 3 && warningDreamVideoPlayed && !deployedFullBlownLycanthropy)
            {
                // Assign Lycanthropy spell to spellbook
                GameManager.Instance.PlayerEntity.AssignPlayerLycanthropySpell();

                // Deploy full-blown lycanthropy
                DeployFullBlownLycanthropy();
                deployedFullBlownLycanthropy = true;

                // Terminate custom disease lifecycle
                EndDisease();
            }
        }
Exemplo n.º 12
0
        void ProgressDisease()
        {
            const string dreamVideoName = "ANIM0004.VID";   // Vampire dream video
            const string deathVideoName = "ANIM0012.VID";   // Death video

            // Do nothing if not incumbent or effect ended
            if (!IsIncumbent || forcedRoundsRemaining == 0 || daysOfSymptomsLeft == completedDiseaseValue)
            {
                return;
            }

            // Get current day and number of days that have passed (e.g. fast travel can progress time several days)
            uint currentDay = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime() / DaggerfallDateTime.MinutesPerDay;
            int  daysPast   = (int)(currentDay - startingDay);

            // Show dream after 1 day has passed, progress to full-blown vampirism after 3 days have passed
            if (daysPast > 0 && !warningDreamVideoScheduled && !warningDreamVideoPlayed)
            {
                // Play infection warning dream video
                DaggerfallVidPlayerWindow vidPlayerWindow = (DaggerfallVidPlayerWindow)
                                                            UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { DaggerfallUI.UIManager, dreamVideoName });
                vidPlayerWindow.EndOnAnyKey = false;
                DaggerfallUI.UIManager.PushWindow(vidPlayerWindow);
                vidPlayerWindow.OnClose   += WarningDreamVideoCompleted;
                warningDreamVideoScheduled = true;
            }
            else if (daysPast > 3 && warningDreamVideoPlayed && !fakeDeathVideoPlayed)
            {
                // Play "death" video ahead of final stage of infection
                DaggerfallVidPlayerWindow vidPlayerWindow = (DaggerfallVidPlayerWindow)
                                                            UIWindowFactory.GetInstanceWithArgs(UIWindowType.VidPlayer, new object[] { DaggerfallUI.UIManager, deathVideoName });
                vidPlayerWindow.EndOnAnyKey = false;
                DaggerfallUI.UIManager.PushWindow(vidPlayerWindow);
                vidPlayerWindow.OnClose += DeployFullBlownVampirism;
                fakeDeathVideoPlayed     = true;
            }
        }
Exemplo n.º 13
0
        public static void CustomArmorService(IUserInterfaceWindow window)
        {
            Debug.Log("Custom Armor service.");

            PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
            ItemHelper   itemHelper   = DaggerfallUnity.Instance.ItemHelper;

            if (playerEntity.Level < 9)
            {
                DaggerfallUI.MessageBox("Sorry I have not yet sourced enough rare materials to make you armor.");
                return;
            }
            ItemCollection armorItems = new ItemCollection();
            Array          armorTypes = itemHelper.GetEnumArray(ItemGroups.Armor);

            foreach (ArmorMaterialTypes material in customArmorMaterials)
            {
                if (playerEntity.Level < 9 ||
                    (playerEntity.Level < 12 && material >= ArmorMaterialTypes.Adamantium) ||
                    (playerEntity.Level < 15 && material >= ArmorMaterialTypes.Orcish) ||
                    (playerEntity.Level < 18 && material >= ArmorMaterialTypes.Daedric))
                {
                    break;
                }

                for (int i = 0; i < armorTypes.Length; i++)
                {
                    Armor        armorType    = (Armor)armorTypes.GetValue(i);
                    ItemTemplate itemTemplate = itemHelper.GetItemTemplate(ItemGroups.Armor, i);
                    int          vs           = 0;
                    int          vf           = 0;
                    switch (armorType)
                    {
                    case Armor.Cuirass:
                    case Armor.Left_Pauldron:
                    case Armor.Right_Pauldron:
                        vs = 1;
                        vf = 3;
                        break;

                    case Armor.Greaves:
                        vs = 2;
                        vf = 5;
                        break;

                    case Armor.Gauntlets:
                        vs = 1;
                        vf = 1;
                        break;

                    case Armor.Boots:
                    case Armor.Helm:
                        vs = 1;
                        vf = itemTemplate.variants - 1;
                        break;

                    default:
                        continue;
                    }
                    for (int v = vs; v <= vf; v++)
                    {
                        armorItems.AddItem(ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, armorType, material, v));
                    }
                }
                int[] customItemTemplates = itemHelper.GetCustomItemsForGroup(ItemGroups.Armor);
                for (int i = 0; i < customItemTemplates.Length; i++)
                {
                    DaggerfallUnityItem item = ItemBuilder.CreateItem(ItemGroups.Armor, customItemTemplates[i]);
                    ItemBuilder.ApplyArmorSettings(item, playerEntity.Gender, playerEntity.Race, material);
                    armorItems.AddItem(item);
                }
            }

            DaggerfallTradeWindow tradeWindow = (DaggerfallTradeWindow)
                                                UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { DaggerfallUI.UIManager, null, DaggerfallTradeWindow.WindowModes.Buy, null });

            tradeWindow.MerchantItems = armorItems;
            DaggerfallUI.UIManager.PushWindow(tradeWindow);
        }