private void SetupAmountInput()
        {
            grpManualAmount.Visible   = rdoManual.Checked;
            grpVariableAmount.Visible = !rdoManual.Checked;

            cmbVariable.Items.Clear();
            if (rdoPlayerVariable.Checked)
            {
                cmbVariable.Items.AddRange(PlayerVariableBase.GetNamesByType(VariableDataTypes.Integer));
                // Do not update if the wrong type of variable is saved
                if (mMyCommand.VariableType == VariableTypes.PlayerVariable)
                {
                    var index = PlayerVariableBase.ListIndex(mMyCommand.VariableId, VariableDataTypes.Integer);
                    if (index > -1)
                    {
                        cmbVariable.SelectedIndex = index;
                    }
                    else
                    {
                        VariableBlank();
                    }
                }
                else
                {
                    VariableBlank();
                }
            }
            else
            {
                cmbVariable.Items.AddRange(ServerVariableBase.GetNamesByType(VariableDataTypes.Integer));
                // Do not update if the wrong type of variable is saved
                if (mMyCommand.VariableType == VariableTypes.ServerVariable)
                {
                    var index = ServerVariableBase.ListIndex(mMyCommand.VariableId, VariableDataTypes.Integer);
                    if (index > -1)
                    {
                        cmbVariable.SelectedIndex = index;
                    }
                    else
                    {
                        VariableBlank();
                    }
                }
                else
                {
                    VariableBlank();
                }
            }

            nudGiveTakeAmount.Value = Math.Max(1, mMyCommand.Quantity);
        }
 private void SetupAmountInput()
 {
     cmbVariable.Items.Clear();
     if (rdoPlayerVariable.Checked)
     {
         cmbVariable.Items.AddRange(PlayerVariableBase.GetNamesByType(VariableDataTypes.Integer));
         // Do not update if the wrong type of variable is saved
         if (mMyCommand.VariableType == VariableTypes.PlayerVariable)
         {
             var index = PlayerVariableBase.ListIndex(mMyCommand.VariableId, VariableDataTypes.Integer);
             if (index > -1)
             {
                 cmbVariable.SelectedIndex = index;
             }
             else
             {
                 VariableBlank();
             }
         }
         else
         {
             VariableBlank();
         }
     }
     else
     {
         cmbVariable.Items.AddRange(ServerVariableBase.GetNamesByType(VariableDataTypes.Integer));
         // Do not update if the wrong type of variable is saved
         if (mMyCommand.VariableType == VariableTypes.ServerVariable)
         {
             var index = ServerVariableBase.ListIndex(mMyCommand.VariableId, VariableDataTypes.Integer);
             if (index > -1)
             {
                 cmbVariable.SelectedIndex = index;
             }
             else
             {
                 VariableBlank();
             }
         }
         else
         {
             VariableBlank();
         }
     }
 }
Exemple #3
0
        private void SetupAmountInput()
        {
            grpManualAmount.Visible   = rdoManual.Checked;
            grpVariableAmount.Visible = !rdoManual.Checked;

            VariableTypes conditionVariableType;
            Guid          conditionVariableId;
            int           ConditionQuantity;

            switch (Condition.Type)
            {
            case ConditionTypes.HasFreeInventorySlots:
                conditionVariableType = ((HasFreeInventorySlots)Condition).VariableType;
                conditionVariableId   = ((HasFreeInventorySlots)Condition).VariableId;
                ConditionQuantity     = ((HasFreeInventorySlots)Condition).Quantity;
                break;

            case ConditionTypes.HasItem:
                conditionVariableType = ((HasItemCondition)Condition).VariableType;
                conditionVariableId   = ((HasItemCondition)Condition).VariableId;
                ConditionQuantity     = ((HasItemCondition)Condition).Quantity;
                break;

            default:
                conditionVariableType = VariableTypes.PlayerVariable;
                conditionVariableId   = Guid.Empty;
                ConditionQuantity     = 0;
                return;
            }

            cmbInvVariable.Items.Clear();
            if (rdoInvPlayerVariable.Checked)
            {
                cmbInvVariable.Items.AddRange(PlayerVariableBase.GetNamesByType(VariableDataTypes.Integer));
                // Do not update if the wrong type of variable is saved
                if (conditionVariableType == VariableTypes.PlayerVariable)
                {
                    var index = PlayerVariableBase.ListIndex(conditionVariableId, VariableDataTypes.Integer);
                    if (index > -1)
                    {
                        cmbInvVariable.SelectedIndex = index;
                    }
                    else
                    {
                        VariableBlank();
                    }
                }
                else
                {
                    VariableBlank();
                }
            }
            else
            {
                cmbInvVariable.Items.AddRange(ServerVariableBase.GetNamesByType(VariableDataTypes.Integer));
                // Do not update if the wrong type of variable is saved
                if (conditionVariableType == VariableTypes.ServerVariable)
                {
                    var index = ServerVariableBase.ListIndex(conditionVariableId, VariableDataTypes.Integer);
                    if (index > -1)
                    {
                        cmbInvVariable.SelectedIndex = index;
                    }
                    else
                    {
                        VariableBlank();
                    }
                }
                else
                {
                    VariableBlank();
                }
            }

            nudItemAmount.Value = Math.Max(1, ConditionQuantity);
        }