Пример #1
0
        private void TryLoadVariableIntegerComparison(VariableCompaison comp)
        {
            if (comp.GetType() == typeof(IntegerVariableComparison))
            {
                var com = (IntegerVariableComparison)comp;

                cmbNumericComparitor.SelectedIndex = (int)com.Comparator;

                if (cmbNumericComparitor.SelectedIndex < 0)
                {
                    cmbNumericComparitor.SelectedIndex = 0;
                }

                if (com.CompareVariableId != Guid.Empty)
                {
                    if (com.CompareVariableType == VariableTypes.PlayerVariable)
                    {
                        rdoVarComparePlayerVar.Checked    = true;
                        cmbComparePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(com.CompareVariableId);
                    }
                    else
                    {
                        rdoVarCompareGlobalVar.Checked    = true;
                        cmbCompareGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(com.CompareVariableId);
                    }
                }
                else
                {
                    rdoVarCompareStaticValue.Checked = true;
                    nudVariableValue.Value           = com.Value;
                }

                UpdateNumericVariableElements();
            }
        }
Пример #2
0
        private void TryLoadBooleanMod(VariableMod varMod)
        {
            if (varMod == null)
            {
                varMod = new BooleanVariableMod();
            }

            if (varMod.GetType() == typeof(BooleanVariableMod))
            {
                var mod = (BooleanVariableMod)varMod;

                optBooleanTrue.Checked  = mod.Value;
                optBooleanFalse.Checked = !mod.Value;

                if (mod.DuplicateVariableId != Guid.Empty)
                {
                    if (mod.DupVariableType == VariableTypes.PlayerVariable)
                    {
                        optBooleanClonePlayerVar.Checked       = true;
                        cmbBooleanClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);
                    }
                    else
                    {
                        optBooleanCloneGlobalVar.Checked       = true;
                        cmbBooleanCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);
                    }
                }
            }
        }
Пример #3
0
        private void TryLoadVariableBooleanComparison(VariableCompaison comp)
        {
            if (comp.GetType() == typeof(BooleanVariableComparison))
            {
                var com = (BooleanVariableComparison)comp;

                cmbBooleanComparator.SelectedIndex = Convert.ToInt32(!com.ComparingEqual);

                if (cmbBooleanComparator.SelectedIndex < 0)
                {
                    cmbBooleanComparator.SelectedIndex = 0;
                }

                optBooleanTrue.Checked  = com.Value;
                optBooleanFalse.Checked = !com.Value;

                if (com.CompareVariableId != Guid.Empty)
                {
                    if (com.CompareVariableType == VariableTypes.PlayerVariable)
                    {
                        optBooleanPlayerVariable.Checked       = true;
                        cmbBooleanPlayerVariable.SelectedIndex = PlayerVariableBase.ListIndex(com.CompareVariableId);
                    }
                    else
                    {
                        optBooleanGlobalVariable.Checked       = true;
                        cmbBooleanGlobalVariable.SelectedIndex = ServerVariableBase.ListIndex(com.CompareVariableId);
                    }
                }
            }
        }
        private void LoadVariableList()
        {
            cmbVariable.Items.Clear();
            if (rdoPlayerVariables.Checked)
            {
                cmbVariable.Items.AddRange(PlayerVariableBase.Names);
                cmbVariable.SelectedIndex = PlayerVariableBase.ListIndex(mMyCommand.VariableId);

                if (cmbVariable.SelectedIndex != -1)
                {
                    UpdateMinMaxValues(
                        PlayerVariableBase.Get(PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex)).Type
                        );
                }
            }
            else
            {
                cmbVariable.Items.AddRange(ServerVariableBase.Names);
                cmbVariable.SelectedIndex = ServerVariableBase.ListIndex(mMyCommand.VariableId);

                if (cmbVariable.SelectedIndex != -1)
                {
                    UpdateMinMaxValues(
                        ServerVariableBase.Get(ServerVariableBase.IdFromList(cmbVariable.SelectedIndex)).Type
                        );
                }
            }
        }
        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);
        }
Пример #6
0
        private void InitVariableElements(Guid variableId)
        {
            mLoading = true;
            cmbVariable.Items.Clear();
            if (rdoPlayerVariable.Checked)
            {
                cmbVariable.Items.AddRange(PlayerVariableBase.Names);
                cmbVariable.SelectedIndex = PlayerVariableBase.ListIndex(variableId);
            }
            else
            {
                cmbVariable.Items.AddRange(ServerVariableBase.Names);
                cmbVariable.SelectedIndex = ServerVariableBase.ListIndex(variableId);
            }

            mLoading = false;
        }
 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();
         }
     }
 }
