Example #1
0
            public ByteWriter Save(ByteWriter bw)
            {
                bw.STRING(VERSION_STRING);

                bw.UINT((uint)Messages.Count);
                foreach (var msg in Messages)
                {
                    bw.STRING(string.Format("{0}\t{1}\t{2}",
                                            msg.Ref.CategoryID,
                                            msg.Ref.SubCategoryID,
                                            msg.Ref.ID));

                    bw.UINT(msg.Ref.CategoryID);
                    bw.UINT(msg.Ref.SubCategoryID);
                    bw.UINT(msg.Ref.ID);

                    bw.STRING(msg.Text);
                }

                bw.UINT((uint)Categories.Count - 1);
                for (int i = 0; i < Categories.Count; i++)
                {
                    var category = Categories[i];

                    bw.STRING(i.ToString() + "_" + category.Name);

                    bw.UINT((uint)category.Count - 1);
                    for (int j = 0; j < category.Count; j++)
                    {
                        bw.STRING(j.ToString() + "_" + category[j]);
                    }
                }

                return(bw);
            }
Example #2
0
        public void Save(string filename = null)
        {
            var bw = new ByteWriter();

            bw.STRING(FileID);

            bw.UINT((uint)Skills.Count);

            foreach (var s in Skills)
            {
                // Handle empty entries
                if (s == null)
                {
                    for (int i = 0; i < 41; i++)
                    {
                        bw.BYTE(0);
                    }

                    continue;
                }

                bw.BYTE((byte)s.Type);
                bw.STRING(s.Message.ID.ToString());
                bw.STRING(s.Message.SubCategory.ID.ToString());
                bw.UINT(s.IconIndex);
                bw.USHORT(s.ProjectileAnimation);
                bw.UINT(s.CharacterAnimation);
                bw.INT(s.Honor);
                bw.UINT(s.Level);
                bw.BYTE(s.CharacterType);

                uint mana = s.ManaUsage;
                if (s.ManaUsageStyle == ManaUsageStyle.Percentage)
                {
                    mana += 1000000000;
                }
                bw.UINT(mana);

                short range = s.Range;
                if (s.IsAOE)
                {
                    range += 10000;
                }
                bw.SHORT(range);

                bw.BYTE(s.NeedsTarget);

                bw.BYTE(s.Unused1);
                bw.BYTE(s.Unused2);
                bw.BYTE(s.Unused3);

                bw.BYTE(s.EffectType);
                bw.UINT(s.Multiplier);

                bw.UINT(s.Unknown5);
            }

            File.WriteAllBytes(filename ?? FileName, bw.ToByteArray());
        }
Example #3
0
        public virtual ByteWriter Save(ByteWriter bw)
        {
            bw.STRING(VERSION_STRING);

            return(bw);
        }