Exemplo n.º 1
0
        private IntegerVariableComparison GetNumericVariableComparison()
        {
            var comp = new IntegerVariableComparison();

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

            comp.Comparator = (VariableComparators)cmbNumericComparitor.SelectedIndex;

            comp.CompareVariableId = Guid.Empty;

            if (rdoVarCompareStaticValue.Checked)
            {
                comp.Value = (long)nudVariableValue.Value;
            }
            else if (rdoVarCompareGlobalVar.Checked)
            {
                comp.CompareVariableType = VariableTypes.ServerVariable;
                comp.CompareVariableId   = ServerVariableBase.IdFromList(cmbCompareGlobalVar.SelectedIndex);
            }
            else if (rdoVarComparePlayerVar.Checked)
            {
                comp.CompareVariableType = VariableTypes.PlayerVariable;
                comp.CompareVariableId   = PlayerVariableBase.IdFromList(cmbComparePlayerVar.SelectedIndex);
            }

            return(comp);
        }
Exemplo n.º 2
0
        private void SaveFormValues(VariableIsCondition condition)
        {
            if (rdoGlobalVariable.Checked)
            {
                condition.VariableType = VariableTypes.ServerVariable;
                condition.VariableId   = ServerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }
            else
            {
                condition.VariableType = VariableTypes.PlayerVariable;
                condition.VariableId   = PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }

            if (grpBooleanVariable.Visible)
            {
                condition.Comparison = GetBooleanVariableComparison();
            }
            else if (grpNumericVariable.Visible)
            {
                condition.Comparison = GetNumericVariableComparison();
            }
            else if (grpStringVariable.Visible)
            {
                condition.Comparison = GetStringVariableComparison();
            }
            else
            {
                condition.Comparison = new VariableCompaison();
            }
        }
Exemplo n.º 3
0
        private BooleanVariableComparison GetBooleanVariableComparison()
        {
            var comp = new BooleanVariableComparison();

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

            comp.ComparingEqual = !Convert.ToBoolean(cmbBooleanComparator.SelectedIndex);

            comp.Value = optBooleanTrue.Checked;

            if (optBooleanGlobalVariable.Checked)
            {
                comp.CompareVariableType = VariableTypes.ServerVariable;
                comp.CompareVariableId   = ServerVariableBase.IdFromList(cmbBooleanGlobalVariable.SelectedIndex);
            }
            else if (optBooleanPlayerVariable.Checked)
            {
                comp.CompareVariableType = VariableTypes.PlayerVariable;
                comp.CompareVariableId   = PlayerVariableBase.IdFromList(cmbBooleanPlayerVariable.SelectedIndex);
            }

            return(comp);
        }
        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
                        );
                }
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int n;

            if (rdoPlayerVariable.Checked)
            {
                mMyCommand.VariableType = VariableTypes.PlayerVariable;
                mMyCommand.VariableId   = PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }

            if (rdoGlobalVariable.Checked)
            {
                mMyCommand.VariableType = VariableTypes.ServerVariable;
                mMyCommand.VariableId   = ServerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }

            if (grpNumericVariable.Visible)
            {
                mMyCommand.Modification = GetNumericVariableMod();
            }
            else if (grpBooleanVariable.Visible)
            {
                mMyCommand.Modification = GetBooleanVariableMod();
            }
            else if (grpStringVariable.Visible)
            {
                mMyCommand.Modification = GetStringVariableMod();
            }
            else
            {
                if (mMyCommand.Modification == null)
                {
                    mMyCommand.Modification = new BooleanVariableMod();
                }
                else
                {
                    if (mMyCommand.Modification.GetType() == typeof(BooleanVariableMod))
                    {
                        mMyCommand.Modification = GetBooleanVariableMod();
                    }
                    else if (mMyCommand.Modification.GetType() == typeof(IntegerVariableMod))
                    {
                        mMyCommand.Modification = GetNumericVariableMod();
                    }
                }
            }

            mMyCommand.SyncParty = chkSyncParty.Checked;

            mEventEditor.FinishCommandEdit();
        }
 private void cmbVariable_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (rdoPlayerVariables.Checked)
     {
         UpdateMinMaxValues(
             PlayerVariableBase.Get(PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex)).Type
             );
     }
     else
     {
         UpdateMinMaxValues(
             ServerVariableBase.Get(ServerVariableBase.IdFromList(cmbVariable.SelectedIndex)).Type
             );
     }
 }
Exemplo n.º 7
0
        private void cmbVariable_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (mLoading)
            {
                return;
            }

            if (rdoPlayerVariable.Checked)
            {
                InitVariableElements(PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex));
            }
            else if (rdoGlobalVariable.Checked)
            {
                InitVariableElements(ServerVariableBase.IdFromList(cmbVariable.SelectedIndex));
            }

            UpdateVariableElements();
        }