Пример #8
0
        private void InitEditor()
        {
            cmbVariable.Items.Clear();
            var varCount = 0;

            if (rdoPlayerVariable.Checked)
            {
                cmbVariable.Items.AddRange(PlayerVariableBase.Names);
                cmbVariable.SelectedIndex = PlayerVariableBase.ListIndex(mMyCommand.VariableId);
            }
            else
            {
                cmbVariable.Items.AddRange(ServerVariableBase.Names);
                cmbVariable.SelectedIndex = ServerVariableBase.ListIndex(mMyCommand.VariableId);
            }

            chkSyncParty.Checked = mMyCommand.SyncParty;

            UpdateFormElements();
        }
Пример #9
0
        private void TryLoadNumericMod(VariableMod varMod)
        {
            if (varMod == null)
            {
                varMod = new IntegerVariableMod();
            }

            if (varMod.GetType() == typeof(IntegerVariableMod))
            {
                var mod = (IntegerVariableMod)varMod;

                //Should properly seperate static value, player & global vars into a seperate enum.
                //But technical debt :/
                switch (mod.ModType)
                {
                case VariableMods.Set:
                    optNumericSet.Checked       = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Add:
                    optNumericAdd.Checked       = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Subtract:
                    optNumericSubtract.Checked  = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Multiply:
                    optNumericMultiply.Checked  = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Divide:
                    optNumericDivide.Checked    = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.LeftShift:
                    optNumericLeftShift.Checked = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.RightShift:
                    optNumericRightShift.Checked = true;
                    optNumericStaticVal.Checked  = true;
                    nudNumericValue.Value        = mod.Value;

                    break;

                case VariableMods.Random:
                    optNumericRandom.Checked = true;
                    nudLow.Value             = mod.Value;
                    nudHigh.Value            = mod.HighValue;

                    break;

                case VariableMods.SystemTime:
                    optNumericSystemTime.Checked = true;

                    break;

                case VariableMods.DupPlayerVar:
                    optNumericSet.Checked                  = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.DupGlobalVar:
                    optNumericSet.Checked                  = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.AddPlayerVar:
                    optNumericAdd.Checked                  = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.AddGlobalVar:
                    optNumericAdd.Checked                  = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.SubtractPlayerVar:
                    optNumericSubtract.Checked             = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.SubtractGlobalVar:
                    optNumericSubtract.Checked             = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.MultiplyPlayerVar:
                    optNumericMultiply.Checked             = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.MultiplyGlobalVar:
                    optNumericMultiply.Checked             = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.DividePlayerVar:
                    optNumericDivide.Checked               = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.DivideGlobalVar:
                    optNumericDivide.Checked               = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.LeftShiftPlayerVar:
                    optNumericLeftShift.Checked            = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.LeftShiftGlobalVar:
                    optNumericLeftShift.Checked            = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.RightShiftPlayerVar:
                    optNumericRightShift.Checked           = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.RightShiftGlobalVar:
                    optNumericRightShift.Checked           = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;
                }
            }
        }
Пример #10
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);
        }
        private void TryLoadNumericMod(VariableMod varMod)
        {
            if (varMod == null)
            {
                varMod = new IntegerVariableMod();
            }

            if (varMod.GetType() == typeof(IntegerVariableMod))
            {
                var mod = (IntegerVariableMod)varMod;

                switch (mod.ModType)
                {
                case VariableMods.Set:
                    optNumericSet.Checked       = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Add:
                    optNumericAdd.Checked       = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Subtract:
                    optNumericSubtract.Checked  = true;
                    optNumericStaticVal.Checked = true;
                    nudNumericValue.Value       = mod.Value;

                    break;

                case VariableMods.Random:
                    optNumericRandom.Checked = true;
                    nudLow.Value             = mod.Value;
                    nudHigh.Value            = mod.HighValue;

                    break;

                case VariableMods.SystemTime:
                    optNumericSystemTime.Checked = true;

                    break;

                case VariableMods.DupPlayerVar:
                    optNumericSet.Checked                  = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.DupGlobalVar:
                    optNumericSet.Checked                  = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.AddPlayerVar:
                    optNumericAdd.Checked                  = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.AddGlobalVar:
                    optNumericAdd.Checked                  = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.SubtractPlayerVar:
                    optNumericSubtract.Checked             = true;
                    optNumericClonePlayerVar.Checked       = true;
                    cmbNumericClonePlayerVar.SelectedIndex = PlayerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;

                case VariableMods.SubtractGlobalVar:
                    optNumericSubtract.Checked             = true;
                    optNumericCloneGlobalVar.Checked       = true;
                    cmbNumericCloneGlobalVar.SelectedIndex = ServerVariableBase.ListIndex(mod.DuplicateVariableId);

                    break;
                }
            }
        }