Ejemplo n.º 1
0
        public static EquipItem createItem(string scodes)
        {
            if (scodes.Length != 32)
            {
                return(null);
            }
            scodes = scodes.ToUpper();
            if (scodes.StartsWith("FF"))
            {
                return(null);
            }
            byte[]    array = new byte[16];
            EquipItem result;

            try
            {
                for (int i = 0; i < 16; i++)
                {
                    array[i] = Convert.ToByte(scodes.Substring(i * 2, 2), 16);
                }
                goto IL_55;
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);

IL_55:
            return(EquipItem.createItem(array));
        }
Ejemplo n.º 2
0
        public bool loadItemsByCodes(byte[] codes, int offset, int len)
        {
            if (offset < 0 || len < this.xnum * this.ynum * 16 || codes == null)
            {
                base.Invalidate();
                return(false);
            }
            EquipItem equipItem = null;

            for (int i = 0; i < this.ynum; i++)
            {
                for (int j = 0; j < this.xnum; j++)
                {
                    EquipItem equipItem1 = EquipItem.createItem(codes, offset + (i * this.xnum + j) * 16, 16);
                    equipItem = equipItem1;
                    if (equipItem1 != null)
                    {
                        this.units[j, i] = new DrawingUnit(equipItem, j, i);
                        this.putItem(this.units[j, i], false);
                    }
                }
            }
            base.Invalidate();
            return(true);
        }
