Example #1
0
        public Character(MemoryStream inStream)
        {
            LoadType     = LoadedType.Client;
            PendingFlags = PendingFlag.None;

            Byte[] stringBuffer = new Byte[20];
            Byte[] expBuffer    = new Byte[4];

            AccountId = 0;
            inStream.Seek(22, SeekOrigin.Current);
            Slot = (Byte)inStream.ReadByte();
            inStream.Seek(3, SeekOrigin.Current);
            inStream.Read(stringBuffer, 0, 20);
            Name                 = Encoding.ASCII.GetString(stringBuffer).Split((Char)0)[0];
            Agility              = (Byte)inStream.ReadByte();
            Constitution         = (Byte)inStream.ReadByte();
            Memory               = (Byte)inStream.ReadByte();
            Reasoning            = (Byte)inStream.ReadByte();
            Discipline           = (Byte)inStream.ReadByte();
            Empathy              = (Byte)inStream.ReadByte();
            Intuition            = (Byte)inStream.ReadByte();
            Presence             = (Byte)inStream.ReadByte();
            Quickness            = (Byte)inStream.ReadByte();
            Strength             = (Byte)inStream.ReadByte();
            SpentStatPoints      = 0;
            BonusStatPoints      = 0;
            BonusStatPointsSpent = 0;
            inStream.Seek(14, SeekOrigin.Current);
            List1  = (Byte)inStream.ReadByte();
            List2  = (Byte)inStream.ReadByte();
            List3  = (Byte)inStream.ReadByte();
            List4  = (Byte)inStream.ReadByte();
            List5  = (Byte)inStream.ReadByte();
            List6  = (Byte)inStream.ReadByte();
            List7  = (Byte)inStream.ReadByte();
            List8  = (Byte)inStream.ReadByte();
            List9  = (Byte)inStream.ReadByte();
            List10 = (Byte)inStream.ReadByte();
            inStream.Seek(2, SeekOrigin.Current);
            ListLevel1  = (Byte)inStream.ReadByte();
            ListLevel2  = (Byte)inStream.ReadByte();
            ListLevel3  = (Byte)inStream.ReadByte();
            ListLevel4  = (Byte)inStream.ReadByte();
            ListLevel5  = (Byte)inStream.ReadByte();
            ListLevel6  = (Byte)inStream.ReadByte();
            ListLevel7  = (Byte)inStream.ReadByte();
            ListLevel8  = (Byte)inStream.ReadByte();
            ListLevel9  = (Byte)inStream.ReadByte();
            ListLevel10 = (Byte)inStream.ReadByte();
            inStream.Seek(2, SeekOrigin.Current);

            Byte pClass = (Byte)inStream.ReadByte();

            if (pClass > 3)
            {
                pClass = 0;
            }
            Class = (PlayerClass)pClass;

            Level      = (Byte)inStream.ReadByte();
            SpellPicks = (Byte)inStream.ReadByte();
            inStream.Seek(1, SeekOrigin.Current);
            Model = (Byte)inStream.ReadByte();
            inStream.Seek(3, SeekOrigin.Current);

            inStream.Read(expBuffer, 0, 4);
            Experience = NetHelper.FlipBytes(BitConverter.ToUInt32(expBuffer, 0));

            Byte[] kBuffer = new Byte[2];
            inStream.Read(kBuffer, 0, 2);
            SpellKey1 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey2 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey3 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey4 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey5 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey6 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey7 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey8 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey9 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey10 = NetHelper.FlipBytes(BitConverter.ToUInt16(kBuffer, 0));
            inStream.Read(kBuffer, 0, 2);
            SpellKey11 = BitConverter.ToUInt16(kBuffer, 0);
            inStream.Read(kBuffer, 0, 2);
            SpellKey12 = BitConverter.ToUInt16(kBuffer, 0);
            inStream.Seek(12, SeekOrigin.Current);

            OpLevel = (Byte)inStream.ReadByte();

            inStream.Read(expBuffer, 0, 4);
            PlayerFlags = (PlayerFlag)NetHelper.FlipBytes(BitConverter.ToUInt32(expBuffer, 0));

            SpellTrees = new SpellTreeCollection
            {
                new SpellTree(SpellManager.SpellTrees.FindById(List1), ListLevel1),
                new SpellTree(SpellManager.SpellTrees.FindById(List2), ListLevel2),
                new SpellTree(SpellManager.SpellTrees.FindById(List3), ListLevel3),
                new SpellTree(SpellManager.SpellTrees.FindById(List4), ListLevel4),
                new SpellTree(SpellManager.SpellTrees.FindById(List5), ListLevel5),
                new SpellTree(SpellManager.SpellTrees.FindById(List6), ListLevel6),
                new SpellTree(SpellManager.SpellTrees.FindById(List7), ListLevel7),
                new SpellTree(SpellManager.SpellTrees.FindById(List8), ListLevel8),
                new SpellTree(SpellManager.SpellTrees.FindById(List9), ListLevel9),
                new SpellTree(SpellManager.SpellTrees.FindById(List10), ListLevel10)
            };

            SpellTrees.RemoveAll(spellTrees => spellTrees.TreeSpells == null);
        }
