Example #1
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);
        }
Example #2
0
        public override void Start(EntityEffectManager manager, DaggerfallEntityBehaviour caster = null)
        {
            base.Start(manager, caster);

            UserInterfaceManager  uiManager   = DaggerfallUI.UIManager as UserInterfaceManager;
            DaggerfallTradeWindow tradeWindow = new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Identify);

            tradeWindow.UsingIdentifySpell = true;
            uiManager.PushWindow(tradeWindow);
        }
        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."
                });
            }
        }
Example #4
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();
            }
        }
Example #5
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);
        }
Example #6
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);
        }