コード例 #1
0
 protected virtual void AddToCauldron(DaggerfallUnityItem item)
 {
     if (cauldron.Count < 8)
     {
         nameLabel.Text = "";
         if (item.IsAStack())
         {
             item = ingredients.SplitStack(item, 1);
         }
         cauldron.Add(item);
         ingredients.RemoveItem(item);
         RefreshIngredientsList();
         ingredientsListScroller.Items = ingredientsList;
         cauldronListScroller.Items    = cauldron;
     }
 }
コード例 #2
0
 protected override void RemoteItemListScroller_OnItemClick(DaggerfallUnityItem item)
 {
     // Handle click based on action
     if (selectedActionMode == ActionModes.Select)
     {
         int canCarry = CanCarryAmount(item);
         if (usingWagon)
         {
             canCarry = Math.Max(canCarry, WagonCanHoldAmount(item));
         }
         if (windowMode == WindowModes.Buy)
         {
             TransferItem(item, remoteItems, basketItems, canCarry, equip: !item.IsAStack());
         }
         else
         {
             TransferItem(item, remoteItems, localItems, canCarry);
         }
     }
     else if (selectedActionMode == ActionModes.Info)
     {
         ShowInfoPopup(item);
     }
 }
コード例 #3
0
 protected override void RemoteItemListScroller_OnItemClick(DaggerfallUnityItem item)
 {
     // Handle click based on action
     if (selectedActionMode == ActionModes.Select)
     {
         if (windowMode == WindowModes.Buy)
         {
             TransferItem(item, remoteItems, basketItems, CanCarryAmount(item), equip: !item.IsAStack());
         }
         else if (windowMode == WindowModes.Repair)
         {
             if (item.RepairData.IsBeingRepaired() && !item.RepairData.IsRepairFinished())
             {
                 itemBeingRepaired = item;
                 string strInterruptRepair = TextManager.Instance.GetText(textDatabase, "interruptRepair");
                 DaggerfallMessageBox confirmInterruptRepairBox = new DaggerfallMessageBox(uiManager, DaggerfallMessageBox.CommonMessageBoxButtons.YesNo, strInterruptRepair, this);
                 confirmInterruptRepairBox.OnButtonClick += ConfirmInterruptRepairBox_OnButtonClick;
                 confirmInterruptRepairBox.Show();
             }
             else
             {
                 TakeItemFromRepair(item);
             }
         }
         else
         {
             TransferItem(item, remoteItems, localItems, usingWagon ? WagonCanHoldAmount(item) : CanCarryAmount(item), blockTransport: usingWagon);
         }
     }
     else if (selectedActionMode == ActionModes.Info)
     {
         ShowInfoPopup(item);
     }
 }
コード例 #4
0
        protected override void LocalItemListScroller_OnItemClick(DaggerfallUnityItem item)
        {
            // Handle click based on action & mode
            if (selectedActionMode == ActionModes.Select)
            {
                switch (windowMode)
                {
                case WindowModes.Sell:
                case WindowModes.SellMagic:
                    if (remoteItems != null)
                    {
                        // Are we trying to sell the non empty wagon?
                        if (item.ItemGroup == ItemGroups.Transportation && PlayerEntity.WagonItems.Count > 0)
                        {
                            DaggerfallUnityItem usedWagon = PlayerEntity.Items.GetItem(ItemGroups.Transportation, (int)Transportation.Small_cart);
                            if (usedWagon.Equals(item))
                            {
                                return;
                            }
                        }
                        TransferItem(item, localItems, remoteItems);
                    }
                    break;

                case WindowModes.Buy:
                    if (usingWagon)         // Allows player to get & equip stuff from cart while purchasing.
                    {
                        TransferItem(item, localItems, PlayerEntity.Items, CanCarryAmount(item), equip: !item.IsAStack());
                    }
                    else                    // Allows player to equip and unequip while purchasing.
                    {
                        EquipItem(item);
                    }
                    break;

                case WindowModes.Repair:
                    // Check that item can be repaired, is damaged & transfer if so.
                    if (item.IsEnchanted && !DaggerfallUnity.Settings.AllowMagicRepairs)
                    {
                        DaggerfallUI.MessageBox(magicItemsCannotBeRepairedTextId);
                    }
                    else if ((item.currentCondition < item.maxCondition) && item.TemplateIndex != (int)Weapons.Arrow)
                    {
                        TransferItem(item, localItems, remoteItems);
                        // UpdateRepairTimes(false);
                    }
                    else
                    {
                        DaggerfallUI.MessageBox(doesNotNeedToBeRepairedTextId);
                    }
                    break;

                case WindowModes.Identify:
                    // Check if item is unidentified & transfer
                    if (!item.IsIdentified)
                    {
                        TransferItem(item, localItems, remoteItems);
                    }
                    else
                    {
                        DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "doesntNeedIdentify"));
                    }
                    break;
                }
            }
            else if (selectedActionMode == ActionModes.Info)
            {
                ShowInfoPopup(item);
            }
        }
