コード例 #1
0
ファイル: GDPlayer.cs プロジェクト: gpkgpk/GDStashViewer
        public void read(ref GDBlockReader gdc)
        {
            GDBlock b = new GDBlock();

            gdc.read_block_start(ref b);
            uint ver = gdc.read_int();

            if (ver != 8)             // version
            {
                throw new Exception();
            }

            level          = gdc.read_int();
            experience     = gdc.read_int();
            modifierPoints = gdc.read_int();
            skillPoints    = gdc.read_int();
            devotionPoints = gdc.read_int();
            totalDevotion  = gdc.read_int();
            physique       = gdc.read_float();
            cunning        = gdc.read_float();
            spirit         = gdc.read_float();
            health         = gdc.read_float();
            energy         = gdc.read_float();

            gdc.read_block_end(ref b);
        }
コード例 #2
0
ファイル: GDPlayer.cs プロジェクト: gpkgpk/GDStashViewer
        public void read(ref GDBlockReader gdc)
        {
            GDBlock b = new GDBlock();

            if (gdc.read_block_start(ref b) != 1)
            {
                throw new Exception();
            }
            uint ver = gdc.read_int();

            if (ver < 3)             // version
            {
                throw new Exception();
            }

            isInMainQuest      = gdc.read_byte();
            hasBeenInGame      = gdc.read_byte();
            difficulty         = gdc.read_byte();
            greatestDifficulty = gdc.read_byte();
            money = gdc.read_int();

            if (ver >= 4)
            {
                gdc.read_byte();
                gdc.read_int();
            }
            compassState           = gdc.read_byte();
            lootMode               = gdc.read_int();
            skillWindowShowHelp    = gdc.read_byte();
            alternateConfig        = gdc.read_byte();
            alternateConfigEnabled = gdc.read_byte();
            texture = gdc.read_str();

            gdc.read_block_end(ref b);
        }
コード例 #3
0
ファイル: GDPlayer.cs プロジェクト: gpkgpk/GDStashViewer
        public void read(ref GDBlockReader gdbr)
        {
            GDBlock b = new GDBlock();
            uint    ver;

            if (gdbr.read_block_start(ref b) != 3)
            {
                new IOException();
            }
            ver = gdbr.read_int();
            if (ver < 4)             // version
            {
                new IOException();
            }
            flag = gdbr.read_byte();
            if (flag != 0)
            {
                uint numBags = gdbr.read_int();
                focused  = gdbr.read_int();
                selected = gdbr.read_int();

                Bags = new List <GDStashBag>((int)numBags);

                for (int i = 0; i < numBags; i++)
                {
                    GDStashBag bag = new GDStashBag();
                    bag.Read(gdbr, null, true);
                    bag.Index = i;
                    Bags.Add(bag);
                }

                useAlternate = gdbr.read_byte();

                for (uint i = 0; i < 12; i++)
                {
                    equipment[i].Read(gdbr, true);
                    gdbr.read_byte();
                }

                alternate1 = gdbr.read_byte();

                for (uint i = 0; i < 2; i++)
                {
                    weapon1[i].Read(gdbr, true);
                    gdbr.read_byte();
                }

                alternate2 = gdbr.read_byte();

                for (uint i = 0; i < 2; i++)
                {
                    weapon2[i].Read(gdbr, true);
                    gdbr.read_byte();
                }
            }

            gdbr.read_block_end(ref b);
        }
コード例 #4
0
ファイル: GDBlockReader.cs プロジェクト: gpkgpk/GDStashViewer
        public UInt32 read_block_start(ref GDBlock b)
        {
            UInt32 ret = read_int();

            b.len = next_int();
            b.end = (UInt32)File.BaseStream.Position + b.len;

            return(ret);
        }
コード例 #5
0
ファイル: GDBlockReader.cs プロジェクト: gpkgpk/GDStashViewer
        public void read_block_end(ref GDBlock b)
        {
            if ((UInt32)File.BaseStream.Position != b.end)
            {
                throw new IOException();
            }

            if (next_int() != 0)
            {
                throw new IOException();
            }
        }
コード例 #6
0
        public void Open(string filename)
        {
            BlockReader = new GDBlockReader();
            using (BlockReader.File = new BinaryReader(File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read), ASCIIEncoding.ASCII))
            {
                FileName = filename;
                UInt32 n, ver;
                BlockReader.read_key();

                if (BlockReader.read_int() != 2)
                {
                    throw new IOException();
                }

                GDBlock b = new GDBlock();

                if (BlockReader.read_block_start(ref b) != 18)
                {
                    throw new IOException();
                }
                ver = BlockReader.read_int();
                if (ver < 4)                 // version
                {
                    throw new IOException("Version Mismatch <4");
                }
                n = BlockReader.next_int();
                if (n != 0)
                {
                    throw new IOException();
                }

                mod = BlockReader.read_str();
                if (ver >= 5)
                {
                    BlockReader.read_byte();
                }
                n    = BlockReader.read_int();
                Bags = new List <GDStashBag>((int)n);

                for (int i = 0; i < n; i++)
                {
                    GDStashBag bag = new GDStashBag();
                    bag.Read(this.BlockReader, this);
                    bag.Index = i;
                    Bags.Add(bag);
                }

                BlockReader.read_block_end(ref b);
            }
        }
コード例 #7
0
        internal void Read(GDBlockReader gdbr, GDStash parentStash = null, bool isCharacterBag = false)
        {
            GDBlock b = new GDBlock();

            gdbr.read_block_start(ref b);
            if (!isCharacterBag)
            {
                width  = gdbr.read_int();
                height = gdbr.read_int();
            }
            else
            {
                gdbr.read_byte();
            }
            uint numItems = gdbr.read_int();

            ParentStash = parentStash;
            Items       = new List <GDStashItem>((int)numItems);

            for (int i = 0; i < numItems; i++)
            {
                GDStashItem item = new GDStashItem();
                item.Read(gdbr);
                item.ParentStashBag = this;
                if (!string.IsNullOrEmpty(item.SubCategory))
                {
                    string subcat = item.SubCategory.ToLower();
                    if (!(subcat.Contains("potion") || subcat.Contains("consumable") || subcat.Contains("questitem")))
                    {
                        Items.Add(item);
                    }
                }
                else if (string.IsNullOrEmpty(item.SubCategory))
                {
                    Items.Add(item);
                }
            }

            gdbr.read_block_end(ref b);
        }
コード例 #8
0
ファイル: GDPlayer.cs プロジェクト: gpkgpk/GDStashViewer
        public void read(ref GDBlockReader gdbr)
        {
            GDBlock b = new GDBlock();


            if (gdbr.read_block_start(ref b) != 4)
            {
                throw new Exception();
            }
            uint ver = gdbr.read_int();

            if (ver != 5 && ver != 6)             // version
            {
                throw new Exception();
            }

            uint numBags;

            if (ver >= 6)
            {
                numBags = numBags = gdbr.read_int();
            }
            else
            {
                numBags = 1;
            }

            Bags = new List <GDStashBag>((int)numBags);

            for (int i = 0; i < numBags; i++)
            {
                GDStashBag bag = new GDStashBag();
                bag.Read(gdbr);
                bag.Index = i;
                Bags.Add(bag);
            }

            gdbr.read_block_end(ref b);
        }