Ejemplo n.º 1
0
        public PlayerData(BinaryReader reader, int version) : base(reader, version)
        {
            int c;

            m_Str     = reader.ReadUInt16();
            m_Dex     = reader.ReadUInt16();
            m_Int     = reader.ReadUInt16();
            m_StamMax = reader.ReadUInt16();
            m_Stam    = reader.ReadUInt16();
            m_ManaMax = reader.ReadUInt16();
            m_Mana    = reader.ReadUInt16();
            m_StrLock = (LockType)reader.ReadByte();
            m_DexLock = (LockType)reader.ReadByte();
            m_IntLock = (LockType)reader.ReadByte();
            m_Gold    = reader.ReadUInt32();
            m_Weight  = reader.ReadUInt16();

            m_MoveInfo = new Hashtable(256);

            if (version >= 4)
            {
                Skill.Count = c = reader.ReadByte();
            }
            else if (version == 3)
            {
                long skillStart = reader.BaseStream.Position;
                c = 0;
                reader.BaseStream.Seek(7 * 49, SeekOrigin.Current);
                for (int i = 48; i < 60; i++)
                {
                    ushort Base, Cap, Val;
                    byte   Lock;

                    Base = reader.ReadUInt16();
                    Cap  = reader.ReadUInt16();
                    Val  = reader.ReadUInt16();
                    Lock = reader.ReadByte();

                    if (Base > 2000 || Cap > 2000 || Val > 2000 || Lock > 2)
                    {
                        c = i;
                        break;
                    }
                }

                if (c == 0)
                {
                    c = 52;
                }
                else if (c > 54)
                {
                    c = 54;
                }

                Skill.Count = c;

                reader.BaseStream.Seek(skillStart, SeekOrigin.Begin);
            }
            else
            {
                Skill.Count = c = 52;
            }

            m_Skills = new Skill[c];
            for (int i = 0; i < c; i++)
            {
                m_Skills[i]            = new Skill(i);
                m_Skills[i].FixedBase  = reader.ReadUInt16();
                m_Skills[i].FixedCap   = reader.ReadUInt16();
                m_Skills[i].FixedValue = reader.ReadUInt16();
                m_Skills[i].Lock       = (LockType)reader.ReadByte();
            }

            m_AR           = reader.ReadUInt16();
            m_StatCap      = reader.ReadUInt16();
            m_Followers    = reader.ReadByte();
            m_FollowersMax = reader.ReadByte();
            m_Tithe        = reader.ReadInt32();

            m_LocalLight  = reader.ReadSByte();
            m_GlobalLight = reader.ReadByte();
            m_Features    = reader.ReadUInt16();
            m_Season      = reader.ReadByte();

            if (version >= 4)
            {
                c = reader.ReadByte();
            }
            else
            {
                c = 8;
            }
            m_MapPatches = new int[c];
            for (int i = 0; i < c; i++)
            {
                m_MapPatches[i] = reader.ReadInt32();
            }
        }
Ejemplo n.º 2
0
        public SkillUpdate( Skill s )
            : base(0x3A)
        {
            EnsureCapacity( 3 + 1 + 9 );

            Write( (byte) 0xDF );

            Write( (short)s.Index );
            Write( (ushort)s.FixedValue );
            Write( (ushort)s.FixedBase );
            Write( (byte)s.Lock );
            Write( (ushort)s.FixedCap );
        }
Ejemplo n.º 3
0
        public void UpdateSkill( Skill skill )
        {
            double Total = 0;
            for (int i=0;i<Skill.Count;i++)
                Total += World.Player.Skills[i].Base;
            baseTotal.Text = String.Format( "{0:F1}", Total );

            for (int i=0;i<skillList.Items.Count;i++)
            {
                ListViewItem cur = skillList.Items[i];
                if ( cur.Tag == skill )
                {
                    cur.SubItems[1].Text = String.Format( "{0:F1}", skill.Value );
                    cur.SubItems[2].Text = String.Format( "{0:F1}", skill.Base );
                    cur.SubItems[3].Text = String.Format( "{0}{1:F1}", (skill.Delta > 0 ? "+" : ""), skill.Delta );
                    cur.SubItems[4].Text = String.Format( "{0:F1}", skill.Cap );
                    cur.SubItems[5].Text = skill.Lock.ToString()[0].ToString();
                    SortSkills();
                    return;
                }
            }
        }