コード例 #5
0
        private void EnchantButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            const int notEnoughGold             = 1650;
            const int notEnoughEnchantmentPower = 1651;
            const int itemEnchanted             = 1652;
            const int itemMustBeSelected        = 1653;

            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);

            // Must have an item selected or display "An item must be selected to be enchanted."
            if (selectedItem == null)
            {
                DaggerfallUI.MessageBox(itemMustBeSelected);
                return;
            }

            // Must have enchantments to apply or display "You have not prepared enchantments for this item."
            if (powersList.EnchantmentCount == 0 && sideEffectsList.EnchantmentCount == 0)
            {
                DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "noEnchantments"));
                return;
            }

            // Get costs
            int totalEnchantmentCost = GetTotalEnchantmentCost();
            int totalGoldCost        = GetTotalGoldCost();
            int itemEnchantmentPower = selectedItem.GetEnchantmentPower();

            // Check for available gold and display "You do not have the gold to properly pay the enchanter." if not enough
            int playerGold = GameManager.Instance.PlayerEntity.GetGoldAmount();

            if (playerGold < totalGoldCost)
            {
                DaggerfallUI.MessageBox(notEnoughGold);
                return;
            }

            // Check for enchantment power and display "You cannot enchant this item beyond its limit." if not enough
            if (itemEnchantmentPower < totalEnchantmentCost)
            {
                DaggerfallUI.MessageBox(notEnoughEnchantmentPower);
                return;
            }

            // Deduct gold from player and display "The item has been enchanted."
            GameManager.Instance.PlayerEntity.DeductGoldAmount(totalGoldCost);
            DaggerfallUI.MessageBox(itemEnchanted);

            // Only enchant one item from stack
            if (selectedItem.IsAStack())
            {
                selectedItem = GameManager.Instance.PlayerEntity.Items.SplitStack(selectedItem, 1);
            }

            // Transfer enchantment settings onto item
            List <EnchantmentSettings> combinedEnchantments = new List <EnchantmentSettings>();

            combinedEnchantments.AddRange(powersList.GetEnchantments());
            combinedEnchantments.AddRange(sideEffectsList.GetEnchantments());
            selectedItem.SetEnchantments(combinedEnchantments.ToArray(), GameManager.Instance.PlayerEntity);
            selectedItem.RenameItem(itemNameLabel.Text);

            // Play enchantment sound effect
            DaggerfallUI.Instance.PlayOneShot(SoundClips.MakeItem);

            // Clear selected item and enchantments
            selectedItem = null;
            powersList.ClearEnchantments();
            sideEffectsList.ClearEnchantments();
            Refresh();
        }
コード例 #6
0
        protected override void LocalItemListScroller_OnItemClick(DaggerfallUnityItem item)
        {
            // Handle click based on action & mode
            if (selectedActionMode == ActionModes.Select)
            {
                switch (windowMode)
                {
                case WindowModes.Sell:
                case WindowModes.SellMagic:
                    if (remoteItems != null)
                    {
                        TransferItem(item, localItems, remoteItems);
                    }
                    break;

                case WindowModes.Buy:
                    if (usingWagon)         // Allows player to get & equip stuff from cart while purchasing.
                    {
                        TransferItem(item, localItems, PlayerEntity.Items, CanCarryAmount(item), equip: !item.IsAStack());
                    }
                    else                    // Allows player to equip and unequip while purchasing.
                    {
                        EquipItem(item);
                    }
                    break;

                case WindowModes.Repair:
                    // Check if item is damaged & transfer
                    if ((item.currentCondition < item.maxCondition) && item.TemplateIndex != (int)Weapons.Arrow)
                    {
                        TransferItem(item, localItems, remoteItems);
                    }
                    else
                    {
                        DaggerfallUI.MessageBox(doesNotNeedToBeRepairedTextId);
                    }
                    break;

                case WindowModes.Identify:
                    // Check if item is unidentified & transfer
                    if (!item.IsIdentified)
                    {
                        TransferItem(item, localItems, remoteItems);
                    }
                    else
                    {
                        DaggerfallUI.MessageBox(HardStrings.doesntNeedIdentifying);
                    }
                    break;
                }
            }
            else if (selectedActionMode == ActionModes.Info)
            {
                ShowInfoPopup(item);
            }
        }
コード例 #7
0
        protected override void RemoteItemListScroller_OnItemClick(DaggerfallUnityItem item)
        {
            // Handle click based on action
            if (selectedActionMode == ActionModes.Select)
            {
                if (windowMode == WindowModes.Buy)
                {
                    TransferItem(item, remoteItems, basketItems, CanCarryAmount(item), equip: !item.IsAStack());
                }
                else
                {
                    TransferItem(item, remoteItems, localItems, usingWagon ? WagonCanHoldAmount(item) : CanCarryAmount(item));
                }

                if (windowMode == WindowModes.Repair)
                {
                    item.RepairData.Collect();
                }
            }
            else if (selectedActionMode == ActionModes.Info)
            {
                ShowInfoPopup(item);
            }
        }