Example #2
0
        public Character(Player player, DataRow data)
        {
            LoadType     = LoadedType.Server;
            PendingFlags = PendingFlag.None;

            CharacterId          = data.Field <Int32>("charid");
            AccountId            = data.Field <Int32>("accountid");
            Slot                 = data.Field <Byte>("slot");
            Name                 = data.Field <String>("name");
            Agility              = data.Field <Byte>("agility");
            Constitution         = data.Field <Byte>("constitution");
            Memory               = data.Field <Byte>("memory");
            Reasoning            = data.Field <Byte>("reasoning");
            Discipline           = data.Field <Byte>("discipline");
            Empathy              = data.Field <Byte>("empathy");
            Intuition            = data.Field <Byte>("intuition");
            Presence             = data.Field <Byte>("presence");
            Quickness            = data.Field <Byte>("quickness");
            Strength             = data.Field <Byte>("strength");
            SpentStatPoints      = data.Field <UInt32>("spent_stat");
            BonusStatPoints      = data.Field <UInt32>("bonus_stat");
            BonusStatPointsSpent = data.Field <UInt32>("bonus_spent");
            List1                = data.Field <Byte>("list_1");
            List2                = data.Field <Byte>("list_2");
            List3                = data.Field <Byte>("list_3");
            List4                = data.Field <Byte>("list_4");
            List5                = data.Field <Byte>("list_5");
            List6                = data.Field <Byte>("list_6");
            List7                = data.Field <Byte>("list_7");
            List8                = data.Field <Byte>("list_8");
            List9                = data.Field <Byte>("list_9");
            List10               = data.Field <Byte>("list_10");
            ListLevel1           = data.Field <Byte>("list_level_1");
            ListLevel2           = data.Field <Byte>("list_level_2");
            ListLevel3           = data.Field <Byte>("list_level_3");
            ListLevel4           = data.Field <Byte>("list_level_4");
            ListLevel5           = data.Field <Byte>("list_level_5");
            ListLevel6           = data.Field <Byte>("list_level_6");
            ListLevel7           = data.Field <Byte>("list_level_7");
            ListLevel8           = data.Field <Byte>("list_level_8");
            ListLevel9           = data.Field <Byte>("list_level_9");
            ListLevel10          = data.Field <Byte>("list_level_10");
            Class                = (PlayerClass)data.Field <Byte>("class");
            Level                = data.Field <Byte>("level");
            SpellPicks           = data.Field <Byte>("spell_picks");
            Model                = data.Field <Byte>("model");
            Experience           = data.Field <UInt64>("experience");
            SpellKey1            = data.Field <UInt16>("spell_key_1");
            SpellKey2            = data.Field <UInt16>("spell_key_2");
            SpellKey3            = data.Field <UInt16>("spell_key_3");
            SpellKey4            = data.Field <UInt16>("spell_key_4");
            SpellKey5            = data.Field <UInt16>("spell_key_5");
            SpellKey6            = data.Field <UInt16>("spell_key_6");
            SpellKey7            = data.Field <UInt16>("spell_key_7");
            SpellKey8            = data.Field <UInt16>("spell_key_8");
            SpellKey9            = data.Field <UInt16>("spell_key_9");
            SpellKey10           = data.Field <UInt16>("spell_key_10");
            SpellKey11           = data.Field <UInt16>("spell_key_11");
            SpellKey12           = data.Field <UInt16>("spell_key_12");
            OpLevel              = data.Field <Byte>("oplevel");
            PlayerFlags          = (PlayerFlag)data.Field <UInt32>("flags");

            Statistics = new StatisticSheet(player, this);

            SpellTrees = new SpellTreeCollection
            {
                new SpellTree(SpellManager.SpellTrees.FindById(List1), ListLevel1),
                new SpellTree(SpellManager.SpellTrees.FindById(List2), ListLevel2),
                new SpellTree(SpellManager.SpellTrees.FindById(List3), ListLevel3),
                new SpellTree(SpellManager.SpellTrees.FindById(List4), ListLevel4),
                new SpellTree(SpellManager.SpellTrees.FindById(List5), ListLevel5),
                new SpellTree(SpellManager.SpellTrees.FindById(List6), ListLevel6),
                new SpellTree(SpellManager.SpellTrees.FindById(List7), ListLevel7),
                new SpellTree(SpellManager.SpellTrees.FindById(List8), ListLevel8),
                new SpellTree(SpellManager.SpellTrees.FindById(List9), ListLevel9),
                new SpellTree(SpellManager.SpellTrees.FindById(List10), ListLevel10)
            };

            SpellTrees.RemoveAll(spellTrees => spellTrees.TreeSpells == null);

            LoadMilestones();
        }