Beispiel #1
0
        public NouseEditDialog(ReadableTuple <int> tuple)
            : base("NoUse edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();

            ToolTipsBuilder.Initialize(new string[] {
                "Cannot use the item while sitting."
            }, this);

            _override = tuple.GetIntNoThrow(ServerItemAttributes.NoUseOverride);
            _flag     = tuple.GetIntNoThrow(ServerItemAttributes.NoUseFlag);

            _cbUpper1.Tag = 1 << 0;

            _boxes.Add(_cbUpper1);

            _tbOverride.Text = tuple.GetIntNoThrow(ServerItemAttributes.NoUseOverride).ToString(CultureInfo.InvariantCulture);
            _eventId         = 0;
            _boxes.ForEach(_addEvents);

            _tbOverride.TextChanged += delegate {
                _update();
            };

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
Beispiel #2
0
        public TradeEditDialog(ReadableTuple <int> tuple) : base("Trade edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();

            ToolTipsBuilder.Initialize(new string[] {
                "Item can't be droped",
                "Item can't be traded (nor vended)",
                "Wedded partner can override restriction 2.",
                "Item can't be sold to npcs",
                "Item can't be placed in the cart",
                "Item can't be placed in the storage",
                "Item can't be placed in the guild storage",
                "Item can't be attached to mail",
                "Item can't be auctioned"
            }, this);

            _flag = tuple.GetIntNoThrow(ServerItemAttributes.TradeFlag);

            _cbUpper1.Tag = 1 << 0;
            _cbUpper2.Tag = 1 << 1;
            _cbUpper3.Tag = 1 << 2;
            _cbUpper4.Tag = 1 << 3;
            _cbUpper5.Tag = 1 << 4;
            _cbUpper6.Tag = 1 << 5;
            _cbUpper7.Tag = 1 << 6;
            _cbUpper8.Tag = 1 << 7;
            _cbUpper9.Tag = 1 << 8;

            _rbMet1.Tag = 467;
            _rbMet2.Tag = 475;
            _rbMet3.Tag = 483;
            _rbMet4.Tag = 491;
            _rbMet5.Tag = 507;

            _boxes.Add(_cbUpper1);
            _boxes.Add(_cbUpper2);
            _boxes.Add(_cbUpper3);
            _boxes.Add(_cbUpper4);
            _boxes.Add(_cbUpper5);
            _boxes.Add(_cbUpper6);
            _boxes.Add(_cbUpper7);
            _boxes.Add(_cbUpper8);
            _boxes.Add(_cbUpper9);

            _radios.Add(_rbMet1);
            _radios.Add(_rbMet2);
            _radios.Add(_rbMet3);
            _radios.Add(_rbMet4);
            _radios.Add(_rbMet5);

            _eventId = 0;

            _boxes.ForEach(_addEvents);
            _radios.ForEach(_addEvents);

            _rbEvents             = true;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
        public ModeEditDialog(string text) : base("Mode edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);
            _value = Extensions.ParseToInt(text);

            ToolTipsBuilder.Initialize(new string[] {
                "Allows the monster to move.",
                "Allows the monster to pick up items on the ground.",
                "Allows the monster to attack nearby players.",
                "Allows the monster to help other monsters of the same type."
            }, this);

            _cbUpper1.Tag  = 1;
            _cbUpper2.Tag  = 2;
            _cbUpper3.Tag  = 4;
            _cbUpper4.Tag  = 8;
            _cbUpper5.Tag  = 16;
            _cbUpper6.Tag  = 32;
            _cbUpper7.Tag  = 64;
            _cbUpper8.Tag  = 128;
            _cbUpper9.Tag  = 256;
            _cbUpper10.Tag = 512;
            _cbUpper11.Tag = 1024;
            _cbUpper12.Tag = 2048;
            _cbUpper13.Tag = 4096;
            _cbUpper14.Tag = 8192;
            _cbUpper15.Tag = 32768;
            _cbUpper16.Tag = 65536;

            _boxes.Add(_cbUpper1);
            _boxes.Add(_cbUpper2);
            _boxes.Add(_cbUpper3);
            _boxes.Add(_cbUpper4);
            _boxes.Add(_cbUpper5);
            _boxes.Add(_cbUpper6);
            _boxes.Add(_cbUpper7);
            _boxes.Add(_cbUpper8);
            _boxes.Add(_cbUpper9);
            _boxes.Add(_cbUpper10);
            _boxes.Add(_cbUpper11);
            _boxes.Add(_cbUpper12);
            _boxes.Add(_cbUpper13);
            _boxes.Add(_cbUpper14);
            _boxes.Add(_cbUpper15);
            _boxes.Add(_cbUpper16);

            _boxes.ForEach(_addEvents);

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
Beispiel #4
0
        public TradeEditDialog(ReadableTuple <int> tuple) : base("Trade edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();

            ToolTipsBuilder.Initialize(new string[] {
                "Item can't be droped",
                "Item can't be traded (nor vended)",
                "Wedded partner can override restriction 2.",
                "Item can't be sold to npcs",
                "Item can't be placed in the cart",
                "Item can't be placed in the storage",
                "Item can't be placed in the guild storage",
                "Item can't be attached to mail",
                "Item can't be auctioned"
            }, this);

            _override = tuple.GetIntNoThrow(ServerItemAttributes.TradeOverride);
            _flag     = tuple.GetIntNoThrow(ServerItemAttributes.TradeFlag);

            _cbUpper1.Tag = 1 << 0;
            _cbUpper2.Tag = 1 << 1;
            _cbUpper3.Tag = 1 << 2;
            _cbUpper4.Tag = 1 << 3;
            _cbUpper5.Tag = 1 << 4;
            _cbUpper6.Tag = 1 << 5;
            _cbUpper7.Tag = 1 << 6;
            _cbUpper8.Tag = 1 << 7;
            _cbUpper9.Tag = 1 << 8;

            _boxes.Add(_cbUpper1);
            _boxes.Add(_cbUpper2);
            _boxes.Add(_cbUpper3);
            _boxes.Add(_cbUpper4);
            _boxes.Add(_cbUpper5);
            _boxes.Add(_cbUpper6);
            _boxes.Add(_cbUpper7);
            _boxes.Add(_cbUpper8);
            _boxes.Add(_cbUpper9);

            _tbOverride.Text = tuple.GetIntNoThrow(ServerItemAttributes.TradeOverride).ToString(CultureInfo.InvariantCulture);
            _eventId         = 0;
            _boxes.ForEach(_addEvents);

            _tbOverride.TextChanged += delegate {
                _update();
            };

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
        public TradeEditDialog(string text) : base("Trade edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);

            ToolTipsBuilder.Initialize(new string[] {
                "Item can't be droped",
                "Item can't be traded (nor vended)",
                "Wedded partner can override restriction 2.",
                "Item can't be sold to npcs",
                "Item can't be placed in the cart",
                "Item can't be placed in the storage",
                "Item can't be placed in the guild storage",
                "Item can't be attached to mail",
                "Item can't be auctioned"
            }, this);

            _value = text;

            _cbUpper1.Tag = "nodrop";
            _cbUpper2.Tag = "notrade";
            _cbUpper3.Tag = "partneroverride";
            _cbUpper4.Tag = "noselltonpc";
            _cbUpper5.Tag = "nocart";
            _cbUpper6.Tag = "nostorage";
            _cbUpper7.Tag = "nogstorage";
            _cbUpper8.Tag = "nomail";
            _cbUpper9.Tag = "noauction";

            _boxes.Add(_cbUpper1);
            _boxes.Add(_cbUpper2);
            _boxes.Add(_cbUpper3);
            _boxes.Add(_cbUpper4);
            _boxes.Add(_cbUpper5);
            _boxes.Add(_cbUpper6);
            _boxes.Add(_cbUpper7);
            _boxes.Add(_cbUpper8);
            _boxes.Add(_cbUpper9);

            _tbOverride.Text = ParserHelper.GetVal(_value, "override", "100");
            _boxes.ForEach(_addEvents);

            _tbOverride.TextChanged += delegate {
                _update();
            };

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
Beispiel #6
0
        public NouseEditDialog(ReadableTuple <int> tuple)
            : base("NoUse edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();

            ToolTipsBuilder.Initialize(new string[] {
                "Cannot use the item while sitting."
            }, this);

            _flag = tuple.GetIntNoThrow(ServerItemAttributes.NoUseFlag);

            _cbUpper1.Tag = 1 << 0;

            _boxes.Add(_cbUpper1);

            _eventId = 0;
            _boxes.ForEach(_addEvents);

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
        public SkillDamageDialog(string text) : base("Skill damage edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);
            _value = Extensions.ParseToInt(text);

            ToolTipsBuilder.Initialize(new string[] {
                "No damage skill.",
                "Has splash area (requires source modification).",
                "Damage should be split among targets (requires 0x02 in order to work).",
                "Skill ignores caster's % damage cards (misc type always ignores).",
                "Skill ignores elemental adjustments.",
                "Skill ignores target's defense (misc type always ignores).",
                "Skill ignores target's flee (magic type always ignores).",
                "Skill ignores target's def cards."
            }, this);

            _cbUpper1.Tag = 1;
            _cbUpper2.Tag = 2;
            _cbUpper3.Tag = 4;
            _cbUpper4.Tag = 8;
            _cbUpper5.Tag = 16;
            _cbUpper6.Tag = 32;
            _cbUpper7.Tag = 64;
            _cbUpper8.Tag = 128;

            _boxes.Add(_cbUpper1);
            _boxes.Add(_cbUpper2);
            _boxes.Add(_cbUpper3);
            _boxes.Add(_cbUpper4);
            _boxes.Add(_cbUpper5);
            _boxes.Add(_cbUpper6);
            _boxes.Add(_cbUpper7);
            _boxes.Add(_cbUpper8);

            _boxes.ForEach(_addEvents);

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
        public NouseEditDialog(string text) : base("Nouse edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);

            ToolTipsBuilder.Initialize(new string[] {
                "Cannot use the item while sitting."
            }, this);

            _value = text;

            _cbUpper1.Tag = "sitting";

            _boxes.Add(_cbUpper1);

            _tbOverride.Text = ParserHelper.GetVal(_value, "override", "100");
            _boxes.ForEach(_addEvents);

            _tbOverride.TextChanged += delegate {
                _update();
            };

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
Beispiel #9
0
        public GenericFlagDialog(DbAttribute attribute, string text, Type enumType, FlagTypeData flagTypeData, string description) : base(description, "cde.ico", SizeToContent.WidthAndHeight, ResizeMode.CanResize)
        {
            InitializeComponent();

            _value = text.ToLong();

            if (flagTypeData != null)
            {
                List <long> valuesEnum = flagTypeData.Values.Where(p => (p.DataFlag & FlagDataProperty.Hide) == 0).Select(p => p.Value).ToList();
                var         values     = flagTypeData.Values.Where(p => (p.DataFlag & FlagDataProperty.Hide) == 0).ToList();

                GridIndexProvider provider = _findGrid(values);

                var toolTips = new string[values.Count];

                for (int i = 0; i < values.Count; i++)
                {
                    toolTips[i] = _getTooltip(values[i].Description);
                }

                AbstractProvider iProvider = new DefaultIndexProvider(0, values.Count);
                ToolTipsBuilder.Initialize(toolTips, this);

                int row;
                int col;

                for (int i = 0; i < values.Count; i++)
                {
                    provider.Next(out row, out col);

                    int      index = (int)iProvider.Next();
                    CheckBox box   = new CheckBox {
                        Content = values[index].Name, Margin = new Thickness(3, 6, 3, 6), VerticalAlignment = VerticalAlignment.Center
                    };

                    var      menu = new ContextMenu();
                    MenuItem item = new MenuItem();
                    item.Header     = "Restrict search to [" + values[index].Name + "]";
                    box.ContextMenu = menu;
                    menu.Items.Add(item);
                    item.Click += delegate {
                        var selected = SdeEditor.Instance.Tabs.FirstOrDefault(p => p.IsSelected);

                        if (selected != null)
                        {
                            selected._dbSearchPanel._searchTextBox.Text = "([" + attribute.AttributeName + "] & " + "Flags." + values[index].Name + ") != 0";
                        }
                    };

                    box.Tag = valuesEnum[index];
                    WpfUtils.AddMouseInOutEffectsBox(box);
                    _boxes.Add(box);
                    _upperGrid.Children.Add(box);
                    WpfUtilities.SetGridPosition(box, row, 2 * col);
                }

                _boxes.ForEach(_addEvents);
            }
            else
            {
                if (enumType.BaseType != typeof(Enum))
                {
                    throw new Exception("Invalid argument type, excepted an enum.");
                }

                if (enumType == typeof(MobModeType))
                {
                    if (DbPathLocator.GetServerType() == ServerType.RAthena && !ProjectConfiguration.UseOldRAthenaMode)
                    {
                        enumType = typeof(MobModeTypeNew);
                    }
                }

                List <long> valuesEnum = Enum.GetValues(enumType).Cast <int>().Select(p => (long)p).ToList();
                var         values     = Enum.GetValues(enumType).Cast <Enum>().ToList();

                string[] commands = Description.GetAnyDescription(enumType).Split('#');

                if (commands.Any(p => p.StartsWith("max_col_width:")))
                {
                    _maxColWidth = Int32.Parse(commands.First(p => p.StartsWith("max_col_width")).Split(':')[1]);
                }

                GridIndexProvider provider = _findGrid(values);

                var toolTips = new string[values.Count];

                if (!commands.Contains("disable_tooltips"))
                {
                    for (int i = 0; i < values.Count; i++)
                    {
                        toolTips[i] = _getTooltip(Description.GetDescription(values[i]));
                    }
                }

                AbstractProvider iProvider = new DefaultIndexProvider(0, values.Count);

                if (commands.Any(p => p.StartsWith("order:")))
                {
                    List <int> order = commands.First(p => p.StartsWith("order:")).Split(':')[1].Split(',').Select(Int32.Parse).ToList();

                    for (int i = 0; i < values.Count; i++)
                    {
                        if (!order.Contains(i))
                        {
                            order.Add(i);
                        }
                    }

                    iProvider = new SpecifiedIndexProvider(order);
                }

                ToolTipsBuilder.Initialize(toolTips, this);

                int        row;
                int        col;
                ServerType currentType = DbPathLocator.GetServerType();

                for (int i = 0; i < values.Count; i++)
                {
                    provider.Next(out row, out col);

                    int      index = (int)iProvider.Next();
                    CheckBox box   = new CheckBox {
                        Content = _getDisplay(Description.GetDescription(values[index])), Margin = new Thickness(3, 6, 3, 6), VerticalAlignment = VerticalAlignment.Center
                    };
                    ServerType type = _getEmuRestrition(Description.GetDescription(values[index]));

                    if ((type & currentType) != currentType)
                    {
                        box.IsEnabled = false;
                    }

                    var      menu = new ContextMenu();
                    MenuItem item = new MenuItem();
                    item.Header     = "Restrict search to [" + _getDisplay(Description.GetDescription(values[index])) + "]";
                    box.ContextMenu = menu;
                    menu.Items.Add(item);
                    item.Click += delegate {
                        var selected = SdeEditor.Instance.Tabs.FirstOrDefault(p => p.IsSelected);

                        if (selected != null)
                        {
                            selected._dbSearchPanel._searchTextBox.Text = "([" + attribute.AttributeName + "] & " + valuesEnum[index] + ") != 0";
                        }
                    };

                    box.Tag = valuesEnum[index];
                    WpfUtils.AddMouseInOutEffectsBox(box);
                    _boxes.Add(box);
                    _upperGrid.Children.Add(box);
                    WpfUtilities.SetGridPosition(box, row, 2 * col);
                }

                _boxes.ForEach(_addEvents);
            }
        }
        public GenericFlagDialog(string text, Type enumType) : base(_getDisplay(Description.GetAnyDescription(enumType)), "cde.ico", SizeToContent.WidthAndHeight, ResizeMode.CanResize)
        {
            InitializeComponent();

            _value = text.ToInt();

            if (enumType.BaseType != typeof(Enum))
            {
                throw new Exception("Invalid argument type, excepted an enum.");
            }

            if (enumType == typeof(MobModeType))
            {
                if (DbPathLocator.GetServerType() == ServerType.RAthena && !ProjectConfiguration.UseOldRAthenaMode)
                {
                    enumType = typeof(MobModeTypeNew);
                }
            }

            var values     = Enum.GetValues(enumType).Cast <Enum>().ToList();
            var valuesEnum = Enum.GetValues(enumType).Cast <int>().ToList();

            string[] commands = Description.GetAnyDescription(enumType).Split('#');

            if (commands.Any(p => p.StartsWith("max_col_width:")))
            {
                _maxColWidth = Int32.Parse(commands.First(p => p.StartsWith("max_col_width")).Split(':')[1]);
            }

            GridIndexProvider provider = _findGrid(values);

            var toolTips = new string[values.Count];

            if (!commands.Contains("disable_tooltips"))
            {
                for (int i = 0; i < values.Count; i++)
                {
                    toolTips[i] = _getTooltip(Description.GetDescription(values[i]));
                }
            }

            AbstractProvider iProvider = new DefaultIndexProvider(0, values.Count);

            if (commands.Any(p => p.StartsWith("order:")))
            {
                List <int> order = commands.First(p => p.StartsWith("order:")).Split(':')[1].Split(',').Select(Int32.Parse).ToList();

                for (int i = 0; i < values.Count; i++)
                {
                    if (!order.Contains(i))
                    {
                        order.Add(i);
                    }
                }

                iProvider = new SpecifiedIndexProvider(order);
            }

            ToolTipsBuilder.Initialize(toolTips, this);

            int        row;
            int        col;
            ServerType currentType = DbPathLocator.GetServerType();

            for (int i = 0; i < values.Count; i++)
            {
                provider.Next(out row, out col);

                int      index = (int)iProvider.Next();
                CheckBox box   = new CheckBox {
                    Content = _getDisplay(Description.GetDescription(values[index])), Margin = new Thickness(3, 6, 3, 6), VerticalAlignment = VerticalAlignment.Center
                };
                ServerType type = _getEmuRestrition(Description.GetDescription(values[index]));

                if ((type & currentType) != currentType)
                {
                    box.IsEnabled = false;
                }

                box.Tag = valuesEnum[index];
                WpfUtils.AddMouseInOutEffectsBox(box);
                _boxes.Add(box);
                _upperGrid.Children.Add(box);
                WpfUtilities.SetGridPosition(box, row, 2 * col);
            }

            _boxes.ForEach(_addEvents);
        }