Ejemplo n.º 3
0
        private void toolStripMenuItem_3_Click(object sender, EventArgs e)
        {
            IDataObject dataObject = Clipboard.GetDataObject();

            if (dataObject.GetDataPresent(DataFormats.Text))
            {
                string text = ((string)dataObject.GetData(DataFormats.Text)).Replace("&", "").Replace("0x", "");
                if (text.Length == 32 && Validator.HexString(text) && !text.StartsWith("FF"))
                {
                    EquipItem equipItem = EquipItem.createItem(text);
                    if (equipItem != null && this.putItem(equipItem, false, true))
                    {
                        return;
                    }
                }
                else if (text.Length % 32 == 0 && Validator.HexString(text))
                {
                    EquipItem[] array = new EquipItem[text.Length / 32];
                    for (int i = 0; i < text.Length / 32; i++)
                    {
                        string text2 = text.Substring(i * 32, 32);
                        if (!text2.StartsWith("FF"))
                        {
                            array[i] = EquipItem.createItem(text2);
                        }
                    }
                    if (!this.putItems(array, true))
                    {
                        Utils.WarningMessage("没有足够的空间放置这些物品,请先清理出足够的空间!");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void 粘贴VToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IDataObject dataObject = Clipboard.GetDataObject();

            if (dataObject.GetDataPresent(DataFormats.Text))
            {
                string str = ((string)dataObject.GetData(DataFormats.Text)).Replace("&", "").Replace("0x", "");
                if (str.Length == 32 && Validator.HexString(str) && !str.StartsWith("FF"))
                {
                    EquipItem equipItem = EquipItem.createItem(str);
                    if (equipItem != null && this.putItem(equipItem, false, true))
                    {
                        return;
                    }
                }
                else if (str.Length % 32 == 0 && Validator.HexString(str))
                {
                    EquipItem[] equipItemArray = new EquipItem[str.Length / 32];
                    for (int i = 0; i < str.Length / 32; i++)
                    {
                        string str1 = str.Substring(i * 32, 32);
                        if (!str1.StartsWith("FF"))
                        {
                            equipItemArray[i] = EquipItem.createItem(str1);
                        }
                    }
                    if (!this.putItems(equipItemArray, true))
                    {
                        Utils.WarningMessage("There is not enough space for these items, please clean up enough space!");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static EquipItem createItem(string scodes)
        {
            EquipItem equipItem;

            if (scodes.Length != 32)
            {
                return(null);
            }
            scodes = scodes.ToUpper();
            if (scodes.StartsWith("FF"))
            {
                return(null);
            }
            byte[] num = new byte[16];
            try
            {
                for (int i = 0; i < 16; i++)
                {
                    num[i] = Convert.ToByte(scodes.Substring(i * 2, 2), 16);
                }
                return(EquipItem.createItem(num));
            }
            catch (Exception exception)
            {
                equipItem = null;
            }
            return(equipItem);
        }
Ejemplo n.º 6
0
 public bool setItem(int pos, string scodes)
 {
     if (pos < 0 || pos >= 15)
     {
         return(false);
     }
     this.items[pos] = EquipItem.createItem(scodes);
     return(this.items[pos] != null);
 }
Ejemplo n.º 7
0
 public bool loadItemsByCodes(byte[] codes, int offset, int len)
 {
     if (offset >= 0 && len >= 192 && codes != null)
     {
         for (int i = 0; i < 12; i++)
         {
             EquipItem item;
             if ((item = EquipItem.createItem(codes, offset + i * 16, 16)) != null)
             {
                 this.units[i] = new DrawingUnit(item, i, 0);
             }
         }
         base.Invalidate();
         return(true);
     }
     base.Invalidate();
     return(false);
 }
Ejemplo n.º 8
0
        public bool putItems()
        {
            bool flag = true;

            this.editor.updateData(this.curUnit.Item);
            EquipItem item = new EquipItem();
            string    str  = "7,8,9,10,11";
            string    str2 = "0";

            switch (this.curUnit.Item.Code)
            {
            case 0x17:
            case 0x20:
            case 15:
            case 20:
            case 0x2f:
            case 0x30:
            case 0x25:
            case 0x47:
                str2 = "7";
                break;

            case 0x3b:
            case 60:
            case 0x3d:
            case 0x48:
                str2 = "10";
                break;
            }
            foreach (string str3 in str.Split(new char[] { ',' }))
            {
                if (!(str3 == str2) && (EquipEditor.xItem[(Convert.ToByte(str3) * 0x200) + this.curUnit.Item.Code] != null))
                {
                    item.assign(EquipItem.createItem(this.curUnit.Item.Code, Convert.ToByte(str3)));
                    item.Code = this.curUnit.Item.Code;
                    item.Type = Convert.ToByte(str3);
                    this.editor.updateData(item);
                    flag = flag && this.putItem(item, true, false);
                }
            }
            return(flag);
        }
Ejemplo n.º 9
0
        private void 粘贴VToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IDataObject dataObject = Clipboard.GetDataObject();

            if (dataObject.GetDataPresent(DataFormats.Text))
            {
                string str = ((string)dataObject.GetData(DataFormats.Text)).Replace("&", "").Replace("0x", "");
                if (str.Length == 32 && Validator.HexString(str) && !str.StartsWith("FF"))
                {
                    EquipItem   equipItem   = EquipItem.createItem(str);
                    DrawingUnit drawingUnit = new DrawingUnit(equipItem);
                    if (equipItem != null && this.canPutItem(drawingUnit))
                    {
                        this.putItem(drawingUnit, false, true);
                        return;
                    }
                    Utils.WarningMessage(string.Concat("Item", equipItem.Name, "can not be placed in that position!"));
                }
            }
        }
Ejemplo n.º 10
0
        private void toolStripMenuItem_4_Click(object sender, EventArgs e)
        {
            IDataObject dataObject = Clipboard.GetDataObject();

            if (dataObject.GetDataPresent(DataFormats.Text))
            {
                string text = ((string)dataObject.GetData(DataFormats.Text)).Replace("&", "").Replace("0x", "");
                if (text.Length == 32 && Validator.HexString(text) && !text.StartsWith("FF"))
                {
                    EquipItem   equipItem = EquipItem.createItem(text);
                    DrawingUnit unit      = new DrawingUnit(equipItem);
                    if (equipItem != null && this.canPutItem(unit))
                    {
                        this.putItem(unit, false, true);
                        return;
                    }
                    Utils.WarningMessage("物品[" + equipItem.Name + "]不能放置在该位置!");
                }
            }
        }
Ejemplo n.º 11
0
        public bool loadItemsByCodes(byte[] codes, int offset, int len)
        {
            if (offset < 0 || len < 16 || codes == null)
            {
                base.Invalidate();
                return(false);
            }
            EquipItem equipItem = null;

            for (int i = 0; i < 1; i++)
            {
                EquipItem equipItem1 = EquipItem.createItem(codes, offset + i * 16, 16);
                equipItem = equipItem1;
                if (equipItem1 != null)
                {
                    this.units[i] = new DrawingUnit(equipItem, i, 0);
                }
            }
            base.Invalidate();
            return(true);
        }
Ejemplo n.º 12
0
 public bool loadItemsByCodes(byte[] codes, int offset, int len)
 {
     if (offset >= 0 && len >= this.xnum * this.ynum * 16 && codes != null)
     {
         for (int i = 0; i < this.ynum; i++)
         {
             for (int j = 0; j < this.xnum; j++)
             {
                 EquipItem item;
                 if ((item = EquipItem.createItem(codes, offset + (i * this.xnum + j) * 16, 16)) != null)
                 {
                     this.units[j, i] = new DrawingUnit(item, j, i);
                     this.putItem(this.units[j, i], false);
                 }
             }
         }
         base.Invalidate();
         return(true);
     }
     base.Invalidate();
     return(false);
 }
Ejemplo n.º 13
0
 public static EquipItem createItem(byte[] codes)
 {
     return(EquipItem.createItem(codes, 0, 16));
 }
Ejemplo n.º 14
0
        public bool putItems()
        {
            bool flag = true;

            this.editor.updateData(this.curUnit.Item);
            EquipItem equipItem = new EquipItem();
            string    text      = "7,8,9,10,11";
            string    b         = "0";
            ushort    code      = this.curUnit.Item.Code;

            if (code <= 32)
            {
                if (code <= 20)
                {
                    if (code != 15 && code != 20)
                    {
                        goto IL_BC;
                    }
                }
                else if (code != 23 && code != 32)
                {
                    goto IL_BC;
                }
            }
            else
            {
                if (code > 48)
                {
                    switch (code)
                    {
                    case 59:
                    case 60:
                    case 61:
                        break;

                    default:
                        switch (code)
                        {
                        case 71:
                            goto IL_AE;

                        case 72:
                            break;

                        default:
                            goto IL_BC;
                        }
                        break;
                    }
                    b = "10";
                    goto IL_BC;
                }
                if (code != 37)
                {
                    switch (code)
                    {
                    case 47:
                    case 48:
                        break;

                    default:
                        goto IL_BC;
                    }
                }
            }
IL_AE:
            b = "7";
IL_BC:
            foreach (string text2 in text.Split(new char[]
            {
                ','
            }))
            {
                if (!(text2 == b) && EquipEditor.xItem[(int)((ushort)Convert.ToByte(text2) * 512 + this.curUnit.Item.Code)] != null)
                {
                    equipItem.assign(EquipItem.createItem(this.curUnit.Item.Code, (ushort)Convert.ToByte(text2)));
                    equipItem.Code = this.curUnit.Item.Code;
                    equipItem.Type = (ushort)Convert.ToByte(text2);
                    this.editor.updateData(equipItem);
                    flag = (flag && this.putItem(equipItem, true, false));
                }
            }
            return(flag);
        }