示例#1
0
        protected static uint[] UnpackRegionValues(string v)
        {
            uint[]         values = new uint[2];
            StringUnpacker buffer = new StringUnpacker(v);

            for (int i = 0; i < 2 && buffer.CanRead; ++i)
            {
                values[i] = buffer.NextUInt();
            }

            return(values);
        }
示例#2
0
        protected static uint[] UnpackValues(string v)
        {
            uint[]         values = new uint[4];
            StringUnpacker buffer = new StringUnpacker(v);

            buffer.Position += 8;     //skip sum
            buffer.Position += 4;     //skip num
            buffer.Position += 4 * 7; //skip avgs
            buffer.Position += 2;     //skip day and day index

            if (!buffer.CanRead)
            {
                return(values);
            }

            for (int i = 0; i < 4 && buffer.CanRead; ++i)
            {
                values[i] = buffer.NextUInt();
            }

            return(values);
        }
示例#3
0
        protected static string UnpackKey(string k)
        {
            string         data   = k.Substring(1).Base64Decode().GetString();
            StringUnpacker buffer = new StringUnpacker(data);
            uint           id     = buffer.NextUInt();

            if (buffer.CanRead)
            {
                // pet based
                if (k[0] == 'p')
                {
                    byte plevel = buffer.NextByte();
                    if (buffer.CanRead)
                    {
                        byte pquality = buffer.NextByte();
                        return($"p:{id}:{plevel}:{pquality}");
                    }
                    else
                    {
                        return($"p:{id}:{plevel}");
                    }
                }
                // regulare item
                else
                {
                    byte     bcount  = buffer.NextByte();
                    ushort[] bonuses = new ushort[bcount];

                    if (bcount > 0)
                    {
                        for (byte i = 0; i < bcount && buffer.CanRead; ++i)
                        {
                            bonuses[i] = buffer.NextUShort();
                        }

                        if (!buffer.CanRead)
                        {
                            return($"i:{id}::{bcount}:{bonuses.Join(":")}");
                        }
                    }

                    if (!buffer.CanRead)
                    {
                        return($"i:{id}");
                    }

                    int    mcount = buffer.NextByte() * 2;
                    uint[] mods   = new uint[mcount];
                    for (int i = 0; i < mcount && buffer.CanRead; i += 2)
                    {
                        mods[i]     = buffer.NextByte();
                        mods[i + 1] = buffer.NextUInt();
                    }

                    if (bcount > 0)
                    {
                        return($"i:{id}::{bcount}:{bonuses.Join(":")}:{(mcount / 2)}:{mods.Join(":")}");
                    }
                    else
                    {
                        return($"i:{id}:::{(mcount / 2)}:{mods.Join(":")}");
                    }
                }
            }

            if (k[0] == 'p')
            {
                return($"p:{id}");
            }
            else
            {
                return($"i:{id}");
            }
        }