Пример #1
0
        public static bool MeetsCondition(
            HasFreeInventorySlots condition,
            Player player,
            Event eventInstance,
            QuestBase questBase
            )
        {
            var quantity = condition.Quantity;

            if (condition.UseVariable)
            {
                switch (condition.VariableType)
                {
                case VariableTypes.PlayerVariable:
                    quantity = (int)player.GetVariableValue(condition.VariableId).Integer;

                    break;

                case VariableTypes.ServerVariable:
                    quantity = (int)ServerVariableBase.Get(condition.VariableId)?.Value.Integer;
                    break;
                }
            }

            // Check if the user has (or does not have when negated) the desired amount of inventory slots.
            var slots = player.FindOpenInventorySlots().Count;

            if ((!condition.Negated && slots >= quantity) || (condition.Negated && slots < quantity))
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
 private void SaveFormValues(HasFreeInventorySlots condition)
 {
     condition.Quantity     = (int)nudItemAmount.Value;
     condition.VariableType = rdoInvPlayerVariable.Checked ? VariableTypes.PlayerVariable : VariableTypes.ServerVariable;
     condition.UseVariable  = !rdoManual.Checked;
     condition.VariableId   = rdoInvPlayerVariable.Checked ? PlayerVariableBase.IdFromList(cmbInvVariable.SelectedIndex) : ServerVariableBase.IdFromList(cmbInvVariable.SelectedIndex);
 }
Пример #3
0
 private void SetupFormValues(HasFreeInventorySlots condition)
 {
     nudItemAmount.Value          = condition.Quantity;
     rdoVariable.Checked          = condition.UseVariable;
     rdoInvGlobalVariable.Checked = condition.VariableType == VariableTypes.ServerVariable;
     SetupAmountInput();
 }
Пример #4
0
        public static bool MeetsCondition(
            HasFreeInventorySlots condition,
            Player player,
            Event eventInstance,
            QuestBase questBase
            )
        {
            // Check if the user has (or does not have when negated) the desired amount of inventory slots.
            var slots = player.FindOpenInventorySlots().Count;

            if ((!condition.Negated && slots >= condition.Quantity) || (condition.Negated && slots < condition.Quantity))
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
 private void SaveFormValues(HasFreeInventorySlots condition)
 {
     condition.Quantity = (int)nudFreeInventorySlots.Value;
 }
Пример #6
0
 private void SetupFormValues(HasFreeInventorySlots condition)
 {
     nudFreeInventorySlots.Value = condition.Quantity;
 }