Exemplo n.º 8
0
        private BooleanVariableMod GetBooleanVariableMod()
        {
            var mod = new BooleanVariableMod();

            mod.Value = optBooleanTrue.Checked;

            if (optBooleanClonePlayerVar.Checked)
            {
                mod.DupVariableType     = VariableTypes.PlayerVariable;
                mod.DuplicateVariableId = PlayerVariableBase.IdFromList(cmbBooleanClonePlayerVar.SelectedIndex);
            }
            else if (optBooleanCloneGlobalVar.Checked)
            {
                mod.DupVariableType     = VariableTypes.ServerVariable;
                mod.DuplicateVariableId = ServerVariableBase.IdFromList(cmbBooleanCloneGlobalVar.SelectedIndex);
            }

            return(mod);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            mMyCommand.Text    = txtText.Text;
            mMyCommand.Title   = txtTitle.Text;
            mMyCommand.Maximum = (int)nudMaxVal.Value;
            mMyCommand.Minimum = (int)nudMinVal.Value;

            if (rdoPlayerVariables.Checked)
            {
                mMyCommand.VariableType = Enums.VariableTypes.PlayerVariable;
                mMyCommand.VariableId   = PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }
            else
            {
                mMyCommand.VariableType = Enums.VariableTypes.ServerVariable;
                mMyCommand.VariableId   = ServerVariableBase.IdFromList(cmbVariable.SelectedIndex);
            }

            mEventEditor.FinishCommandEdit();
        }
Exemplo n.º 10
0
        private IntegerVariableMod GetNumericVariableMod()
        {
            var mod = new IntegerVariableMod();

            if (optNumericSet.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.Set;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericAdd.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.Add;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericSubtract.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.Subtract;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericMultiply.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.Multiply;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericDivide.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.Divide;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericLeftShift.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.LeftShift;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericRightShift.Checked && optNumericStaticVal.Checked)
            {
                mod.ModType = VariableMods.RightShift;
                mod.Value   = (int)nudNumericValue.Value;
            }
            else if (optNumericRandom.Checked)
            {
                mod.ModType   = VariableMods.Random;
                mod.Value     = (int)nudLow.Value;
                mod.HighValue = (int)nudHigh.Value;
                if (mod.HighValue < mod.Value)
                {
                    var n = mod.Value;
                    mod.Value     = mod.HighValue;
                    mod.HighValue = n;
                }
            }
            else if (optNumericSystemTime.Checked)
            {
                mod.ModType = VariableMods.SystemTime;
            }
            else if (optNumericClonePlayerVar.Checked)
            {
                if (optNumericSet.Checked)
                {
                    mod.ModType = VariableMods.DupPlayerVar;
                }
                else if (optNumericAdd.Checked)
                {
                    mod.ModType = VariableMods.AddPlayerVar;
                }
                else if (optNumericSubtract.Checked)
                {
                    mod.ModType = VariableMods.SubtractPlayerVar;
                }
                else if (optNumericMultiply.Checked)
                {
                    mod.ModType = VariableMods.MultiplyPlayerVar;
                }
                else if (optNumericDivide.Checked)
                {
                    mod.ModType = VariableMods.DividePlayerVar;
                }
                else if (optNumericLeftShift.Checked)
                {
                    mod.ModType = VariableMods.LeftShiftPlayerVar;
                }
                else
                {
                    mod.ModType = VariableMods.RightShiftPlayerVar;
                }

                mod.DuplicateVariableId = PlayerVariableBase.IdFromList(cmbNumericClonePlayerVar.SelectedIndex);
            }
            else if (optNumericCloneGlobalVar.Checked)
            {
                if (optNumericSet.Checked)
                {
                    mod.ModType = VariableMods.DupGlobalVar;
                }
                else if (optNumericAdd.Checked)
                {
                    mod.ModType = VariableMods.AddGlobalVar;
                }
                else if (optNumericSubtract.Checked)
                {
                    mod.ModType = VariableMods.SubtractGlobalVar;
                }
                else if (optNumericMultiply.Checked)
                {
                    mod.ModType = VariableMods.MultiplyGlobalVar;
                }
                else if (optNumericDivide.Checked)
                {
                    mod.ModType = VariableMods.DivideGlobalVar;
                }
                else if (optNumericLeftShift.Checked)
                {
                    mod.ModType = VariableMods.LeftShiftGlobalVar;
                }
                else
                {
                    mod.ModType = VariableMods.RightShiftGlobalVar;
                }

                mod.DuplicateVariableId = ServerVariableBase.IdFromList(cmbNumericCloneGlobalVar.SelectedIndex);
            }

            return(mod);
        }
Exemplo n.º 11
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);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            mMyCommand.Add          = !Convert.ToBoolean(cmbAction.SelectedIndex);
            mMyCommand.ItemId       = ItemBase.IdFromList(cmbItem.SelectedIndex);
            mMyCommand.VariableType = rdoPlayerVariable.Checked ? VariableTypes.PlayerVariable : VariableTypes.ServerVariable;
            mMyCommand.UseVariable  = !rdoManual.Checked;
            mMyCommand.VariableId   = rdoPlayerVariable.Checked ? PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex, VariableDataTypes.Integer) : ServerVariableBase.IdFromList(cmbVariable.SelectedIndex, VariableDataTypes.Integer);

            mMyCommand.Quantity     = (int)nudGiveTakeAmount.Value;
            mMyCommand.ItemHandling = (ItemHandling)cmbMethod.SelectedIndex;
            mEventEditor.FinishCommandEdit();
        }
Exemplo n.º 13
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     mMyCommand.Exp          = (long)nudExperience.Value;
     mMyCommand.VariableType = rdoPlayerVariable.Checked ? VariableTypes.PlayerVariable : VariableTypes.ServerVariable;
     mMyCommand.UseVariable  = !rdoManual.Checked;
     mMyCommand.VariableId   = rdoPlayerVariable.Checked ? PlayerVariableBase.IdFromList(cmbVariable.SelectedIndex, VariableDataTypes.Integer) : ServerVariableBase.IdFromList(cmbVariable.SelectedIndex, VariableDataTypes.Integer);
     mEventEditor.FinishCommandEdit();
 }