Example #1
0
        private void TryLoadStringMod(VariableMod varMod)
        {
            if (varMod == null)
            {
                varMod = new StringVariableMod();
            }

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

                switch (mod.ModType)
                {
                case VariableMods.Set:
                    optStaticString.Checked = true;
                    txtStringValue.Text     = mod.Value;

                    break;

                case VariableMods.Replace:
                    optReplaceString.Checked = true;
                    txtStringFind.Text       = mod.Value;
                    txtStringReplace.Text    = mod.Replace;

                    break;
                }
            }
        }
        private static string GetVariableModText(SetVariableCommand command, StringVariableMod mod)
        {
            var varvalue = "";

            switch (mod.ModType)
            {
            case Enums.VariableMods.Set:
                varvalue = Strings.EventCommandList.setvariable.ToString(mod.Value);

                break;

            case Enums.VariableMods.Replace:
                varvalue = Strings.EventCommandList.replace.ToString(mod.Value, mod.Replace);

                break;
            }

            if (command.VariableType == VariableTypes.PlayerVariable)
            {
                return(Strings.EventCommandList.playervariable.ToString(
                           PlayerVariableBase.GetName(command.VariableId), varvalue
                           ));
            }

            if (command.VariableType == VariableTypes.ServerVariable)
            {
                return(Strings.EventCommandList.globalvariable.ToString(
                           ServerVariableBase.GetName(command.VariableId), varvalue
                           ));
            }

            return(Strings.EventCommandList.invalid);
        }
Example #3
0
        private StringVariableMod GetStringVariableMod()
        {
            var mod = new StringVariableMod();

            if (optStaticString.Checked)
            {
                mod.ModType = VariableMods.Set;
                mod.Value   = txtStringValue.Text;
            }
            else if (optReplaceString.Checked)
            {
                mod.ModType = VariableMods.Replace;
                mod.Value   = txtStringFind.Text;
                mod.Replace = txtStringReplace.Text;
            }

            return(mod);
        }